Skip to content

Commit 6315e12

Browse files
authored
[spec] Some tweaks to layout and SIMD ops (#1667)
1 parent c674a0b commit 6315e12

File tree

5 files changed

+40
-35
lines changed

5 files changed

+40
-35
lines changed

document/core/exec/instructions.rst

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ The mapping of numeric instructions to their underlying operators is expressed b
2020

2121
.. math::
2222
\begin{array}{lll@{\qquad}l}
23-
\X{op}_{\K{i}N}(n_1,\dots,n_k) &=& \F{i}\X{op}_N(n_1,\dots,n_k) \\
24-
\X{op}_{\K{f}N}(z_1,\dots,z_k) &=& \F{f}\X{op}_N(z_1,\dots,z_k) \\
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) \\
2526
\end{array}
2627
2728
And for :ref:`conversion operators <exec-cvtop>`:
@@ -292,14 +293,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
292293

293294
2. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
294295

295-
3. Let :math:`c` be the result of computing :math:`\vvunop_{\I128}(c_1)`.
296+
3. Let :math:`c` be the result of computing :math:`\vvunop_{\V128}(c_1)`.
296297

297298
4. Push the value :math:`\V128.\VCONST~c` to the stack.
298299

299300
.. math::
300301
\begin{array}{lcl@{\qquad}l}
301302
(\V128\K{.}\VCONST~c_1)~\V128\K{.}\vvunop &\stepto& (\V128\K{.}\VCONST~c)
302-
& (\iff c = \vvunop_{\I128}(c_1)) \\
303+
& (\iff c = \vvunop_{\V128}(c_1)) \\
303304
\end{array}
304305
305306
@@ -314,14 +315,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
314315

315316
3. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
316317

317-
4. Let :math:`c` be the result of computing :math:`\vvbinop_{\I128}(c_1, c_2)`.
318+
4. Let :math:`c` be the result of computing :math:`\vvbinop_{\V128}(c_1, c_2)`.
318319

319320
5. Push the value :math:`\V128.\VCONST~c` to the stack.
320321

321322
.. math::
322323
\begin{array}{lcl@{\qquad}l}
323324
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\V128\K{.}\vvbinop &\stepto& (\V128\K{.}\VCONST~c)
324-
& (\iff c = \vvbinop_{\I128}(c_1, c_2)) \\
325+
& (\iff c = \vvbinop_{\V128}(c_1, c_2)) \\
325326
\end{array}
326327
327328
@@ -338,14 +339,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
338339

339340
4. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
340341

341-
5. Let :math:`c` be the result of computing :math:`\vvternop_{\I128}(c_1, c_2, c_3)`.
342+
5. Let :math:`c` be the result of computing :math:`\vvternop_{\V128}(c_1, c_2, c_3)`.
342343

343344
6. Push the value :math:`\V128.\VCONST~c` to the stack.
344345

345346
.. math::
346347
\begin{array}{lcl@{\qquad}l}
347348
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~(\V128\K{.}\VCONST~c_3)~\V128\K{.}\vvternop &\stepto& (\V128\K{.}\VCONST~c)
348-
& (\iff c = \vvternop_{\I128}(c_1, c_2, c_3)) \\
349+
& (\iff c = \vvternop_{\V128}(c_1, c_2, c_3)) \\
349350
\end{array}
350351
351352
@@ -379,15 +380,15 @@ Most vector instructions are defined in terms of generic numeric operators appli
379380

380381
2. Pop the value :math:`\V128.\VCONST~c_2` from the stack.
381382

382-
3. Let :math:`i^\ast` be the result of computing :math:`\lanes_{i8x16}(c_2)`.
383+
3. Let :math:`i^\ast` be the result of computing :math:`\lanes_{\I8X16}(c_2)`.
383384

384385
4. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
385386

386-
5. Let :math:`j^\ast` be the result of computing :math:`\lanes_{i8x16}(c_1)`.
387+
5. Let :math:`j^\ast` be the result of computing :math:`\lanes_{\I8X16}(c_1)`.
387388

388389
6. Let :math:`c^\ast` be the concatenation of the two sequences :math:`j^\ast` and :math:`0^{240}`.
389390

390-
7. Let :math:`c'` be the result of computing :math:`\lanes^{-1}_{i8x16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ])`.
391+
7. Let :math:`c'` be the result of computing :math:`\lanes^{-1}_{\I8X16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ])`.
391392

392393
8. Push the value :math:`\V128.\VCONST~c'` onto the stack.
393394

@@ -398,9 +399,9 @@ Most vector instructions are defined in terms of generic numeric operators appli
398399
\end{array}
399400
\\ \qquad
400401
\begin{array}[t]{@{}r@{~}l@{}}
401-
(\iff & i^\ast = \lanes_{i8x16}(c_2) \\
402-
\wedge & c^\ast = \lanes_{i8x16}(c_1)~0^{240} \\
403-
\wedge & c' = \lanes^{-1}_{i8x16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ]))
402+
(\iff & i^\ast = \lanes_{\I8X16}(c_2) \\
403+
\wedge & c^\ast = \lanes_{\I8X16}(c_1)~0^{240} \\
404+
\wedge & c' = \lanes^{-1}_{\I8X16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ]))
404405
\end{array}
405406
\end{array}
406407
@@ -416,15 +417,15 @@ Most vector instructions are defined in terms of generic numeric operators appli
416417

417418
3. Pop the value :math:`\V128.\VCONST~c_2` from the stack.
418419

419-
4. Let :math:`i_2^\ast` be the result of computing :math:`\lanes_{i8x16}(c_2)`.
420+
4. Let :math:`i_2^\ast` be the result of computing :math:`\lanes_{\I8X16}(c_2)`.
420421

421422
5. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
422423

423-
6. Let :math:`i_1^\ast` be the result of computing :math:`\lanes_{i8x16}(c_1)`.
424+
6. Let :math:`i_1^\ast` be the result of computing :math:`\lanes_{\I8X16}(c_1)`.
424425

425426
7. Let :math:`i^\ast` be the concatenation of the two sequences :math:`i_1^\ast` and :math:`i_2^\ast`.
426427

427-
8. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{i8x16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]])`.
428+
8. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\I8X16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]])`.
428429

429430
9. Push the value :math:`\V128.\VCONST~c` onto the stack.
430431

@@ -435,8 +436,8 @@ Most vector instructions are defined in terms of generic numeric operators appli
435436
\end{array}
436437
\\ \qquad
437438
\begin{array}[t]{@{}r@{~}l@{}}
438-
(\iff & i^\ast = \lanes_{i8x16}(c_1)~\lanes_{i8x16}(c_2) \\
439-
\wedge & c = \lanes^{-1}_{i8x16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]]))
439+
(\iff & i^\ast = \lanes_{\I8X16}(c_1)~\lanes_{\I8X16}(c_2) \\
440+
\wedge & c = \lanes^{-1}_{\I8X16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]]))
440441
\end{array}
441442
\end{array}
442443
@@ -1820,7 +1821,7 @@ Memory Instructions
18201821

18211822
13. Let :math:`n_k` be the result of computing :math:`\extend^{\sx}_{M,W}(m_k)`.
18221823

1823-
14. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\X{i}W\K{x}N}(n_0 \dots n_{N-1})`.
1824+
14. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\K{i}W\K{x}N}(n_0 \dots n_{N-1})`.
18241825

18251826
15. Push the value :math:`\V128.\CONST~c` to the stack.
18261827

@@ -1837,7 +1838,7 @@ Memory Instructions
18371838
\wedge & \X{ea} + M \cdot N / 8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
18381839
\wedge & \bytes_{\iM}(m_k) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} + k \cdot M/8 \slice M/8] \\
18391840
\wedge & W = M \cdot 2 \\
1840-
\wedge & c = \lanes^{-1}_{\X{i}W\K{x}N}(\extend^{\sx}_{M,W}(m_0) \dots \extend^{\sx}_{M,W}(m_{N-1})))
1841+
\wedge & c = \lanes^{-1}_{\K{i}W\K{x}N}(\extend^{\sx}_{M,W}(m_0) \dots \extend^{\sx}_{M,W}(m_{N-1})))
18411842
\end{array}
18421843
\\[1ex]
18431844
\begin{array}{lcl@{\qquad}l}
@@ -1879,7 +1880,7 @@ Memory Instructions
18791880

18801881
12. Let :math:`L` be the integer :math:`128 / N`.
18811882

1882-
13. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\iN\K{x}L}(n^L)`.
1883+
13. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\IN\K{x}L}(n^L)`.
18831884

18841885
14. Push the value :math:`\V128.\CONST~c` to the stack.
18851886

@@ -1894,7 +1895,7 @@ Memory Instructions
18941895
(\iff & \X{ea} = i + \memarg.\OFFSET \\
18951896
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
18961897
\wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
1897-
\wedge & c = \lanes^{-1}_{\iN\K{x}L}(n^L))
1898+
\wedge & c = \lanes^{-1}_{\IN\K{x}L}(n^L))
18981899
\end{array}
18991900
\\[1ex]
19001901
\begin{array}{lcl@{\qquad}l}
@@ -1995,9 +1996,9 @@ Memory Instructions
19951996

19961997
14. Let :math:`L` be :math:`128 / N`.
19971998

1998-
15. Let :math:`j^\ast` be the result of computing :math:`\lanes_{\K{i}N\K{x}L}(v)`.
1999+
15. Let :math:`j^\ast` be the result of computing :math:`\lanes_{\IN\K{x}L}(v)`.
19992000

2000-
16. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\K{i}N\K{x}L}(j^\ast \with [x] = r)`.
2001+
16. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\IN\K{x}L}(j^\ast \with [x] = r)`.
20012002

20022003
17. Push the value :math:`\V128.\CONST~c` to the stack.
20032004

@@ -2013,7 +2014,7 @@ Memory Instructions
20132014
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
20142015
\wedge & \bytes_{\iN}(r) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
20152016
\wedge & L = 128/N \\
2016-
\wedge & c = \lanes^{-1}_{\K{i}N\K{x}L}(\lanes_{\K{i}N\K{x}L}(v) \with [x] = r))
2017+
\wedge & c = \lanes^{-1}_{\IN\K{x}L}(\lanes_{\IN\K{x}L}(v) \with [x] = r))
20172018
\end{array}
20182019
\\[1ex]
20192020
\begin{array}{lcl@{\qquad}l}
@@ -2132,7 +2133,7 @@ Memory Instructions
21322133

21332134
12. Let :math:`L` be :math:`128/N`.
21342135

2135-
13. Let :math:`j^\ast` be the result of computing :math:`\lanes_{\K{i}N\K{x}L}(c)`.
2136+
13. Let :math:`j^\ast` be the result of computing :math:`\lanes_{\IN\K{x}L}(c)`.
21362137

21372138
14. Let :math:`b^\ast` be the result of computing :math:`\bytes_{\iN}(j^\ast[x])`.
21382139

@@ -2149,7 +2150,7 @@ Memory Instructions
21492150
(\iff & \X{ea} = i + \memarg.\OFFSET \\
21502151
\wedge & \X{ea} + N \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
21512152
\wedge & L = 128/N \\
2152-
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\lanes_{\K{i}N\K{x}L}(c)[x]))
2153+
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\lanes_{\IN\K{x}L}(c)[x]))
21532154
\end{array}
21542155
\\[1ex]
21552156
\begin{array}{lcl@{\qquad}l}

document/core/exec/numerics.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,19 @@ Conventions:
104104
105105
106106
107-
.. index:: bit, integer, floating-point
107+
.. index:: bit, integer, floating-point, numeric vector
108108
.. _aux-bits:
109109

110110
Representations
111111
~~~~~~~~~~~~~~~
112112

113-
Numbers have an underlying binary representation as a sequence of bits:
113+
Numbers and numeric vectors have an underlying binary representation as a sequence of bits:
114114

115115
.. math::
116116
\begin{array}{lll@{\qquad}l}
117-
\bits_{\K{i}N}(i) &=& \ibits_N(i) \\
118-
\bits_{\K{f}N}(z) &=& \fbits_N(z) \\
117+
\bits_{\IN}(i) &=& \ibits_N(i) \\
118+
\bits_{\FN}(z) &=& \fbits_N(z) \\
119+
\bits_{\VN}(i) &=& \ibits_N(i) \\
119120
\end{array}
120121
121122
Each of these functions is a bijection, hence they are invertible.
@@ -163,6 +164,7 @@ where :math:`M = \significand(N)` and :math:`E = \exponent(N)`.
163164

164165
.. index:: numeric vector, shape, lane
165166
.. _aux-lanes:
167+
.. _syntax-i128:
166168

167169
Vectors
168170
.......

document/core/syntax/instructions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Occasionally, it is convenient to group operators together according to the foll
171171
\end{array}
172172
173173
174-
.. index:: ! vector instruction, numeric vectors, number, value, value type, SIMD
174+
.. index:: ! vector instruction, numeric vector, number, value, value type, SIMD
175175
pair: abstract syntax; instruction
176176
.. _syntax-laneidx:
177177
.. _syntax-shape:

document/core/syntax/values.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Conventions
148148
* The meta variable :math:`z` ranges over floating-point values where clear from context.
149149

150150

151-
.. index:: ! numeric vectors, integer, floating-point, lane, SIMD
151+
.. index:: ! numeric vector, integer, floating-point, lane, SIMD
152152
pair: abstract syntax; vector
153153
.. _syntax-vecnum:
154154

document/core/util/macros.def

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,15 @@
184184
.. |F32| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f32}}
185185
.. |F64| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f64}}
186186
.. |V128| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{v128}}
187+
.. |IN| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i}N}
188+
.. |FN| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f}N}
189+
.. |VN| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{v}N}
187190
.. |I8X16| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i8x16}}
188191
.. |I16X8| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i16x8}}
189192
.. |I32X4| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i32x4}}
190193
.. |I64X2| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i64x2}}
191194
.. |F32X4| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f32x4}}
192195
.. |F64X2| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f64x2}}
193-
.. |I128| mathdef:: \K{i128}
194196

195197
.. |FUNCREF| mathdef:: \xref{syntax/types}{syntax-reftype}{\K{funcref}}
196198
.. |EXTERNREF| mathdef:: \xref{syntax/types}{syntax-reftype}{\K{externref}}

0 commit comments

Comments
 (0)