@@ -20,16 +20,15 @@ The mapping of numeric instructions to their underlying operators is expressed b
20
20
21
21
.. math ::
22
22
\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) \\
26
25
\end {array}
27
26
28
27
And for :ref: `conversion operators <exec-cvtop >`:
29
28
30
29
.. math ::
31
30
\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) \\
33
32
\end {array}
34
33
35
34
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
64
63
65
64
2. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
66
65
67
- 3. If :math: `\unop _t (c_1 )` is defined, then:
66
+ 3. If :math: `\unopF _t (c_1 )` is defined, then:
68
67
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 )`.
70
69
71
70
b. Push the value :math: `t.\CONST ~c` to the stack.
72
71
@@ -77,9 +76,9 @@ Where the underlying operators are non-deterministic, because they may return on
77
76
.. math ::
78
77
\begin {array}{lcl@{\qquad }l}
79
78
(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 )) \\
81
80
(t\K {.}\CONST ~c_1 )~t\K {.}\unop &\stepto & \TRAP
82
- & (\iff \unop _ {t}(c_1 ) = \{\})
81
+ & (\iff \unopF _ {t}(c_1 ) = \{\})
83
82
\end {array}
84
83
85
84
@@ -94,9 +93,9 @@ Where the underlying operators are non-deterministic, because they may return on
94
93
95
94
3. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
96
95
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:
98
97
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 )`.
100
99
101
100
b. Push the value :math: `t.\CONST ~c` to the stack.
102
101
@@ -107,9 +106,9 @@ Where the underlying operators are non-deterministic, because they may return on
107
106
.. math ::
108
107
\begin {array}{lcl@{\qquad }l}
109
108
(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 )) \\
111
110
(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 ) = \{\})
113
112
\end {array}
114
113
115
114
@@ -122,14 +121,14 @@ Where the underlying operators are non-deterministic, because they may return on
122
121
123
122
2. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
124
123
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 )`.
126
125
127
126
4. Push the value :math: `\I32 .\CONST ~c` to the stack.
128
127
129
128
.. math ::
130
129
\begin {array}{lcl@{\qquad }l}
131
130
(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 )) \\
133
132
\end {array}
134
133
135
134
@@ -144,14 +143,14 @@ Where the underlying operators are non-deterministic, because they may return on
144
143
145
144
3. Pop the value :math: `t.\CONST ~c_1 ` from the stack.
146
145
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 )`.
148
147
149
148
5. Push the value :math: `\I32 .\CONST ~c` to the stack.
150
149
151
150
.. math ::
152
151
\begin {array}{lcl@{\qquad }l}
153
152
(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 )) \\
155
154
\end {array}
156
155
157
156
@@ -280,20 +279,27 @@ Reference Instructions
280
279
Vector Instructions
281
280
~~~~~~~~~~~~~~~~~~~
282
281
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 .
284
283
285
284
.. math ::
286
285
\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}
287
293
\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) \\
289
295
\end {array}
290
296
291
297
.. 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 )`
297
303
respectively.
298
304
299
305
@@ -531,31 +537,31 @@ Most vector instructions are defined in terms of generic numeric operators appli
531
537
532
538
1. Assert: due to :ref: `validation <valid-vec-replace_lane >`, :math: `x < \dim (\shape )`.
533
539
534
- 2. Let :math: `t_ 1 ` be the type :math: `\unpacked (\shape )`.
540
+ 2. Let :math: `t_ 2 ` be the type :math: `\unpacked (\shape )`.
535
541
536
542
3. 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.
537
543
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.
539
545
540
546
5. 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.
541
547
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.
543
549
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 )`.
545
551
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 )`.
547
553
548
554
9. Push :math: `\V128 .\VCONST ~c` on the stack.
549
555
550
556
.. math ::
551
557
\begin {array}{l}
552
558
\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)
554
560
\end {array}
555
561
\\ \qquad
556
562
\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 ))
559
565
\end {array}
560
566
\end {array}
561
567
@@ -687,9 +693,9 @@ Most vector instructions are defined in terms of generic numeric operators appli
687
693
688
694
1. Assert: due to :ref: `validation <valid-vtestop >`, a value of :ref: `value type <syntax-valtype >` |V128 | is on the top of the stack.
689
695
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.
691
697
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 )`.
693
699
694
700
4. Let :math: `i` be the result of computing :math: `\bool (\bigwedge (i_1 \neq 0 )^\ast )`.
695
701
@@ -699,7 +705,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
699
705
.. math ::
700
706
\begin {array}{l}
701
707
\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)
703
709
\end {array}
704
710
\\ \qquad
705
711
\begin {array}[t]{@{}r@{~}l@{}}
@@ -716,7 +722,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
716
722
717
723
1. Assert: due to :ref: `validation <valid-vec-bitmask >`, a value of :ref: `value type <syntax-valtype >` |V128 | is on the top of the stack.
718
724
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.
720
726
721
727
3. Let :math: `i_1 ^N` be the result of computing :math: `\lanes _{t\K {x}N}(c)`.
722
728
@@ -726,14 +732,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
726
732
727
733
6. Let :math: `j^\ast ` be the concatenation of the two sequences :math: `i_2 ^N` and :math: `0 ^{32 -N}`.
728
734
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 )`.
730
736
731
- 8. Push the value :math: `\I32 .\CONST ~c ` onto the stack.
737
+ 8. Push the value :math: `\I32 .\CONST ~i ` onto the stack.
732
738
733
739
.. math ::
734
740
\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)))
737
743
\\
738
744
\end {array}
739
745
@@ -855,8 +861,8 @@ where:
855
861
\end {array}
856
862
857
863
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
+ .................................................................
860
866
861
867
1. Assert: due to :ref: `syntax <syntax-instr-vec >`, :math: `N = 2 \cdot M`.
862
868
@@ -866,7 +872,7 @@ where:
866
872
867
873
4. Let :math: `i^\ast ` be the result of computing :math: `\lanes _{t_1 \K {x}M}(c_1 )`.
868
874
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 )`.
870
876
871
877
6. Let :math: `k^\ast ` be the concatenation of the two sequences :math: `j^\ast ` and :math: `0 ^M`.
872
878
@@ -877,11 +883,11 @@ where:
877
883
.. math ::
878
884
\begin {array}{l}
879
885
\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) \\
881
887
\end {array}
882
888
\\ \qquad
883
889
\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))
885
891
\end {array}
886
892
\end {array}
887
893
@@ -960,7 +966,7 @@ where:
960
966
961
967
10. Let :math: `k_2 ^\ast ` be the result of computing :math: `\extend ^{\sx }_{|t_1 |,|t_2 |}(j_2 ^\ast )`.
962
968
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 )`.
964
970
965
971
12. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{t_2 \K {x}N}(k^\ast )`.
966
972
@@ -974,7 +980,7 @@ where:
974
980
\begin {array}[t]{@{}r@{~}l@{}}
975
981
(\iff & i^\ast = \lanes _{t_1 \K {x}M}(c_1 )[\half (0 , N) \slice N] \\
976
982
\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 ))))
978
984
\end {array}
979
985
980
986
where:
@@ -1001,7 +1007,7 @@ where:
1001
1007
1002
1008
5. Let :math: `(j_1 ~j_2 )^\ast ` be the result of computing :math: `\extend ^{\sx }_{|t_1 |,|t_2 |}(i^\ast )`.
1003
1009
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 `.
1005
1011
1006
1012
7. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{t_2 \K {x}N}(k^\ast )`.
1007
1013
@@ -1015,7 +1021,7 @@ where:
1015
1021
\\ \qquad
1016
1022
\begin {array}[t]{@{}r@{~}l@{}}
1017
1023
(\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 \\
1019
1025
\wedge & c = \lanes ^{-1 }_{t_2 \K {x}N}(j^\ast ))
1020
1026
\end {array}
1021
1027
\end {array}
0 commit comments