summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-09-24 16:57:57 -0700
committerGitHub <noreply@github.com>2019-09-24 16:57:57 -0700
commited2c3cd0892be8a1380a6c6bfddfa3492c16f91c (patch)
tree32e5f1499f69caa359c130c92e1d28153e7506d3 /src/wasm/wasm-validator.cpp
parent034ed383a968204427befda3f9fb8bb5d2f63f75 (diff)
downloadbinaryen-ed2c3cd0892be8a1380a6c6bfddfa3492c16f91c.tar.gz
binaryen-ed2c3cd0892be8a1380a6c6bfddfa3492c16f91c.tar.bz2
binaryen-ed2c3cd0892be8a1380a6c6bfddfa3492c16f91c.zip
SIMD load and extend instructions (#2353)
Adds support for the new load and extend instructions. Also updates from C++11 to C++17 in order to use generic lambdas in the interpreter implementation.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 78c8d3289..1c30d0d2a 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -1064,9 +1064,25 @@ void FunctionValidator::visitSIMDLoad(SIMDLoad* curr) {
curr->type, v128, curr, "load_splat must have type v128");
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type, i32, curr, "load_splat address must have type i32");
- Type lane_t = curr->op == LoadSplatVec64x2 ? i64 : i32;
+ Type memAlignType = none;
+ switch (curr->op) {
+ case LoadSplatVec8x16:
+ case LoadSplatVec16x8:
+ case LoadSplatVec32x4:
+ memAlignType = i32;
+ break;
+ case LoadSplatVec64x2:
+ case LoadExtSVec8x8ToVecI16x8:
+ case LoadExtUVec8x8ToVecI16x8:
+ case LoadExtSVec16x4ToVecI32x4:
+ case LoadExtUVec16x4ToVecI32x4:
+ case LoadExtSVec32x2ToVecI64x2:
+ case LoadExtUVec32x2ToVecI64x2:
+ memAlignType = i64;
+ break;
+ }
Index bytes = curr->getMemBytes();
- validateAlignment(curr->align, lane_t, bytes, /*isAtomic=*/false, curr);
+ validateAlignment(curr->align, memAlignType, bytes, /*isAtomic=*/false, curr);
}
void FunctionValidator::visitMemoryInit(MemoryInit* curr) {