@@ -20,16 +20,15 @@ The mapping of numeric instructions to their underlying operators is expressed b
2020
2121.. math ::
2222 \begin {array}{lll@{\qquad }l}
23- \X {op}_{\IN }(i_1 ,\dots ,i_k) &=& \F {i}\X {op}_N(i_1 ,\dots ,i_k) \\
24- \X {op}_{\FN }(z_1 ,\dots ,z_k) &=& \F {f}\X {op}_N(z_1 ,\dots ,z_k) \\
25- \X {op}_{\VN }(i_1 ,\dots ,i_k) &=& \F {i}\X {op}_N(i_1 ,\dots ,i_k) \\
23+ \X {op}_{\IN }(i_1 ,\dots ,i_k) &=& \xref {exec/numerics}{int-ops}{\F {i}\X {op}}_N(i_1 ,\dots ,i_k) \\
24+ \X {op}_{\FN }(z_1 ,\dots ,z_k) &=& \xref {exec/numerics}{float-ops}{\F {f}\X {op}}_N(z_1 ,\dots ,z_k) \\
2625 \end {array}
2726
2827 And for :ref: `conversion operators <exec-cvtop >`:
2928
3029.. math ::
3130 \begin {array}{lll@{\qquad }l}
32- \X { cvtop} ^{\sx ^?}_{t_1 ,t_2 }(c) &=& \X {cvtop}^{\sx ^?}_{|t_1 |,|t_2 |}(c) \\
31+ \cvtop ^{\sx ^?}_{t_1 ,t_2 }(c) &=& \xref {exec/numerics}{convert-ops}{ \ X {cvtop} }^{\sx ^?}_{|t_1 |,|t_2 |}(c) \\
3332 \end {array}
3433
3534 Where the underlying operators are partial, the corresponding instruction will :ref: `trap <trap >` when the result is not defined.
@@ -64,9 +63,9 @@ Where the underlying operators are non-deterministic, because they may return on
6463
65642. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
6665
67- 3. If :math: `\unop _t (c_1 )` is defined, then:
66+ 3. If :math: `\unopF _t (c_1 )` is defined, then:
6867
69- a. Let :math: `c` be a possible result of computing :math: `\unop _t (c_1 )`.
68+ a. Let :math: `c` be a possible result of computing :math: `\unopF _t (c_1 )`.
7069
7170 b. Push the value :math: `t.\CONST ~c` to the stack.
7271
@@ -77,9 +76,9 @@ Where the underlying operators are non-deterministic, because they may return on
7776.. math ::
7877 \begin {array}{lcl@{\qquad }l}
7978 (t\K {.}\CONST ~c_1 )~t\K {.}\unop &\stepto & (t\K {.}\CONST ~c)
80- & (\iff c \in \unop _t (c_1 )) \\
79+ & (\iff c \in \unopF _t (c_1 )) \\
8180 (t\K {.}\CONST ~c_1 )~t\K {.}\unop &\stepto & \TRAP
82- & (\iff \unop _ {t}(c_1 ) = \{\})
81+ & (\iff \unopF _ {t}(c_1 ) = \{\})
8382 \end {array}
8483
8584
@@ -94,9 +93,9 @@ Where the underlying operators are non-deterministic, because they may return on
9493
95943. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
9695
97- 4. If :math: `\binop _t (c_1 , c_2 )` is defined, then:
96+ 4. If :math: `\binopF _t (c_1 , c_2 )` is defined, then:
9897
99- a. Let :math: `c` be a possible result of computing :math: `\binop _t (c_1 , c_2 )`.
98+ a. Let :math: `c` be a possible result of computing :math: `\binopF _t (c_1 , c_2 )`.
10099
101100 b. Push the value :math: `t.\CONST ~c` to the stack.
102101
@@ -107,9 +106,9 @@ Where the underlying operators are non-deterministic, because they may return on
107106.. math ::
108107 \begin {array}{lcl@{\qquad }l}
109108 (t\K {.}\CONST ~c_1 )~(t\K {.}\CONST ~c_2 )~t\K {.}\binop &\stepto & (t\K {.}\CONST ~c)
110- & (\iff c \in \binop _t (c_1 ,c_2 )) \\
109+ & (\iff c \in \binopF _t (c_1 ,c_2 )) \\
111110 (t\K {.}\CONST ~c_1 )~(t\K {.}\CONST ~c_2 )~t\K {.}\binop &\stepto & \TRAP
112- & (\iff \binop _ {t}(c_1 ,c_2 ) = \{\})
111+ & (\iff \binopF _ {t}(c_1 ,c_2 ) = \{\})
113112 \end {array}
114113
115114
@@ -122,14 +121,14 @@ Where the underlying operators are non-deterministic, because they may return on
122121
1231222. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
124123
125- 3. Let :math: `c` be the result of computing :math: `\testop _t (c_1 )`.
124+ 3. Let :math: `c` be the result of computing :math: `\testopF _t (c_1 )`.
126125
1271264. Push the value :math: `\I32 .\CONST ~c` to the stack.
128127
129128.. math ::
130129 \begin {array}{lcl@{\qquad }l}
131130 (t\K {.}\CONST ~c_1 )~t\K {.}\testop &\stepto & (\I32 \K {.}\CONST ~c)
132- & (\iff c = \testop _t (c_1 )) \\
131+ & (\iff c = \testopF _t (c_1 )) \\
133132 \end {array}
134133
135134
@@ -144,14 +143,14 @@ Where the underlying operators are non-deterministic, because they may return on
144143
1451443. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
146145
147- 4. Let :math: `c` be the result of computing :math: `\relop _t (c_1 , c_2 )`.
146+ 4. Let :math: `c` be the result of computing :math: `\relopF _t (c_1 , c_2 )`.
148147
1491485. Push the value :math: `\I32 .\CONST ~c` to the stack.
150149
151150.. math ::
152151 \begin {array}{lcl@{\qquad }l}
153152 (t\K {.}\CONST ~c_1 )~(t\K {.}\CONST ~c_2 )~t\K {.}\relop &\stepto & (\I32 \K {.}\CONST ~c)
154- & (\iff c = \relop _t (c_1 ,c_2 )) \\
153+ & (\iff c = \relopF _t (c_1 ,c_2 )) \\
155154 \end {array}
156155
157156
@@ -280,20 +279,27 @@ Reference Instructions
280279Vector Instructions
281280~~~~~~~~~~~~~~~~~~~
282281
283- Most vector instructions are defined in terms of generic numeric operators applied lane-wise based on the :ref: ` shape < syntax-vec-shape >` .
282+ Vector instructions that operate bitwise are handled as integer operations of respective width .
284283
285284.. math ::
286285 \begin {array}{lll@{\qquad }l}
286+ \X {op}_{\VN }(i_1 ,\dots ,i_k) &=& \xref {exec/numerics}{int-ops}{\F {i}\X {op}}_N(i_1 ,\dots ,i_k) \\
287+ \end {array}
288+
289+ Most other vector instructions are defined in terms of numeric operators that are applied lane-wise according to the given :ref: `shape <syntax-vec-shape >`.
290+
291+ .. math ::
292+ \begin {array}{llll}
287293 \X {op}_{t\K {x}N}(n_1 ,\dots ,n_k) &=&
288- \lanes ^{-1 }_{t\K {x}N}(op_t( \ lanes _{t\K {x}N}(n_1 ) ~ \ dots~ \ lanes _{t\K {x}N}(n_k))
294+ \lanes ^{-1 }_{t\K {x}N}(\xref {exec/instructions}{exec-instr-numeric}{ \X {op}}_t(i_ 1 , \dots ,i_k)^ \ast ) & \qquad ( \iff i_ 1 ^ \ast = \ lanes _{t\K {x}N}(n_1 ) \land \ dots \land i_k^ \ast = \ lanes _{t\K {x}N}(n_k) \\
289295 \end {array}
290296
291297 .. note ::
292- For example, the result of instruction :math: `\K {i32 x4 }.\ADD ` applied to operands :math: `i_ 1 , i_ 2 `
293- invokes :math: `\ADD _{\K {i32 x4 }}(i_ 1 , i_ 2 )`, which maps to
294- :math: `\lanes ^{-1 }_{\K {i32 x4 }}(\ADD _{\I32 }(i_1 ^+ , i_2 ^+) )`,
295- where :math: `i_1 ^+ ` and :math: `i_2 ^+ ` are sequences resulting from invoking
296- :math: `\lanes _{\K {i32 x4 }}(i_ 1 )` and :math: `\lanes _{\K {i32 x4 }}(i_ 2 )`
298+ For example, the result of instruction :math: `\K {i32 x4 }.\ADD ` applied to operands :math: `v_ 1 , v_ 2 `
299+ invokes :math: `\ADD _{\K {i32 x4 }}(v_ 1 , v_ 2 )`, which maps to
300+ :math: `\lanes ^{-1 }_{\K {i32 x4 }}(\ADD _{\I32 }(i_1 , i_2 )^ \ast )`,
301+ where :math: `i_1 ^\ast ` and :math: `i_2 ^\ast ` are sequences resulting from invoking
302+ :math: `\lanes _{\K {i32 x4 }}(v_ 1 )` and :math: `\lanes _{\K {i32 x4 }}(v_ 2 )`
297303 respectively.
298304
299305
@@ -531,31 +537,31 @@ Most vector instructions are defined in terms of generic numeric operators appli
531537
5325381. Assert: due to :ref: `validation <valid-vec-replace_lane >`, :math: `x < \dim (\shape )`.
533539
534- 2. Let :math: `t_ 1 ` be the type :math: `\unpacked (\shape )`.
540+ 2. Let :math: `t_ 2 ` be the type :math: `\unpacked (\shape )`.
535541
5365423. Assert: due to :ref: `validation <valid-vec-replace_lane >`, a value of :ref: `value type <syntax-valtype >` :math: `t_1 ` is on the top of the stack.
537543
538- 4. Pop the value :math: `t_ 1 .\CONST ~c_ 1 ` from the stack.
544+ 4. Pop the value :math: `t_ 2 .\CONST ~c_ 2 ` from the stack.
539545
5405465. Assert: due to :ref: `validation <valid-vec-replace_lane >`, a value of :ref: `value type <syntax-valtype >` |V128 | is on the top of the stack.
541547
542- 6. Pop the value :math: `\V128 .\VCONST ~c_ 2 ` from the stack.
548+ 6. Pop the value :math: `\V128 .\VCONST ~c_ 1 ` from the stack.
543549
544- 7. Let :math: `i^\ast ` be the result of computing :math: `\lanes _{\shape }(c_ 2 )`.
550+ 7. Let :math: `i^\ast ` be the result of computing :math: `\lanes _{\shape }(c_ 1 )`.
545551
546- 8. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{\shape }(i^\ast \with [x] = c_ 1 )`.
552+ 8. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{\shape }(i^\ast \with [x] = c_ 2 )`.
547553
5485549. Push :math: `\V128 .\VCONST ~c` on the stack.
549555
550556.. math ::
551557 \begin {array}{l}
552558 \begin {array}{lcl@{\qquad }l}
553- (t_ 1 \ K {.}\CONST ~c_1 )~(\V 128 \ K {.}\VCONST ~c_2 )~(\shape\K {.}\REPLACELANE ~x) &\stepto & (\V128 \K {.}\VCONST ~c)
559+ (\V 128 \ K {.}\VCONST ~c_1 )~(t_ 2 \ K {.}\CONST ~c_2 )~(\shape\K {.}\REPLACELANE ~x) &\stepto & (\V128 \K {.}\VCONST ~c)
554560 \end {array}
555561 \\ \qquad
556562 \begin {array}[t]{@{}r@{~}l@{}}
557- (\iff & i^\ast = \lanes _{\shape }(c_ 2 ) \\
558- \wedge & c = \lanes ^{-1 }_{\shape }(i^\ast \with [x] = c_ 1 ))
563+ (\iff & i^\ast = \lanes _{\shape }(c_ 1 ) \\
564+ \wedge & c = \lanes ^{-1 }_{\shape }(i^\ast \with [x] = c_ 2 ))
559565 \end {array}
560566 \end {array}
561567
@@ -687,9 +693,9 @@ Most vector instructions are defined in terms of generic numeric operators appli
687693
6886941. Assert: due to :ref: `validation <valid-vtestop >`, a value of :ref: `value type <syntax-valtype >` |V128 | is on the top of the stack.
689695
690- 2. Pop the value :math: `\V128 .\VCONST ~c_ 1 ` from the stack.
696+ 2. Pop the value :math: `\V128 .\VCONST ~c ` from the stack.
691697
692- 3. Let :math: `i_1 ^\ast ` be the result of computing :math: `\lanes _{\shape }(c_ 1 )`.
698+ 3. Let :math: `i_1 ^\ast ` be the result of computing :math: `\lanes _{\shape }(c )`.
693699
6947004. Let :math: `i` be the result of computing :math: `\bool (\bigwedge (i_1 \neq 0 )^\ast )`.
695701
@@ -699,7 +705,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
699705.. math ::
700706 \begin {array}{l}
701707 \begin {array}{lcl@{\qquad }l}
702- (\V128 \K {.}\VCONST ~c_ 1 )~\shape\K {.}\ALLTRUE &\stepto & (\I32 \K {.}\CONST ~i)
708+ (\V128 \K {.}\VCONST ~c )~\shape\K {.}\ALLTRUE &\stepto & (\I32 \K {.}\CONST ~i)
703709 \end {array}
704710 \\ \qquad
705711 \begin {array}[t]{@{}r@{~}l@{}}
@@ -716,7 +722,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
716722
7177231. Assert: due to :ref: `validation <valid-vec-bitmask >`, a value of :ref: `value type <syntax-valtype >` |V128 | is on the top of the stack.
718724
719- 2. Pop the value :math: `\V128 .\VCONST ~c_ 1 ` from the stack.
725+ 2. Pop the value :math: `\V128 .\VCONST ~c ` from the stack.
720726
7217273. Let :math: `i_1 ^N` be the result of computing :math: `\lanes _{t\K {x}N}(c)`.
722728
@@ -726,14 +732,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
726732
7277336. Let :math: `j^\ast ` be the concatenation of the two sequences :math: `i_2 ^N` and :math: `0 ^{32 -N}`.
728734
729- 7. Let :math: `c ` be the result of computing :math: `\ibits _{32 }^{-1 }(j^\ast )`.
735+ 7. Let :math: `i ` be the result of computing :math: `\ibits _{32 }^{-1 }(j^\ast )`.
730736
731- 8. Push the value :math: `\I32 .\CONST ~c ` onto the stack.
737+ 8. Push the value :math: `\I32 .\CONST ~i ` onto the stack.
732738
733739.. math ::
734740 \begin {array}{lcl@{\qquad }l}
735- (\V128 \K {.}\VCONST ~c_ 1 )~t\K {x}N\K {.}\BITMASK &\stepto & (\I32 \K {.}\CONST ~c )
736- & (\iff c = \ibits _{32 }^{-1 }(\ilts _{|t|}(\lanes _{t\K {x}N}(c), 0 ^N)))
741+ (\V128 \K {.}\VCONST ~c )~t\K {x}N\K {.}\BITMASK &\stepto & (\I32 \K {.}\CONST ~i )
742+ & (\iff i = \ibits _{32 }^{-1 }(\ilts _{|t|}(\lanes _{t\K {x}N}(c), 0 ^N)))
737743 \\
738744 \end {array}
739745
@@ -855,8 +861,8 @@ where:
855861 \end {array}
856862
857863
858- :math: `t_2 \K {x}N\K {.}\vcvtop\K {\_ }t_1 \K {x}M\K {\_ }\sx\K {\_zero}`
859- ...............................................................
864+ :math: `t_2 \K {x}N\K {.}\vcvtop\K {\_ }t_1 \K {x}M\K {\_ }\sx ^? \K {\_zero}`
865+ .................................................................
860866
8618671. Assert: due to :ref: `syntax <syntax-instr-vec >`, :math: `N = 2 \cdot M`.
862868
@@ -866,7 +872,7 @@ where:
866872
8678734. Let :math: `i^\ast ` be the result of computing :math: `\lanes _{t_1 \K {x}M}(c_1 )`.
868874
869- 5. Let :math: `j^\ast ` be the result of computing :math: `\vcvtop ^{\sx }_{|t_1 |,|t_2 |}(i^\ast )`.
875+ 5. Let :math: `j^\ast ` be the result of computing :math: `\vcvtop ^{\sx ^? }_{|t_1 |,|t_2 |}(i^\ast )`.
870876
8718776. Let :math: `k^\ast ` be the concatenation of the two sequences :math: `j^\ast ` and :math: `0 ^M`.
872878
@@ -877,11 +883,11 @@ where:
877883.. math ::
878884 \begin {array}{l}
879885 \begin {array}{lcl@{\qquad }l}
880- (\V128 \K {.}\VCONST ~c_1 )~t_2 \K {x}N\K {.}\vcvtop\K {\_ }t_1 \K {x}M\K {\_ }\sx\K {\_zero} &\stepto & (\V128 \K {.}\VCONST ~c) \\
886+ (\V128 \K {.}\VCONST ~c_1 )~t_2 \K {x}N\K {.}\vcvtop\K {\_ }t_1 \K {x}M\K {\_ }\sx ^? \K {\_zero} &\stepto & (\V128 \K {.}\VCONST ~c) \\
881887 \end {array}
882888 \\ \qquad
883889 \begin {array}[t]{@{}r@{~}l@{}}
884- (\iff & c = \lanes ^{-1 }_{t_2 \K {x}N}(\vcvtop ^{\sx }_{|t_1 |,|t_2 |}(\lanes _{t_1 \K {x}M}(c_1 ))~0 ^M))
890+ (\iff & c = \lanes ^{-1 }_{t_2 \K {x}N}(\vcvtop ^{\sx ^? }_{|t_1 |,|t_2 |}(\lanes _{t_1 \K {x}M}(c_1 ))~0 ^M))
885891 \end {array}
886892 \end {array}
887893
@@ -960,7 +966,7 @@ where:
960966
96196710. Let :math: `k_2 ^\ast ` be the result of computing :math: `\extend ^{\sx }_{|t_1 |,|t_2 |}(j_2 ^\ast )`.
962968
963- 11. Let :math: `k^\ast ` be the result of computing :math: `\imul _{t_2 \K {x}N }(k_1 ^\ast , k_2 ^\ast )`.
969+ 11. Let :math: `k^\ast ` be the result of computing :math: `\imul _{| t_2 | }(k_1 ^\ast , k_2 ^\ast )`.
964970
96597112. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{t_2 \K {x}N}(k^\ast )`.
966972
@@ -974,7 +980,7 @@ where:
974980 \begin {array}[t]{@{}r@{~}l@{}}
975981 (\iff & i^\ast = \lanes _{t_1 \K {x}M}(c_1 )[\half (0 , N) \slice N] \\
976982 \wedge & j^\ast = \lanes _{t_1 \K {x}M}(c_2 )[\half (0 , N) \slice N] \\
977- \wedge & c = \lanes ^{-1 }_{t_2 \K {x}N}(\imul _{t_2 \K {x}N }(\extend ^{\sx }_{|t_1 |,|t_2 |}(i^\ast ), \extend ^{\sx }_{|t_1 |,|t_2 |}(j^\ast ))))
983+ \wedge & c = \lanes ^{-1 }_{t_2 \K {x}N}(\imul _{| t_2 | }(\extend ^{\sx }_{|t_1 |,|t_2 |}(i^\ast ), \extend ^{\sx }_{|t_1 |,|t_2 |}(j^\ast ))))
978984 \end {array}
979985
980986 where:
@@ -1001,7 +1007,7 @@ where:
10011007
100210085. Let :math: `(j_1 ~j_2 )^\ast ` be the result of computing :math: `\extend ^{\sx }_{|t_1 |,|t_2 |}(i^\ast )`.
10031009
1004- 6. Let :math: `k^\ast ` be the result of computing :math: `\iadd _{N }(j_1 , j_2 )^\ast `.
1010+ 6. Let :math: `k^\ast ` be the result of computing :math: `\iadd _{|t_ 2 | }(j_1 , j_2 )^\ast `.
10051011
100610127. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{t_2 \K {x}N}(k^\ast )`.
10071013
@@ -1015,7 +1021,7 @@ where:
10151021 \\ \qquad
10161022 \begin {array}[t]{@{}r@{~}l@{}}
10171023 (\iff & (i_1 ~i_2 )^\ast = \extend ^{\sx }_{|t_1 |,|t_2 |}(\lanes _{t_1 \K {x}M}(c_1 )) \\
1018- \wedge & j^\ast = \iadd _{N }(i_1 , i_2 )^\ast \\
1024+ \wedge & j^\ast = \iadd _{|t_ 2 | }(i_1 , i_2 )^\ast \\
10191025 \wedge & c = \lanes ^{-1 }_{t_2 \K {x}N}(j^\ast ))
10201026 \end {array}
10211027 \end {array}
0 commit comments