Skip to content

Commit c9ee2f6

Browse files
committed
[spectext] Add {f32x4,f64x2}.{pmin,pmax}
We added these instructions to the syntax in WebAssembly#353, this adds them to the other sections, numerics, text, binary.
1 parent bf505da commit c9ee2f6

File tree

6 files changed

+56
-4
lines changed

6 files changed

+56
-4
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,8 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
511511
Instruction(r'\F32X4.\VDIV', r'\hex{FD}~~231', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fdiv'),
512512
Instruction(r'\F32X4.\VMIN', r'\hex{FD}~~232', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fmin'),
513513
Instruction(r'\F32X4.\VMAX', r'\hex{FD}~~233', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fmax'),
514+
Instruction(r'\F32X4.\VPMIN', r'\hex{FD}~~234', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fpmin'),
515+
Instruction(r'\F32X4.\VPMAX', r'\hex{FD}~~235', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fpmax'),
514516
Instruction(r'\F64X2.\VABS', r'\hex{FD}~~236', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-fabs'),
515517
Instruction(r'\F64X2.\VNEG', r'\hex{FD}~~237', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-fneg'),
516518
Instruction(r'\F64X2.\VSQRT', r'\hex{FD}~~239', r'[\V128] \to [\I32]', r'valid-vunop', r'exec-vunop', r'op-fsqrt'),
@@ -519,6 +521,8 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
519521
Instruction(r'\F64X2.\VMUL', r'\hex{FD}~~242', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fmul'),
520522
Instruction(r'\F64X2.\VDIV', r'\hex{FD}~~243', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fdiv'),
521523
Instruction(r'\F64X2.\VMIN', r'\hex{FD}~~244', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fmin'),
524+
Instruction(r'\F64X2.\VPMIN', r'\hex{FD}~~245', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fpmin'),
525+
Instruction(r'\F64X2.\VPMAX', r'\hex{FD}~~246', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fpmax'),
522526
Instruction(r'\F64X2.\VMAX', r'\hex{FD}~~245', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fmax'),
523527
Instruction(r'\I32X4.\TRUNC\K{\_sat\_f32x4\_s}', r'\hex{FD}~~248', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-trunc_sat_s'),
524528
Instruction(r'\I32X4.\TRUNC\K{\_sat\_f32x4\_u}', r'\hex{FD}~~249', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-trunc_sat_u'),

document/core/appendix/index-instructions.rst

+4
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ Instruction Binary Opcode Type
459459
:math:`\F32X4.\VDIV` :math:`\hex{FD}~~231` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fdiv>`
460460
:math:`\F32X4.\VMIN` :math:`\hex{FD}~~232` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fmin>`
461461
:math:`\F32X4.\VMAX` :math:`\hex{FD}~~233` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fmax>`
462+
:math:`\F32X4.\VPMIN` :math:`\hex{FD}~~234` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fpmin>`
463+
:math:`\F32X4.\VPMAX` :math:`\hex{FD}~~235` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fpmax>`
462464
:math:`\F64X2.\VABS` :math:`\hex{FD}~~236` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vunop>` :ref:`execution <exec-vunop>`, :ref:`operator <op-fabs>`
463465
:math:`\F64X2.\VNEG` :math:`\hex{FD}~~237` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vunop>` :ref:`execution <exec-vunop>`, :ref:`operator <op-fneg>`
464466
:math:`\F64X2.\VSQRT` :math:`\hex{FD}~~239` :math:`[\V128] \to [\I32]` :ref:`validation <valid-vunop>` :ref:`execution <exec-vunop>`, :ref:`operator <op-fsqrt>`
@@ -467,6 +469,8 @@ Instruction Binary Opcode Type
467469
:math:`\F64X2.\VMUL` :math:`\hex{FD}~~242` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fmul>`
468470
:math:`\F64X2.\VDIV` :math:`\hex{FD}~~243` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fdiv>`
469471
:math:`\F64X2.\VMIN` :math:`\hex{FD}~~244` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fmin>`
472+
:math:`\F64X2.\VPMIN` :math:`\hex{FD}~~245` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fpmin>`
473+
:math:`\F64X2.\VPMAX` :math:`\hex{FD}~~246` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fpmax>`
470474
:math:`\F64X2.\VMAX` :math:`\hex{FD}~~245` :math:`[\V128~\V128] \to [\V128]` :ref:`validation <valid-vbinop>` :ref:`execution <exec-vbinop>`, :ref:`operator <op-fmax>`
471475
:math:`\I32X4.\TRUNC\K{\_sat\_f32x4\_s}` :math:`\hex{FD}~~248` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vunop>` :ref:`execution <exec-vunop>`, :ref:`operator <op-trunc_sat_s>`
472476
:math:`\I32X4.\TRUNC\K{\_sat\_f32x4\_u}` :math:`\hex{FD}~~249` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vunop>` :ref:`execution <exec-vunop>`, :ref:`operator <op-trunc_sat_u>`

document/core/binary/instructions.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,9 @@ All other SIMD instructions are plain opcodes without any immediates.
721721
\hex{FD}~~230{:}\Bu32 &\Rightarrow& \F32X4.\VMUL \\ &&|&
722722
\hex{FD}~~231{:}\Bu32 &\Rightarrow& \F32X4.\VDIV \\ &&|&
723723
\hex{FD}~~232{:}\Bu32 &\Rightarrow& \F32X4.\VMIN \\ &&|&
724-
\hex{FD}~~233{:}\Bu32 &\Rightarrow& \F32X4.\VMAX \\
724+
\hex{FD}~~233{:}\Bu32 &\Rightarrow& \F32X4.\VMAX \\ &&|&
725+
\hex{FD}~~234{:}\Bu32 &\Rightarrow& \F32X4.\VPMIN \\ &&|&
726+
\hex{FD}~~235{:}\Bu32 &\Rightarrow& \F32X4.\VPMAX \\
725727
\end{array}
726728
727729
.. math::
@@ -735,7 +737,9 @@ All other SIMD instructions are plain opcodes without any immediates.
735737
\hex{FD}~~242{:}\Bu32 &\Rightarrow& \F64X2.\VMUL \\ &&|&
736738
\hex{FD}~~243{:}\Bu32 &\Rightarrow& \F64X2.\VDIV \\ &&|&
737739
\hex{FD}~~244{:}\Bu32 &\Rightarrow& \F64X2.\VMIN \\ &&|&
738-
\hex{FD}~~245{:}\Bu32 &\Rightarrow& \F64X2.\VMAX \\
740+
\hex{FD}~~245{:}\Bu32 &\Rightarrow& \F64X2.\VMAX \\ &&|&
741+
\hex{FD}~~245{:}\Bu32 &\Rightarrow& \F64X2.\VPMIN \\ &&|&
742+
\hex{FD}~~246{:}\Bu32 &\Rightarrow& \F64X2.\VPMAX \\
739743
\end{array}
740744
741745
.. math::

document/core/exec/numerics.rst

+32
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,38 @@ This non-deterministic result is expressed by the following auxiliary function p
16751675
\end{array}
16761676
16771677
1678+
.. _op-fpmin:
1679+
1680+
:math:`\fpmin_N(z_1, z_2)`
1681+
..........................
1682+
1683+
* If :math:`z_2` is less than :math:`z_1` then return :math:`z_2`.
1684+
1685+
* Else return :math:`z_1`.
1686+
1687+
.. math::
1688+
\begin{array}{@{}lcll}
1689+
\fpmin_N(z_1, z_2) &=& z_2 & (\iff \flt_N(z_2, z_1) = 1) \\
1690+
\fpmin_N(z_1, z_2) &=& z_1 & (\otherwise)
1691+
\end{array}
1692+
1693+
1694+
.. _op-fpmax:
1695+
1696+
:math:`\fpmax_N(z_1, z_2)`
1697+
..........................
1698+
1699+
* If :math:`z_1` is less than :math:`z_2` then return :math:`z_2`.
1700+
1701+
* Else return :math:`z_1`.
1702+
1703+
.. math::
1704+
\begin{array}{@{}lcll}
1705+
\fpmax_N(z_1, z_2) &=& z_2 & (\iff \flt_N(z_1, z_2) = 1) \\
1706+
\fpmax_N(z_1, z_2) &=& z_1 & (\otherwise)
1707+
\end{array}
1708+
1709+
16781710
.. _convert-ops:
16791711

16801712
Conversions

document/core/text/instructions.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ SIMD const instructions have a mandatory :ref:`shape <syntax-simd-shape>` descri
755755
\text{f32x4.mul} &\Rightarrow& \F32X4.\VMUL\\ &&|&
756756
\text{f32x4.div} &\Rightarrow& \F32X4.\VDIV\\ &&|&
757757
\text{f32x4.min} &\Rightarrow& \F32X4.\VMIN\\ &&|&
758-
\text{f32x4.max} &\Rightarrow& \F32X4.\VMAX\\
758+
\text{f32x4.max} &\Rightarrow& \F32X4.\VMAX\\ &&|&
759+
\text{f32x4.pmin} &\Rightarrow& \F32X4.\VPMIN\\ &&|&
760+
\text{f32x4.pmax} &\Rightarrow& \F32X4.\VPMAX\\
759761
\end{array}
760762
761763
.. math::
@@ -769,7 +771,9 @@ SIMD const instructions have a mandatory :ref:`shape <syntax-simd-shape>` descri
769771
\text{f64x2.mul} &\Rightarrow& \F64X2.\VMUL\\ &&|&
770772
\text{f64x2.div} &\Rightarrow& \F64X2.\VDIV\\ &&|&
771773
\text{f64x2.min} &\Rightarrow& \F64X2.\VMIN\\ &&|&
772-
\text{f64x2.max} &\Rightarrow& \F64X2.\VMAX\\
774+
\text{f64x2.max} &\Rightarrow& \F64X2.\VMAX\\ &&|&
775+
\text{f64x2.pmin} &\Rightarrow& \F64X2.\VPMIN\\ &&|&
776+
\text{f64x2.pmax} &\Rightarrow& \F64X2.\VPMAX\\
773777
\end{array}
774778
775779
.. math::

document/core/util/macros.def

+4
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@
420420
.. |VDIV| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{div}}
421421
.. |VMIN| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{min}}
422422
.. |VMAX| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{max}}
423+
.. |VPMIN| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{pmin}}
424+
.. |VPMAX| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{pmax}}
423425
.. |NARROW| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{narrow}}
424426
.. |WIDEN| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{widen}}
425427
.. |AVGR| mathdef:: \xref{syntax/instructions}{syntax-instr-simd}{\K{avgr}}
@@ -1056,6 +1058,8 @@
10561058
.. |fgt| mathdef:: \xref{exec/numerics}{op-fgt}{\F{fgt}}
10571059
.. |fle| mathdef:: \xref{exec/numerics}{op-fle}{\F{fle}}
10581060
.. |fge| mathdef:: \xref{exec/numerics}{op-fge}{\F{fge}}
1061+
.. |fpmin| mathdef:: \xref{exec/numerics}{op-fpmin}{\F{fpmin}}
1062+
.. |fpmax| mathdef:: \xref{exec/numerics}{op-fpmax}{\F{fpmax}}
10591063

10601064
.. |extend| mathdef:: \xref{exec/numerics}{op-extend_u}{\F{extend}}
10611065
.. |extendu| mathdef:: \xref{exec/numerics}{op-extend_u}{\F{extend}^{\K{u}}}

0 commit comments

Comments
 (0)