From b5c287567ebcb3cbb1b1acb7f9e717f8b834ea83 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Mon, 1 Feb 2021 16:53:01 -0800 Subject: Prototype i32x4.widen_i8x16_{s,u} (#3535) As proposed in https://github.com/WebAssembly/simd/pull/395. Note that the other instructions in the proposal have not been implemented in LLVM or in V8, so there is no need to implement them in Binaryen right now either. This PR introduces a new expression class for the new instructions because they uniquely take an immediate argument identifying which portion of the input vector to widen. --- src/wasm/wasm-stack.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/wasm/wasm-stack.cpp') diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index d42080bac..cb8702d0c 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -691,6 +691,19 @@ void BinaryInstWriter::visitSIMDLoadStoreLane(SIMDLoadStoreLane* curr) { o << curr->index; } +void BinaryInstWriter::visitSIMDWiden(SIMDWiden* curr) { + o << int8_t(BinaryConsts::SIMDPrefix); + switch (curr->op) { + case WidenSVecI8x16ToVecI32x4: + o << U32LEB(BinaryConsts::I32x4WidenSI8x16); + break; + case WidenUVecI8x16ToVecI32x4: + o << U32LEB(BinaryConsts::I32x4WidenUI8x16); + break; + } + o << uint8_t(curr->index); +} + void BinaryInstWriter::visitPrefetch(Prefetch* curr) { o << int8_t(BinaryConsts::SIMDPrefix); switch (curr->op) { -- cgit v1.2.3