From 835581f58eb5040656243f7345ebcacf6d7deee5 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Mon, 23 Sep 2019 18:15:14 -0700 Subject: vNxM.load_splat instructions (#2350) Introduces a new instruction class, `SIMDLoad`. Implements encoding, decoding, parsing, printing, and interpretation of the load and splat instructions, including in the C and JS APIs. `v128.load` remains in the `Load` instruction class for now because the interpreter code expects a `Load` to be able to load any memory value type. --- src/wasm/wasm-stack.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/wasm/wasm-stack.cpp') diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 1da6e9015..c673a3fb0 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -554,6 +554,26 @@ void BinaryInstWriter::visitSIMDShift(SIMDShift* curr) { } } +void BinaryInstWriter::visitSIMDLoad(SIMDLoad* curr) { + o << int8_t(BinaryConsts::SIMDPrefix); + switch (curr->op) { + case LoadSplatVec8x16: + o << U32LEB(BinaryConsts::V8x16LoadSplat); + break; + case LoadSplatVec16x8: + o << U32LEB(BinaryConsts::V16x8LoadSplat); + break; + case LoadSplatVec32x4: + o << U32LEB(BinaryConsts::V32x4LoadSplat); + break; + case LoadSplatVec64x2: + o << U32LEB(BinaryConsts::V64x2LoadSplat); + break; + } + assert(curr->align); + emitMemoryAccess(curr->align, /*(unused) bytes=*/0, curr->offset); +} + void BinaryInstWriter::visitMemoryInit(MemoryInit* curr) { o << int8_t(BinaryConsts::MiscPrefix); o << U32LEB(BinaryConsts::MemoryInit); -- cgit v1.2.3