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

Commit 34a5da5

Browse files
authored
Create Blaneidx production, and encode lane index as u8 (#346)
1 parent da4f63b commit 34a5da5

3 files changed

Lines changed: 25 additions & 19 deletions

File tree

document/core/binary/instructions.rst

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ SIMD Instructions
411411
~~~~~~~~~~~~~~~~~~~~
412412

413413
All variants of :ref:`SIMD instructions <syntax-instr-simd>` are represented by separate byte codes.
414-
The all have a one byte prefix, whereas the actual opcode is encoded by a variable-length :ref:`unsigned integer <binary-uint>`.
414+
They all have a one byte prefix, whereas the actual opcode is encoded by a variable-length :ref:`unsigned integer <binary-uint>`.
415415

416416
SIMD loads and stores are followed by the encoding of their |memarg| immediate.
417417

@@ -442,34 +442,37 @@ The |VCONST| instruction is followed by 16 immediate bytes, which are converted
442442
\end{array}
443443
444444
.. _binary-vternop:
445+
.. _binary-laneidx:
445446

446-
The |SHUFFLE| instruction is also followed by 16 immediate bytes:
447+
The |SHUFFLE| instruction is also followed by the encoding of 16 |laneidx| immediates.
447448

448449
.. math::
449450
\begin{array}{llclll}
451+
\production{lane index} & \Blaneidx &::=&
452+
l{:}\Bu8 &\Rightarrow& l \\
450453
\production{instruction} & \Binstr &::=& \dots \\&&|&
451-
\hex{FD}~~13{:}\Bu32~~(b{:}\Bbyte)^{16} &\Rightarrow& \I8X16.\SHUFFLE~b^{16} \\
454+
\hex{FD}~~13{:}\Bu32~~(l{:}\Blaneidx)^{16} &\Rightarrow& \I8X16.\SHUFFLE~l^{16} \\
452455
\end{array}
453456
454-
|EXTRACTLANE| and |REPLACELANE| instructions are followed by 1 immediate byte.
457+
|EXTRACTLANE| and |REPLACELANE| instructions are followed by the encoding of a |laneidx| immediate.
455458

456459
.. math::
457460
\begin{array}{llclll}
458461
\production{instruction} & \Binstr &::=& \dots \\&&|&
459-
\hex{FD}~~21{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I8X16.\EXTRACTLANE\K{\_s}~b \\ &&|&
460-
\hex{FD}~~22{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I8X16.\EXTRACTLANE\K{\_u}~b \\ &&|&
461-
\hex{FD}~~23{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I8X16.\REPLACELANE~b \\ &&|&
462-
\hex{FD}~~24{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I16X8.\EXTRACTLANE\K{\_s}~b \\ &&|&
463-
\hex{FD}~~25{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I16X8.\EXTRACTLANE\K{\_u}~b \\ &&|&
464-
\hex{FD}~~26{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I16X8.\REPLACELANE~b \\ &&|&
465-
\hex{FD}~~27{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I32X4.\EXTRACTLANE~b \\ &&|&
466-
\hex{FD}~~28{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I32X4.\REPLACELANE~b \\ &&|&
467-
\hex{FD}~~29{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I64X2.\EXTRACTLANE~b \\ &&|&
468-
\hex{FD}~~30{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \I64X2.\REPLACELANE~b \\ &&|&
469-
\hex{FD}~~31{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \F32X4.\EXTRACTLANE~b \\ &&|&
470-
\hex{FD}~~32{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \F32X4.\REPLACELANE~b \\ &&|&
471-
\hex{FD}~~33{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \F64X2.\EXTRACTLANE~b \\ &&|&
472-
\hex{FD}~~34{:}\Bu32~~b{:}\Bbyte &\Rightarrow& \F64X2.\REPLACELANE~b \\
462+
\hex{FD}~~21{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I8X16.\EXTRACTLANE\K{\_s}~l \\ &&|&
463+
\hex{FD}~~22{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I8X16.\EXTRACTLANE\K{\_u}~l \\ &&|&
464+
\hex{FD}~~23{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I8X16.\REPLACELANE~l \\ &&|&
465+
\hex{FD}~~24{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I16X8.\EXTRACTLANE\K{\_s}~l \\ &&|&
466+
\hex{FD}~~25{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I16X8.\EXTRACTLANE\K{\_u}~l \\ &&|&
467+
\hex{FD}~~26{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I16X8.\REPLACELANE~l \\ &&|&
468+
\hex{FD}~~27{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I32X4.\EXTRACTLANE~l \\ &&|&
469+
\hex{FD}~~28{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I32X4.\REPLACELANE~l \\ &&|&
470+
\hex{FD}~~29{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I64X2.\EXTRACTLANE~l \\ &&|&
471+
\hex{FD}~~30{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \I64X2.\REPLACELANE~l \\ &&|&
472+
\hex{FD}~~31{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \F32X4.\EXTRACTLANE~l \\ &&|&
473+
\hex{FD}~~32{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \F32X4.\REPLACELANE~l \\ &&|&
474+
\hex{FD}~~33{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \F64X2.\EXTRACTLANE~l \\ &&|&
475+
\hex{FD}~~34{:}\Bu32~~l{:}\Blaneidx &\Rightarrow& \F64X2.\REPLACELANE~l \\
473476
\end{array}
474477
475478
All other SIMD instructions are plain opcodes without any immediates.

document/core/syntax/instructions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ SIMD instructions provide basic operations over :ref:`values <syntax-value>` of
202202
\K{f32x4} ~|~ \K{f64x2} \\
203203
\production{vshape} & \X{vxx} &::=&
204204
\X{ixx} ~|~ \X{fxx} \\
205-
\production{lane index} & \laneidx &::=& \byte \\
205+
\production{lane index} & \laneidx &::=& \u8 \\
206206
\production{instruction} & \instr &::=&
207207
\dots \\&&|&
208208
\K{v128.}\CONST~\xref{syntax/values}{syntax-simd}{\vX{\X{nnn}}} \\&&|&

document/core/util/macros.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@
584584
.. |Binstr| mathdef:: \xref{binary/instructions}{binary-instr}{\B{instr}}
585585
.. |Bexpr| mathdef:: \xref{binary/instructions}{binary-expr}{\B{expr}}
586586

587+
.. SIMD
588+
589+
.. |Blaneidx| mathdef:: \xref{binary/instructions}{binary-laneidx}{\B{laneidx}}
587590

588591

589592
.. Text Format

0 commit comments

Comments
 (0)