summaryrefslogtreecommitdiff
path: root/src/wasm-interpreter.h
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-08-03 13:48:10 -0700
committerGitHub <noreply@github.com>2020-08-03 13:48:10 -0700
commitdaa442b40f92ee5117c9c7c391171c3304abc67e (patch)
treed4533e9f8d3564e20bc6b1c006e74f4b32d3dcca /src/wasm-interpreter.h
parent79f2fe4eb4197b3f2a1f8ad0c3a34bf9c28149a1 (diff)
downloadbinaryen-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-interpreter.h')
-rw-r--r--src/wasm-interpreter.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 124ba9aae..a61f549c7 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1238,6 +1238,7 @@ public:
Flow visitSIMDLoad(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); }
Flow visitSIMDLoadSplat(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); }
Flow visitSIMDLoadExtend(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitSIMDLoadZero(SIMDLoad* curr) { WASM_UNREACHABLE("unimp"); }
Flow visitPop(Pop* curr) { WASM_UNREACHABLE("unimp"); }
Flow visitRefNull(RefNull* curr) {
NOTE_ENTER("RefNull");
@@ -2174,6 +2175,9 @@ private:
case LoadExtSVec32x2ToVecI64x2:
case LoadExtUVec32x2ToVecI64x2:
return visitSIMDLoadExtend(curr);
+ case Load32Zero:
+ case Load64Zero:
+ return visitSIMDLoadZero(curr);
}
WASM_UNREACHABLE("invalid op");
}
@@ -2266,6 +2270,24 @@ private:
}
WASM_UNREACHABLE("invalid op");
}
+ Flow visitSIMDLoadZero(SIMDLoad* curr) {
+ Flow flow = this->visit(curr->ptr);
+ if (flow.breaking()) {
+ return flow;
+ }
+ NOTE_EVAL1(flow);
+ Address src = instance.getFinalAddress(
+ curr, flow.getSingleValue(), curr->op == Load32Zero ? 32 : 64);
+ auto zero =
+ Literal::makeSingleZero(curr->op == Load32Zero ? Type::i32 : Type::i64);
+ if (curr->op == Load32Zero) {
+ auto val = Literal(instance.externalInterface->load32u(src));
+ return Literal(std::array<Literal, 4>{{val, zero, zero, zero}});
+ } else {
+ auto val = Literal(instance.externalInterface->load64u(src));
+ return Literal(std::array<Literal, 2>{{val, zero}});
+ }
+ }
Flow visitHost(Host* curr) {
NOTE_ENTER("Host");
switch (curr->op) {