Skip to content

Commit 2e280f6

Browse files
committed
[spec] Some tweaks to layout and SIMD ops (#1667)
1 parent 05e4601 commit 2e280f6

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>`:
@@ -316,14 +317,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
316317

317318
2. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
318319

319-
3. Let :math:`c` be the result of computing :math:`\vvunop_{\I128}(c_1)`.
320+
3. Let :math:`c` be the result of computing :math:`\vvunop_{\V128}(c_1)`.
320321

321322
4. Push the value :math:`\V128.\VCONST~c` to the stack.
322323

323324
.. math::
324325
\begin{array}{lcl@{\qquad}l}
325326
(\V128\K{.}\VCONST~c_1)~\V128\K{.}\vvunop &\stepto& (\V128\K{.}\VCONST~c)
326-
& (\iff c = \vvunop_{\I128}(c_1)) \\
327+
& (\iff c = \vvunop_{\V128}(c_1)) \\
327328
\end{array}
328329
329330
@@ -338,14 +339,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
338339

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

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

343344
5. 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{.}\vvbinop &\stepto& (\V128\K{.}\VCONST~c)
348-
& (\iff c = \vvbinop_{\I128}(c_1, c_2)) \\
349+
& (\iff c = \vvbinop_{\V128}(c_1, c_2)) \\
349350
\end{array}
350351
351352
@@ -362,14 +363,14 @@ Most vector instructions are defined in terms of generic numeric operators appli
362363

363364
4. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
364365

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

367368
6. Push the value :math:`\V128.\VCONST~c` to the stack.
368369

369370
.. math::
370371
\begin{array}{lcl@{\qquad}l}
371372
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~(\V128\K{.}\VCONST~c_3)~\V128\K{.}\vvternop &\stepto& (\V128\K{.}\VCONST~c)
372-
& (\iff c = \vvternop_{\I128}(c_1, c_2, c_3)) \\
373+
& (\iff c = \vvternop_{\V128}(c_1, c_2, c_3)) \\
373374
\end{array}
374375
375376
@@ -403,15 +404,15 @@ Most vector instructions are defined in terms of generic numeric operators appli
403404

404405
2. Pop the value :math:`\V128.\VCONST~c_2` from the stack.
405406

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

408409
4. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
409410

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

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

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

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

@@ -422,9 +423,9 @@ Most vector instructions are defined in terms of generic numeric operators appli
422423
\end{array}
423424
\\ \qquad
424425
\begin{array}[t]{@{}r@{~}l@{}}
425-
(\iff & i^\ast = \lanes_{i8x16}(c_2) \\
426-
\wedge & c^\ast = \lanes_{i8x16}(c_1)~0^{240} \\
427-
\wedge & c' = \lanes^{-1}_{i8x16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ]))
426+
(\iff & i^\ast = \lanes_{\I8X16}(c_2) \\
427+
\wedge & c^\ast = \lanes_{\I8X16}(c_1)~0^{240} \\
428+
\wedge & c' = \lanes^{-1}_{\I8X16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ]))
428429
\end{array}
429430
\end{array}
430431
@@ -440,15 +441,15 @@ Most vector instructions are defined in terms of generic numeric operators appli
440441

441442
3. Pop the value :math:`\V128.\VCONST~c_2` from the stack.
442443

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

445446
5. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
446447

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

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

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

453454
9. Push the value :math:`\V128.\VCONST~c` onto the stack.
454455

@@ -459,8 +460,8 @@ Most vector instructions are defined in terms of generic numeric operators appli
459460
\end{array}
460461
\\ \qquad
461462
\begin{array}[t]{@{}r@{~}l@{}}
462-
(\iff & i^\ast = \lanes_{i8x16}(c_1)~\lanes_{i8x16}(c_2) \\
463-
\wedge & c = \lanes^{-1}_{i8x16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]]))
463+
(\iff & i^\ast = \lanes_{\I8X16}(c_1)~\lanes_{\I8X16}(c_2) \\
464+
\wedge & c = \lanes^{-1}_{\I8X16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]]))
464465
\end{array}
465466
\end{array}
466467
@@ -1844,7 +1845,7 @@ Memory Instructions
18441845

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

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

18491850
15. Push the value :math:`\V128.\CONST~c` to the stack.
18501851

@@ -1861,7 +1862,7 @@ Memory Instructions
18611862
\wedge & \X{ea} + M \cdot N / 8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
18621863
\wedge & \bytes_{\iM}(m_k) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} + k \cdot M/8 \slice M/8] \\
18631864
\wedge & W = M \cdot 2 \\
1864-
\wedge & c = \lanes^{-1}_{\X{i}W\K{x}N}(\extend^{\sx}_{M,W}(m_0) \dots \extend^{\sx}_{M,W}(m_{N-1})))
1865+
\wedge & c = \lanes^{-1}_{\K{i}W\K{x}N}(\extend^{\sx}_{M,W}(m_0) \dots \extend^{\sx}_{M,W}(m_{N-1})))
18651866
\end{array}
18661867
\\[1ex]
18671868
\begin{array}{lcl@{\qquad}l}
@@ -1903,7 +1904,7 @@ Memory Instructions
19031904

19041905
12. Let :math:`L` be the integer :math:`128 / N`.
19051906

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

19081909
14. Push the value :math:`\V128.\CONST~c` to the stack.
19091910

@@ -1918,7 +1919,7 @@ Memory Instructions
19181919
(\iff & \X{ea} = i + \memarg.\OFFSET \\
19191920
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
19201921
\wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
1921-
\wedge & c = \lanes^{-1}_{\iN\K{x}L}(n^L))
1922+
\wedge & c = \lanes^{-1}_{\IN\K{x}L}(n^L))
19221923
\end{array}
19231924
\\[1ex]
19241925
\begin{array}{lcl@{\qquad}l}
@@ -2019,9 +2020,9 @@ Memory Instructions
20192020

20202021
14. Let :math:`L` be :math:`128 / N`.
20212022

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

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

20262027
17. Push the value :math:`\V128.\CONST~c` to the stack.
20272028

@@ -2037,7 +2038,7 @@ Memory Instructions
20372038
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
20382039
\wedge & \bytes_{\iN}(r) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
20392040
\wedge & L = 128/N \\
2040-
\wedge & c = \lanes^{-1}_{\K{i}N\K{x}L}(\lanes_{\K{i}N\K{x}L}(v) \with [x] = r))
2041+
\wedge & c = \lanes^{-1}_{\IN\K{x}L}(\lanes_{\IN\K{x}L}(v) \with [x] = r))
20412042
\end{array}
20422043
\\[1ex]
20432044
\begin{array}{lcl@{\qquad}l}
@@ -2156,7 +2157,7 @@ Memory Instructions
21562157

21572158
12. Let :math:`L` be :math:`128/N`.
21582159

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

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

@@ -2173,7 +2174,7 @@ Memory Instructions
21732174
(\iff & \X{ea} = i + \memarg.\OFFSET \\
21742175
\wedge & \X{ea} + N \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
21752176
\wedge & L = 128/N \\
2176-
\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]))
2177+
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\lanes_{\IN\K{x}L}(c)[x]))
21772178
\end{array}
21782179
\\[1ex]
21792180
\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
@@ -192,13 +192,15 @@
192192
.. |F32| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f32}}
193193
.. |F64| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f64}}
194194
.. |V128| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{v128}}
195+
.. |IN| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i}N}
196+
.. |FN| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f}N}
197+
.. |VN| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{v}N}
195198
.. |I8X16| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i8x16}}
196199
.. |I16X8| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i16x8}}
197200
.. |I32X4| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i32x4}}
198201
.. |I64X2| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{i64x2}}
199202
.. |F32X4| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f32x4}}
200203
.. |F64X2| mathdef:: \xref{syntax/types}{syntax-valtype}{\K{f64x2}}
201-
.. |I128| mathdef:: \K{i128}
202204

203205
.. |REF| mathdef:: \xref{syntax/types}{syntax-reftype}{\K{ref}}
204206
.. |NULL| mathdef:: \xref{syntax/types}{syntax-reftype}{\K{null}}

0 commit comments

Comments
 (0)