diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2020-08-03 13:48:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 13:48:10 -0700 |
commit | daa442b40f92ee5117c9c7c391171c3304abc67e (patch) | |
tree | d4533e9f8d3564e20bc6b1c006e74f4b32d3dcca /src/wasm | |
parent | 79f2fe4eb4197b3f2a1f8ad0c3a34bf9c28149a1 (diff) | |
download | binaryen-daa442b40f92ee5117c9c7c391171c3304abc67e.tar.gz binaryen-daa442b40f92ee5117c9c7c391171c3304abc67e.tar.bz2 binaryen-daa442b40f92ee5117c9c7c391171c3304abc67e.zip |
Implement prototype v128.load{32,64}_zero instructions (#3011)
Specified in https://github.com/WebAssembly/simd/pull/237. Since these
are just prototypes necessary for benchmarking, this PR does not add
support for these instructions to the fuzzer or the C or JS APIs. This
PR also renumbers the QFMA instructions that previously used the
opcodes for these new instructions. The renumbering matches the
renumbering in V8 and LLVM.
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 8 | ||||
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 2 | ||||
-rw-r--r-- | src/wasm/wasm-stack.cpp | 6 | ||||
-rw-r--r-- | src/wasm/wasm-validator.cpp | 2 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 2 |
5 files changed, 20 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index bb5d420a9..ddc4de36c 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -4598,6 +4598,14 @@ bool WasmBinaryBuilder::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { curr = allocator.alloc<SIMDLoad>(); curr->op = LoadExtUVec32x2ToVecI64x2; break; + case BinaryConsts::V128Load32Zero: + curr = allocator.alloc<SIMDLoad>(); + curr->op = Load32Zero; + break; + case BinaryConsts::V128Load64Zero: + curr = allocator.alloc<SIMDLoad>(); + curr->op = Load64Zero; + break; default: return false; } diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 429cac273..5e6008bca 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1528,6 +1528,7 @@ Expression* SExpressionWasmBuilder::makeSIMDLoad(Element& s, SIMDLoadOp op) { defaultAlign = 2; break; case LoadSplatVec32x4: + case Load32Zero: defaultAlign = 4; break; case LoadSplatVec64x2: @@ -1537,6 +1538,7 @@ Expression* SExpressionWasmBuilder::makeSIMDLoad(Element& s, SIMDLoadOp op) { case LoadExtUVec16x4ToVecI32x4: case LoadExtSVec32x2ToVecI64x2: case LoadExtUVec32x2ToVecI64x2: + case Load64Zero: defaultAlign = 8; break; } diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 9e3ce2afa..90113bb7f 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -632,6 +632,12 @@ void BinaryInstWriter::visitSIMDLoad(SIMDLoad* curr) { case LoadExtUVec32x2ToVecI64x2: o << U32LEB(BinaryConsts::I64x2LoadExtUVec32x2); break; + case Load32Zero: + o << U32LEB(BinaryConsts::V128Load32Zero); + break; + case Load64Zero: + o << U32LEB(BinaryConsts::V128Load64Zero); + break; } assert(curr->align); emitMemoryAccess(curr->align, /*(unused) bytes=*/0, curr->offset); diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 2c2aac1c8..5f37560e7 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1139,6 +1139,7 @@ void FunctionValidator::visitSIMDLoad(SIMDLoad* curr) { case LoadSplatVec8x16: case LoadSplatVec16x8: case LoadSplatVec32x4: + case Load32Zero: memAlignType = Type::i32; break; case LoadSplatVec64x2: @@ -1148,6 +1149,7 @@ void FunctionValidator::visitSIMDLoad(SIMDLoad* curr) { case LoadExtUVec16x4ToVecI32x4: case LoadExtSVec32x2ToVecI64x2: case LoadExtUVec32x2ToVecI64x2: + case Load64Zero: memAlignType = Type::i64; break; } diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index a0c6dbbb6..be3ab6ccc 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -629,6 +629,7 @@ Index SIMDLoad::getMemBytes() { case LoadSplatVec16x8: return 2; case LoadSplatVec32x4: + case Load32Zero: return 4; case LoadSplatVec64x2: case LoadExtSVec8x8ToVecI16x8: @@ -637,6 +638,7 @@ Index SIMDLoad::getMemBytes() { case LoadExtUVec16x4ToVecI32x4: case LoadExtSVec32x2ToVecI64x2: case LoadExtUVec32x2ToVecI64x2: + case Load64Zero: return 8; } WASM_UNREACHABLE("unexpected op"); |