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

Commit 80c0603

Browse files
committed
Merge from upstream spec
2 parents b9fbe20 + f528da2 commit 80c0603

40 files changed

+692
-363
lines changed

.github/workflows/main.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
jobs:
13+
ref-interpreter:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Setup OCaml
18+
uses: ocaml/setup-ocaml@v2
19+
with:
20+
ocaml-compiler: 4.12.x
21+
- run: opam install --yes ocamlbuild.0.14.0
22+
- run: cd interpreter && opam exec make all
23+
24+
build-js-api-spec:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- run: pip install bikeshed && bikeshed update
29+
- run: bikeshed spec "document/js-api/index.bs" "document/js-api/index.html"
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: js-api-rendered
33+
path: document/js-api/index.html
34+
35+
build-web-api-spec:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v2
39+
- run: pip install bikeshed && bikeshed update
40+
- run: bikeshed spec "document/web-api/index.bs" "document/web-api/index.html"
41+
- uses: actions/upload-artifact@v2
42+
with:
43+
name: web-api-rendered
44+
path: document/web-api/index.html
45+
46+
build-core-spec:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
with:
51+
submodules: "recursive"
52+
- run: pip install bikeshed && bikeshed update
53+
- run: pip install six
54+
- run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
55+
- run: pip install sphinx==3.5.2
56+
- run: cd document/core && make all
57+
- uses: actions/upload-artifact@v2
58+
with:
59+
name: core-api-rendered
60+
path: document/core/_build/html
61+
62+
publish-spec:
63+
runs-on: ubuntu-latest
64+
needs: [build-core-spec, build-js-api-spec, build-web-api-spec]
65+
steps:
66+
- uses: actions/checkout@v2
67+
- run: mkdir _output && cp document/index.html _output/index.html
68+
- uses: actions/download-artifact@v2
69+
with:
70+
name: js-api-rendered
71+
path: _output/js-api
72+
- uses: actions/download-artifact@v2
73+
with:
74+
name: web-api-rendered
75+
path: _output/web-api
76+
- uses: actions/download-artifact@v2
77+
with:
78+
name: core-api-rendered
79+
path: _output/core
80+
- name: Publish HTML to GitHub Pages
81+
if: github.ref == 'refs/heads/master'
82+
uses: peaceiris/actions-gh-pages@v3
83+
with:
84+
publish_dir: ./_output
85+
github_token: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

-38
This file was deleted.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![Build Status](https://github.com/WebAssembly/simd/actions/workflows/main.yml/badge.svg)
2+
13
# SIMD proposal for WebAssembly
24

35
This repository holds a proposal for adding 128-bit SIMD support to

deploy_key.enc

-3.28 KB
Binary file not shown.

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
6565
Instruction(r'\NOP', r'\hex{01}', r'[] \to []', r'valid-nop', r'exec-nop'),
6666
Instruction(r'\BLOCK~\X{bt}', r'\hex{02}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-block', r'exec-block'),
6767
Instruction(r'\LOOP~\X{bt}', r'\hex{03}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-loop', r'exec-loop'),
68-
Instruction(r'\IF~\X{bt}', r'\hex{04}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-if', r'exec-if'),
68+
Instruction(r'\IF~\X{bt}', r'\hex{04}', r'[t_1^\ast~\I32] \to [t_2^\ast]', r'valid-if', r'exec-if'),
6969
Instruction(r'\ELSE', r'\hex{05}'),
7070
Instruction(None, r'\hex{06}'),
7171
Instruction(None, r'\hex{07}'),
@@ -328,8 +328,8 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
328328
Instruction(r'\TABLEINIT~x~y', r'\hex{FC}~\hex{0C}', r'[\I32~\I32~\I32] \to []', r'valid-table.init', r'exec-table.init'),
329329
Instruction(r'\ELEMDROP~x', r'\hex{FC}~\hex{0D}', r'[] \to []', r'valid-elem.drop', r'exec-elem.drop'),
330330
Instruction(r'\TABLECOPY~x~y', r'\hex{FC}~\hex{0E}', r'[\I32~\I32~\I32] \to []', r'valid-table.copy', r'exec-table.copy'),
331-
Instruction(r'\TABLEGROW~x', r'\hex{FC}~\hex{0F}', r'[t~\I32] \to []', r'valid-table.grow', r'exec-table.grow'),
332-
Instruction(r'\TABLESIZE~x', r'\hex{FC}~\hex{10}', r'[] \to []', r'valid-table.size', r'exec-table.size'),
331+
Instruction(r'\TABLEGROW~x', r'\hex{FC}~\hex{0F}', r'[t~\I32] \to [\I32]', r'valid-table.grow', r'exec-table.grow'),
332+
Instruction(r'\TABLESIZE~x', r'\hex{FC}~\hex{10}', r'[] \to [\I32]', r'valid-table.size', r'exec-table.size'),
333333
Instruction(r'\TABLEFILL~x', r'\hex{FC}~\hex{11}', r'[\I32~t~\I32] \to []', r'valid-table.fill', r'exec-table.fill'),
334334
Instruction(r'\I32.\TRUNC\K{\_sat\_}\F32\K{\_s}', r'\hex{FC}~~0', r'[\F32] \to [\I32]', r'valid-cvtop', r'exec-cvtop', r'op-trunc_sat_s'),
335335
Instruction(r'\I32.\TRUNC\K{\_sat\_}\F32\K{\_u}', r'\hex{FC}~~1', r'[\F32] \to [\I32]', r'valid-cvtop', r'exec-cvtop', r'op-trunc_sat_u'),

document/core/appendix/index-instructions.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Instruction Binary Opcode T
1313
:math:`\NOP` :math:`\hex{01}` :math:`[] \to []` :ref:`validation <valid-nop>` :ref:`execution <exec-nop>`
1414
:math:`\BLOCK~\X{bt}` :math:`\hex{02}` :math:`[t_1^\ast] \to [t_2^\ast]` :ref:`validation <valid-block>` :ref:`execution <exec-block>`
1515
:math:`\LOOP~\X{bt}` :math:`\hex{03}` :math:`[t_1^\ast] \to [t_2^\ast]` :ref:`validation <valid-loop>` :ref:`execution <exec-loop>`
16-
:math:`\IF~\X{bt}` :math:`\hex{04}` :math:`[t_1^\ast] \to [t_2^\ast]` :ref:`validation <valid-if>` :ref:`execution <exec-if>`
16+
:math:`\IF~\X{bt}` :math:`\hex{04}` :math:`[t_1^\ast~\I32] \to [t_2^\ast]` :ref:`validation <valid-if>` :ref:`execution <exec-if>`
1717
:math:`\ELSE` :math:`\hex{05}`
1818
(reserved) :math:`\hex{06}`
1919
(reserved) :math:`\hex{07}`
@@ -276,8 +276,8 @@ Instruction Binary Opcode T
276276
:math:`\TABLEINIT~x~y` :math:`\hex{FC}~\hex{0C}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation <valid-table.init>` :ref:`execution <exec-table.init>`
277277
:math:`\ELEMDROP~x` :math:`\hex{FC}~\hex{0D}` :math:`[] \to []` :ref:`validation <valid-elem.drop>` :ref:`execution <exec-elem.drop>`
278278
:math:`\TABLECOPY~x~y` :math:`\hex{FC}~\hex{0E}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation <valid-table.copy>` :ref:`execution <exec-table.copy>`
279-
:math:`\TABLEGROW~x` :math:`\hex{FC}~\hex{0F}` :math:`[t~\I32] \to []` :ref:`validation <valid-table.grow>` :ref:`execution <exec-table.grow>`
280-
:math:`\TABLESIZE~x` :math:`\hex{FC}~\hex{10}` :math:`[] \to []` :ref:`validation <valid-table.size>` :ref:`execution <exec-table.size>`
279+
:math:`\TABLEGROW~x` :math:`\hex{FC}~\hex{0F}` :math:`[t~\I32] \to [\I32]` :ref:`validation <valid-table.grow>` :ref:`execution <exec-table.grow>`
280+
:math:`\TABLESIZE~x` :math:`\hex{FC}~\hex{10}` :math:`[] \to [\I32]` :ref:`validation <valid-table.size>` :ref:`execution <exec-table.size>`
281281
:math:`\TABLEFILL~x` :math:`\hex{FC}~\hex{11}` :math:`[\I32~t~\I32] \to []` :ref:`validation <valid-table.fill>` :ref:`execution <exec-table.fill>`
282282
:math:`\I32.\TRUNC\K{\_sat\_}\F32\K{\_s}` :math:`\hex{FC}~~0` :math:`[\F32] \to [\I32]` :ref:`validation <valid-cvtop>` :ref:`execution <exec-cvtop>`, :ref:`operator <op-trunc_sat_s>`
283283
:math:`\I32.\TRUNC\K{\_sat\_}\F32\K{\_u}` :math:`\hex{FC}~~1` :math:`[\F32] \to [\I32]` :ref:`validation <valid-cvtop>` :ref:`execution <exec-cvtop>`, :ref:`operator <op-trunc_sat_u>`

document/core/binary/instructions.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ Reference Instructions
8282
:ref:`Reference instructions <syntax-instr-ref>` are represented by single byte codes.
8383

8484
.. _binary-ref.null:
85-
.. _binary-ref.isnull:
85+
.. _binary-ref.func:
86+
.. _binary-ref.is_null:
8687

8788
.. math::
8889
\begin{array}{llclll}

document/core/binary/types.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Types
66
-----
77

88
.. note::
9-
In future versions of WebAssembly, value types may include types denoted by :ref:`type indices <syntax-typeidx>`.
10-
Thus, the binary format for types corresponds to the encodings of small negative :math:`\xref{binary/values}{binary-sint}{\sN}` values, so that they can coexist with (positive) type indices in the future.
9+
In some places, possible types include both type constructors or types denoted by :ref:`type indices <syntax-typeidx>`.
10+
Thus, the binary format for type constructors corresponds to the encodings of small negative :math:`\xref{binary/values}{binary-sint}{\sN}` values, such that they can unambiguously occur in the same place as (positive) type indices.
1111

1212

1313
.. index:: number type

document/core/exec/instructions.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ Memory Instructions
16771677

16781678
9. If :math:`N` is not part of the instruction, then:
16791679

1680-
a. Let :math:`N` be the :ref:`bit width <syntax-valtype>` :math:`|t|` of :ref:`value type <syntax-valtype>` :math:`t`.
1680+
a. Let :math:`N` be the :ref:`bit width <syntax-numtype>` :math:`|t|` of :ref:`number type <syntax-numtype>` :math:`t`.
16811681

16821682
10. If :math:`\X{ea} + N/8` is larger than the length of :math:`\X{mem}.\MIDATA`, then:
16831683

@@ -1992,7 +1992,7 @@ Memory Instructions
19921992

19931993
11. If :math:`N` is not part of the instruction, then:
19941994

1995-
a. Let :math:`N` be the :ref:`bit width <syntax-valtype>` :math:`|t|` of :ref:`value type <syntax-valtype>` :math:`t`.
1995+
a. Let :math:`N` be the :ref:`bit width <syntax-numtype>` :math:`|t|` of :ref:`number type <syntax-numtype>` :math:`t`.
19961996

19971997
12. If :math:`\X{ea} + N/8` is larger than the length of :math:`\X{mem}.\MIDATA`, then:
19981998

@@ -2403,15 +2403,15 @@ Memory Instructions
24032403

24042404
10. Assert: due to :ref:`validation <valid-memory.init>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.
24052405

2406-
11. Pop the value :math:`\I32.\CONST~cnt` from the stack.
2406+
11. Pop the value :math:`\I32.\CONST~n` from the stack.
24072407

24082408
12. Assert: due to :ref:`validation <valid-memory.init>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.
24092409

2410-
13. Pop the value :math:`\I32.\CONST~src` from the stack.
2410+
13. Pop the value :math:`\I32.\CONST~s` from the stack.
24112411

24122412
14. Assert: due to :ref:`validation <valid-memory.init>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.
24132413

2414-
15. Pop the value :math:`\I32.\CONST~dst` from the stack.
2414+
15. Pop the value :math:`\I32.\CONST~d` from the stack.
24152415

24162416
16. If :math:`s + n` is larger than the length of :math:`\X{data}.\DIDATA` or :math:`d + n` is larger than the length of :math:`\X{mem}.\MIDATA`, then:
24172417

document/core/exec/modules.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -468,17 +468,17 @@ and list of :ref:`reference <syntax-ref>` vectors for the module's :ref:`element
468468

469469
a. Let :math:`\dataaddr_i` be the :ref:`data address <syntax-dataaddr>` resulting from :ref:`allocating <alloc-data>` a :ref:`data instance <syntax-datainst>` with contents :math:`\data_i.\DINIT`.
470470

471-
8. Let :math:`\funcaddr^\ast` be the the concatenation of the :ref:`function addresses <syntax-funcaddr>` :math:`\funcaddr_i` in index order.
471+
8. Let :math:`\funcaddr^\ast` be the concatenation of the :ref:`function addresses <syntax-funcaddr>` :math:`\funcaddr_i` in index order.
472472

473-
9. Let :math:`\tableaddr^\ast` be the the concatenation of the :ref:`table addresses <syntax-tableaddr>` :math:`\tableaddr_i` in index order.
473+
9. Let :math:`\tableaddr^\ast` be the concatenation of the :ref:`table addresses <syntax-tableaddr>` :math:`\tableaddr_i` in index order.
474474

475-
10. Let :math:`\memaddr^\ast` be the the concatenation of the :ref:`memory addresses <syntax-memaddr>` :math:`\memaddr_i` in index order.
475+
10. Let :math:`\memaddr^\ast` be the concatenation of the :ref:`memory addresses <syntax-memaddr>` :math:`\memaddr_i` in index order.
476476

477-
11. Let :math:`\globaladdr^\ast` be the the concatenation of the :ref:`global addresses <syntax-globaladdr>` :math:`\globaladdr_i` in index order.
477+
11. Let :math:`\globaladdr^\ast` be the concatenation of the :ref:`global addresses <syntax-globaladdr>` :math:`\globaladdr_i` in index order.
478478

479-
12. Let :math:`\elemaddr^\ast` be the the concatenation of the :ref:`element addresses <syntax-elemaddr>` :math:`\elemaddr_i` in index order.
479+
12. Let :math:`\elemaddr^\ast` be the concatenation of the :ref:`element addresses <syntax-elemaddr>` :math:`\elemaddr_i` in index order.
480480

481-
13. Let :math:`\dataaddr^\ast` be the the concatenation of the :ref:`data addresses <syntax-dataaddr>` :math:`\dataaddr_i` in index order.
481+
13. Let :math:`\dataaddr^\ast` be the concatenation of the :ref:`data addresses <syntax-dataaddr>` :math:`\dataaddr_i` in index order.
482482

483483
14. Let :math:`\funcaddr_{\F{mod}}^\ast` be the list of :ref:`function addresses <syntax-funcaddr>` extracted from :math:`\externval_{\F{im}}^\ast`, concatenated with :math:`\funcaddr^\ast`.
484484

@@ -500,7 +500,7 @@ and list of :ref:`reference <syntax-ref>` vectors for the module's :ref:`element
500500

501501
e. Let :math:`\exportinst_i` be the :ref:`export instance <syntax-exportinst>` :math:`\{\EINAME~(\export_i.\ENAME), \EIVALUE~\externval_i\}`.
502502

503-
19. Let :math:`\exportinst^\ast` be the the concatenation of the :ref:`export instances <syntax-exportinst>` :math:`\exportinst_i` in index order.
503+
19. Let :math:`\exportinst^\ast` be the concatenation of the :ref:`export instances <syntax-exportinst>` :math:`\exportinst_i` in index order.
504504

505505
20. Let :math:`\moduleinst` be the :ref:`module instance <syntax-moduleinst>` :math:`\{\MITYPES~(\module.\MTYPES),` :math:`\MIFUNCS~\funcaddr_{\F{mod}}^\ast,` :math:`\MITABLES~\tableaddr_{\F{mod}}^\ast,` :math:`\MIMEMS~\memaddr_{\F{mod}}^\ast,` :math:`\MIGLOBALS~\globaladdr_{\F{mod}}^\ast,` :math:`\MIEXPORTS~\exportinst^\ast\}`.
506506

@@ -635,7 +635,7 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
635635

636636
b. Assert: due to :ref:`validation <valid-module>`, the frame :math:`F_{\F{init}}` is now on the top of the stack.
637637

638-
c. Let :math:`\val^\ast` be the conatenation of :math:`\val_i` in index order.
638+
c. Let :math:`\val^\ast` be the concatenation of :math:`\val_i` in index order.
639639

640640
9. Let :math:`(\reff^\ast)^\ast` be the list of :ref:`reference <syntax-ref>` vectors determined by the :ref:`element segments <syntax-elem>` in :math:`\module`. These may be calculated as follows.
641641

document/core/syntax/instructions.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The following sections group instructions into a number of different categories.
3535
Numeric Instructions
3636
~~~~~~~~~~~~~~~~~~~~
3737

38-
Numeric instructions provide basic operations over numeric :ref:`values <syntax-value>` of specific :ref:`type <syntax-valtype>`.
38+
Numeric instructions provide basic operations over numeric :ref:`values <syntax-value>` of specific :ref:`type <syntax-numtype>`.
3939
These operations closely match respective operations available in hardware.
4040

4141
.. math::
@@ -118,7 +118,7 @@ These operations closely match respective operations available in hardware.
118118
\K{ge} \\
119119
\end{array}
120120
121-
Numeric instructions are divided by :ref:`value type <syntax-valtype>`.
121+
Numeric instructions are divided by :ref:`number type <syntax-numtype>`.
122122
For each type, several subcategories can be distinguished:
123123

124124
* *Constants*: return a static constant.
@@ -574,9 +574,9 @@ Instructions in this group are concerned with linear :ref:`memory <syntax-mem>`.
574574
\DATADROP~\dataidx \\
575575
\end{array}
576576
577-
Memory is accessed with |LOAD| and |STORE| instructions for the different :ref:`value types <syntax-valtype>`.
577+
Memory is accessed with |LOAD| and |STORE| instructions for the different :ref:`number types <syntax-numtype>`.
578578
They all take a *memory immediate* |memarg| that contains an address *offset* and the expected *alignment* (expressed as the exponent of a power of 2).
579-
Integer loads and stores can optionally specify a *storage size* that is smaller than the :ref:`bit width <syntax-valtype>` of the respective value type.
579+
Integer loads and stores can optionally specify a *storage size* that is smaller than the :ref:`bit width <syntax-numtype>` of the respective value type.
580580
In the case of loads, a sign extension mode |sx| is then required to select appropriate behavior.
581581

582582
Vector loads can specify a shape that is half the :ref:`bit width <syntax-valtype>` of |V128|. Each lane is half its usual size, and the sign extension mode |sx| then specifies how the smaller lane is extended to the larger lane.
@@ -604,7 +604,7 @@ The |DATADROP| instruction prevents further use of a passive data segment. This
604604
This restriction may be lifted in future versions.
605605

606606

607-
.. index:: ! control instruction, ! structured control, ! label, ! block, ! block type, ! branch, ! unwinding, result type, label index, function index, type index, vector, trap, function, table, function type, value type, type index
607+
.. index:: ! control instruction, ! structured control, ! label, ! block, ! block type, ! branch, ! unwinding, stack type, label index, function index, type index, vector, trap, function, table, function type, value type, type index
608608
pair: abstract syntax; instruction
609609
pair: abstract syntax; block type
610610
pair: block; type

0 commit comments

Comments
 (0)