Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 7c0ca01

Browse files
ngzhianrossberg
andauthored
[spectext] Add i32x4.dot_i16x8_s (#475)
This instruction was added in #127. Co-authored-by: Andreas Rossberg <[email protected]>
1 parent a041470 commit 7c0ca01

File tree

8 files changed

+53
-0
lines changed

8 files changed

+53
-0
lines changed

document/core/appendix/gen-index-instructions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
488488
Instruction(r'\I32X4.\VMIN\K{\_u}', r'\hex{FD}~~183', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-imin_u'),
489489
Instruction(r'\I32X4.\VMAX\K{\_s}', r'\hex{FD}~~184', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-imax_s'),
490490
Instruction(r'\I32X4.\VMAX\K{\_u}', r'\hex{FD}~~185', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-imax_u'),
491+
Instruction(r'\I32X4.\DOT\K{\_i16x8\_s}', r'\hex{FD}~~186', r'[\V128~\V128] \to [\V128]', r'valid-simd-dot', r'exec-simd-dot'),
491492
Instruction(r'\I32X4.\EXTMUL\K{\_low\_i16x8\_s}', r'\hex{FD}~~187', r'[\V128~\V128] \to [\V128]', r'valid-simd-vextmul', r'exec-simd-vextmul'),
492493
Instruction(r'\I32X4.\EXTMUL\K{\_high\_i16x8\_s}', r'\hex{FD}~~189', r'[\V128~\V128] \to [\V128]', r'valid-simd-vextmul', r'exec-simd-vextmul'),
493494
Instruction(r'\I32X4.\EXTMUL\K{\_low\_i16x8\_u}', r'\hex{FD}~~190', r'[\V128~\V128] \to [\V128]', r'valid-simd-vextmul', r'exec-simd-vextmul'),

document/core/appendix/index-instructions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ Instruction Binary Opcode Type
436436
:math:`\I32X4.\VMIN\K{\_u}` :math:`\hex{FD}~~183` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-imin_u>`
437437
:math:`\I32X4.\VMAX\K{\_s}` :math:`\hex{FD}~~184` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-imax_s>`
438438
:math:`\I32X4.\VMAX\K{\_u}` :math:`\hex{FD}~~185` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-imax_u>`
439+
:math:`\I32X4.\DOT\K{\_i16x8\_s}` :math:`\hex{FD}~~186` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-simd-dot>` :ref:`execution <exec-simd-dot>`
439440
:math:`\I32X4.\EXTMUL\K{\_low\_i16x8\_s}` :math:`\hex{FD}~~187` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-simd-vextmul>` :ref:`execution <exec-simd-vextmul>`
440441
:math:`\I32X4.\EXTMUL\K{\_high\_i16x8\_s}` :math:`\hex{FD}~~189` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-simd-vextmul>` :ref:`execution <exec-simd-vextmul>`
441442
:math:`\I32X4.\EXTMUL\K{\_low\_i16x8\_u}` :math:`\hex{FD}~~190` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-simd-vextmul>` :ref:`execution <exec-simd-vextmul>`

document/core/binary/instructions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ All other SIMD instructions are plain opcodes without any immediates.
687687
\hex{FD}~~183{:}\Bu32 &\Rightarrow& \I32X4.\VMIN\K{\_u} \\ &&|&
688688
\hex{FD}~~184{:}\Bu32 &\Rightarrow& \I32X4.\VMAX\K{\_s} \\ &&|&
689689
\hex{FD}~~185{:}\Bu32 &\Rightarrow& \I32X4.\VMAX\K{\_u} \\ &&|&
690+
\hex{FD}~~186{:}\Bu32 &\Rightarrow& \I32X4.\DOT\K{\_i16x8\_s}\\ &&|&
690691
\hex{FD}~~187{:}\Bu32 &\Rightarrow& \I32X4.\EXTMUL\K{\_low\_i16x8\_s}\\ &&|&
691692
\hex{FD}~~189{:}\Bu32 &\Rightarrow& \I32X4.\EXTMUL\K{\_high\_i16x8\_s}\\ &&|&
692693
\hex{FD}~~190{:}\Bu32 &\Rightarrow& \I32X4.\EXTMUL\K{\_low\_i16x8\_u}\\ &&|&

document/core/exec/instructions.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,39 @@ SIMD instructions are defined in terms of generic numeric operators applied lane
725725
\end{array}
726726
727727
728+
.. _exec-simd-dot:
729+
730+
:math:`\K{i32x4.}\DOT\K{\_i16x8\_s}`
731+
....................................
732+
733+
1. Assert: due to :ref:`validation <valid-vitestop>`, two values of :ref:`value type <syntax-valtype>` |V128| is on the top of the stack.
734+
735+
2. Pop the value :math:`\V128.\VCONST~c_2` from the stack.
736+
737+
3. Pop the value :math:`\V128.\VCONST~c_1` from the stack.
738+
739+
4. Let :math:`(i_1~i_2)^\ast` be the result of computing :math:`\imul_{32}(\extend^s_{16,32}(\lanes_{\I16X8}(c_1)), \extend^s_{16,32}(\lanes_{\I16X8}(c_2)))`
740+
741+
5. Let :math:`j^\ast` be the result of computing :math:`\iadd_{32}(i_1, i_2)^\ast`.
742+
743+
6. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{\I32X4}(j^\ast)`.
744+
745+
8. Push the value :math:`\V128.\VCONST~c` onto the stack.
746+
747+
.. math::
748+
\begin{array}{l}
749+
\begin{array}{lcl@{\qquad}l}
750+
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\K{i32x4.}\DOT\K{\_i16x8\_s} &\stepto& (\V128\K{.}\VCONST~c) \\
751+
\end{array}
752+
\\ \qquad
753+
\begin{array}[t]{@{}r@{~}l@{}}
754+
(\iff & (i_1~i_2)^\ast = \imul_{32}(\extend^s_{16,32}(\lanes_{\I16X8}(c_1)), \extend^s_{16,32}(\lanes_{\I16X8}(c_2))) \\
755+
\wedge & j^\ast = \iadd_{32}(i_1, i_2)^\ast \\
756+
\wedge & c = \lanes^{-1}_{\I32X4}(j^\ast)
757+
\end{array}
758+
\end{array}
759+
760+
728761
.. _exec-simd-vextmul:
729762

730763
:math:`t_2\K{x}N\K{.}\EXTMUL\_\K{low}\_t_1\K{x}M\_\sx` and :math:`t_2\K{x}N\K{.}\EXTMUL\_\K{high}\_t_1\K{x}M\_\sx`

document/core/syntax/instructions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ SIMD instructions provide basic operations over :ref:`values <syntax-value>` of
237237
\K{i64x2.}\viunop \\&&|&
238238
\K{i8x16.}\VPOPCNT \\&&|&
239239
\K{i16x8.}\Q15MULRSAT\K{\_s} \\ &&|&
240+
\K{i32x4.}\DOT\K{\_i16x8\_s} \\ &&|&
240241
\fshape\K{.}\vfunop \\&&|&
241242
\ishape\K{.}\vitestop \\ &&|&
242243
\ishape\K{.}\BITMASK \\ &&|&

document/core/text/instructions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ SIMD const instructions have a mandatory :ref:`shape <syntax-simd-shape>` descri
720720
\text{i32x4.min\_u} &\Rightarrow& \I32X4.\VMIN\K{\_u}\\ &&|&
721721
\text{i32x4.max\_s} &\Rightarrow& \I32X4.\VMAX\K{\_s}\\ &&|&
722722
\text{i32x4.max\_u} &\Rightarrow& \I32X4.\VMAX\K{\_u}\\ &&|&
723+
\text{i32x4.dot\_i16x8\_s} &\Rightarrow& \I32X4.\DOT\K{\_i16x8\_s}\\ &&|&
723724
\text{i32x4.extmul\_low\_i16x8\_s} &\Rightarrow& \I32X4.\EXTMUL\K{\_low\_i16x8\_s}\\ &&|&
724725
\text{i32x4.extmul\_high\_i16x8\_s} &\Rightarrow& \I32X4.\EXTMUL\K{\_high\_i16x8\_s}\\ &&|&
725726
\text{i32x4.extmul\_low\_i16x8\_u} &\Rightarrow& \I32X4.\EXTMUL\K{\_low\_i16x8\_u}\\ &&|&

document/core/util/macros.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@
425425
.. |NARROW| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{narrow}}
426426
.. |VEXTEND| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{extend}}
427427
.. |AVGR| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{avgr}}
428+
.. |DOT| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{dot}}
428429
.. |EXTMUL| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{extmul}}
429430
.. |VTRUNC| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{trunc}}
430431
.. |VCONVERT| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{convert}}

document/core/valid/instructions.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,20 @@ We also define an auxiliary function to get number of packed numeric types in a
450450
}
451451
452452
453+
.. _valid-simd-dot:
454+
455+
:math:`\K{i32x4.}\DOT\K{\_i16x8\_s}`
456+
....................................
457+
458+
* The instruction is valid with type :math:`[\V128~\V128] \to [\V128]`.
459+
460+
.. math::
461+
\frac{
462+
}{
463+
C \vdashinstr \K{i32x4.}\DOT\K{\_i16x8\_s} : [\V128~\V128] \to [\V128]
464+
}
465+
466+
453467
.. _valid-simd-vextmul:
454468

455469
:math:`\ishape\K{.}\vextmul\K{\_}\ishape\K{\_}\sx`

0 commit comments

Comments
 (0)