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

Commit a2091ba

Browse files
committed
[spectext] Add ext mul instructions
1 parent 7a8190f commit a2091ba

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

document/core/exec/instructions.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,57 @@ SIMD instructions are defined in terms of generic numeric operators applied lane
725725
\end{array}
726726
727727
728+
.. _exec-simd-extmul:
729+
730+
: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`
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. If :math:`\K{low}` is part of the instruction, then:
740+
741+
a. Let :math:`i^\ast` be the sequence :math:`\lanes_{t_1\K{x}M}(c_1)[0 \slice N]`.
742+
743+
b. Let :math:`j^\ast` be the sequence :math:`\lanes_{t_1\K{x}M}(c_2)[0 \slice N]`.
744+
745+
5. Else:
746+
747+
a. Let :math:`i^\ast` be the sequence :math:`\lanes_{t_1\K{x}M}(c_1)[N \slice N]`.
748+
749+
b. Let :math:`j^\ast` be the sequence :math:`\lanes_{t_1\K{x}M}(c_2)[N \slice N]`.
750+
751+
6. Let :math:`c` be the result of computing :math:`\lanes^{-1}_{t_2\K{x}N}(\imul_{t_2\K{x}N}(\extend^{\sx}_{M,N}(i^\ast), \extend^{\sx}_{M,N}(j^\ast)))`
752+
753+
8. Push the value :math:`\V128.\VCONST~c` onto the stack.
754+
755+
.. math::
756+
\begin{array}{l}
757+
\begin{array}{lcl@{\qquad}l}
758+
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~t_2\K{x}N\K{.}\EXTMUL\_\K{low}\_t_1\K{x}M\_\sx &\stepto& (\V128\K{.}\VCONST~c) \\
759+
\end{array}
760+
\\ \qquad
761+
\begin{array}[t]{@{}r@{~}l@{}}
762+
(\iff & i^\ast = \lanes_{t_1\K{x}M}(c_1)[0 \slice N] \\
763+
\wedge & j^\ast = \lanes_{t_1\K{x}M}(c_2)[0 \slice N] \\
764+
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(\imul_{t_2\K{x}N}(\extend^{\sx}_{M,N}(i^\ast), \extend^{\sx}_{M,N}(j^\ast)))
765+
\end{array}
766+
\\[1ex]
767+
\begin{array}{lcl@{\qquad}l}
768+
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~t_2\K{x}N\K{.}\EXTMUL\_\K{high}\_t_1\K{x}M\_\sx &\stepto& (\V128\K{.}\VCONST~c) \\
769+
\end{array}
770+
\\ \qquad
771+
\begin{array}[t]{@{}r@{~}l@{}}
772+
(\iff & i^\ast = \lanes_{t_1\K{x}M}(c_1)[N \slice N] \\
773+
\wedge & j^\ast = \lanes_{t_1\K{x}M}(c_2)[N \slice N] \\
774+
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(\imul_{t_2\K{x}N}(\extend^{\sx}_{M,N}(i^\ast), \extend^{\sx}_{M,N}(j^\ast)))
775+
\end{array}
776+
\end{array}
777+
778+
728779
.. index:: parametric instructions, value
729780
pair: execution; instruction
730781
single: abstract syntax; instruction

document/core/syntax/instructions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ SIMD instructions provide basic operations over :ref:`values <syntax-value>` of
256256
\K{i64x2.}\K{mul} \\&&|&
257257
\K{i8x16.}\AVGR\K{\_u} ~|~
258258
\K{i16x8.}\AVGR\K{\_u} \\&&|&
259+
\K{i16x8.}\EXTMUL\K{\_low}\K{\_i8x16\_}\sx ~|~
260+
\K{i16x8.}\EXTMUL\K{\_high}\K{\_i8x16\_}\sx \\&&|&
261+
\K{i32x4.}\EXTMUL\K{\_low}\K{\_i16x8\_}\sx ~|~
262+
\K{i32x4.}\EXTMUL\K{\_high}\K{\_i16x8\_}\sx \\&&|&
263+
\K{i64x2.}\EXTMUL\K{\_low}\K{\_i32x4\_}\sx ~|~
264+
\K{i64x2.}\EXTMUL\K{\_high}\K{\_i32x4\_}\sx \\&&|&
259265
\fshape\K{.}\vfbinop \\&&|&
260266
\K{i32x4.}\VTRUNC\K{\_sat\_f32x4\_}\sx \\ &&|&
261267
\K{f32x4.}\VCONVERT\K{\_i32x4\_}\sx \\&&|&
@@ -362,6 +368,7 @@ For the other SIMD instructions, the use of two's complement for the signed inte
362368
.. _syntax-vunop:
363369
.. _syntax-vbinop:
364370
.. _syntax-vwiden:
371+
.. _syntax-vextmul:
365372

366373
Conventions
367374
...........
@@ -387,6 +394,9 @@ Occasionally, it is convenient to group operators together according to the foll
387394
\production{widen operator} & \vwiden &::=&
388395
\WIDEN\K{\_low\_}\shape\K{\_}\sx ~|~
389396
\WIDEN\K{\_high\_}\shape\K{\_}\sx \\
397+
\production{extmul operator} & \vextmul &::=&
398+
\EXTMUL\K{\_low\_}\ishape\K{\_}\sx ~|~
399+
\EXTMUL\K{\_high\_}\ishape\K{\_}\sx \\
390400
\end{array}
391401
392402

document/core/util/macros.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@
422422
.. |NARROW| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{narrow}}
423423
.. |WIDEN| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{widen}}
424424
.. |AVGR| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{avgr}}
425+
.. |EXTMUL| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{extmul}}
425426
.. |VTRUNC| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{trunc}}
426427
.. |VCONVERT| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{convert}}
427428

@@ -453,6 +454,7 @@
453454
.. |vternop| mathdef:: \xref{syntax/instructions}{syntax-vternop}{\X{vternop}}
454455
.. |vwiden| mathdef:: \xref{syntax/instructions}{syntax-vwiden}{\X{vwiden}}
455456
.. |vcvtop| mathdef:: \xref{syntax/instructions}{syntax-vcvtop}{\X{vcvtop}}
457+
.. |vextmul| mathdef:: \xref{syntax/instructions}{syntax-vextmul}{\X{vextmul}}
456458

457459
.. |laneidx| mathdef:: \xref{syntax/instructions}{syntax-laneidx}{\X{laneidx}}
458460
.. |vsunop| mathdef:: \xref{syntax/instructions}{syntax-vsunop}{\X{vsunop}}

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-vextmul:
454+
455+
:math:`\ishape\K{.}\vextmul\K{\_}\ishape\K{\_}\sx`
456+
..................................................
457+
458+
* The instruction is valid with type :math:`[\V128~\V128] \to [\V128]`.
459+
460+
.. math::
461+
\frac{
462+
}{
463+
C \vdashinstr \ishape\K{.}\EXTMUL\K{\_}\ishape\K{\_}\sx : [\V128~\V128] \to [\V128]
464+
}
465+
466+
453467
.. index:: parametric instructions, value type, polymorphism
454468
pair: validation; instruction
455469
single: abstract syntax; instruction

0 commit comments

Comments
 (0)