summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/asmjs/asm_v_wasm.cpp5
-rw-r--r--src/binaryen-c.cpp2
-rw-r--r--src/binaryen-c.h1
-rw-r--r--src/ir/abstract.h8
-rw-r--r--src/ir/literal-utils.h1
-rw-r--r--src/js/binaryen.js-post.js2
-rw-r--r--src/parsing.h1
-rw-r--r--src/passes/ConstHoisting.cpp4
-rw-r--r--src/passes/FuncCastEmulation.cpp8
-rw-r--r--src/passes/InstrumentLocals.cpp2
-rw-r--r--src/passes/Precompute.cpp1
-rw-r--r--src/shell-interface.h1
-rw-r--r--src/tools/fuzzing.h9
-rw-r--r--src/tools/spec-wrapper.h1
-rw-r--r--src/tools/wasm-reduce.cpp5
-rw-r--r--src/wasm-binary.h1
-rw-r--r--src/wasm-builder.h1
-rw-r--r--src/wasm-interpreter.h3
-rw-r--r--src/wasm-js.cpp1
-rw-r--r--src/wasm-stack.h12
-rw-r--r--src/wasm-type.h2
-rw-r--r--src/wasm/literal.cpp10
-rw-r--r--src/wasm/wasm-type.cpp7
-rw-r--r--src/wasm/wasm-validator.cpp1
24 files changed, 84 insertions, 5 deletions
diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp
index 7102c588c..deb8ba71f 100644
--- a/src/asmjs/asm_v_wasm.cpp
+++ b/src/asmjs/asm_v_wasm.cpp
@@ -31,7 +31,7 @@ Type asmToWasmType(AsmType asmType) {
case ASM_FLOAT64X2:
case ASM_INT8X16:
case ASM_INT16X8:
- case ASM_INT32X4: WASM_UNREACHABLE();
+ case ASM_INT32X4: return Type::v128;
}
WASM_UNREACHABLE();
}
@@ -42,6 +42,7 @@ AsmType wasmToAsmType(Type type) {
case f32: return ASM_FLOAT;
case f64: return ASM_DOUBLE;
case i64: return ASM_INT64;
+ case v128: assert(false && "v128 not implemented yet");
case none: return ASM_NONE;
case unreachable: WASM_UNREACHABLE();
}
@@ -54,6 +55,7 @@ char getSig(Type type) {
case i64: return 'j';
case f32: return 'f';
case f64: return 'd';
+ case v128: return 'V';
case none: return 'v';
case unreachable: WASM_UNREACHABLE();
}
@@ -84,6 +86,7 @@ Type sigToType(char sig) {
case 'j': return i64;
case 'f': return f32;
case 'd': return f64;
+ case 'V': return v128;
case 'v': return none;
default: abort();
}
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index aeef53343..ebb8bb694 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -49,6 +49,7 @@ BinaryenLiteral toBinaryenLiteral(Literal x) {
case Type::i64: ret.i64 = x.geti64(); break;
case Type::f32: ret.i32 = x.reinterpreti32(); break;
case Type::f64: ret.i64 = x.reinterpreti64(); break;
+ case Type::v128: assert(false && "v128 not implemented yet");
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -113,6 +114,7 @@ BinaryenType BinaryenTypeInt32(void) { return i32; }
BinaryenType BinaryenTypeInt64(void) { return i64; }
BinaryenType BinaryenTypeFloat32(void) { return f32; }
BinaryenType BinaryenTypeFloat64(void) { return f64; }
+BinaryenType BinaryenTypeVec128(void) { return v128; }
BinaryenType BinaryenTypeUnreachable(void) { return unreachable; }
BinaryenType BinaryenTypeAuto(void) { return uint32_t(-1); }
diff --git a/src/binaryen-c.h b/src/binaryen-c.h
index 6256f59d8..14fc38de3 100644
--- a/src/binaryen-c.h
+++ b/src/binaryen-c.h
@@ -73,6 +73,7 @@ BinaryenType BinaryenTypeInt32(void);
BinaryenType BinaryenTypeInt64(void);
BinaryenType BinaryenTypeFloat32(void);
BinaryenType BinaryenTypeFloat64(void);
+BinaryenType BinaryenTypeVec128(void);
BinaryenType BinaryenTypeUnreachable(void);
// Not a real type. Used as the last parameter to BinaryenBlock to let
// the API figure out the type instead of providing one.
diff --git a/src/ir/abstract.h b/src/ir/abstract.h
index 2fe464c1d..1f15bafa1 100644
--- a/src/ir/abstract.h
+++ b/src/ir/abstract.h
@@ -62,6 +62,10 @@ inline UnaryOp getUnary(Type type, Op op) {
}
break;
}
+ case v128: {
+ assert(false && "v128 not implemented yet");
+ WASM_UNREACHABLE();
+ }
case none:
case unreachable: {
return InvalidUnary;
@@ -140,6 +144,10 @@ inline BinaryOp getBinary(Type type, Op op) {
}
break;
}
+ case v128: {
+ assert(false && "v128 not implemented yet");
+ WASM_UNREACHABLE();
+ }
case none:
case unreachable: {
return InvalidBinary;
diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h
index c78fdc663..e00f05c52 100644
--- a/src/ir/literal-utils.h
+++ b/src/ir/literal-utils.h
@@ -29,6 +29,7 @@ inline Literal makeLiteralFromInt32(int32_t x, Type type) {
case i64: return Literal(int64_t(x)); break;
case f32: return Literal(float(x)); break;
case f64: return Literal(double(x)); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 6f23867f5..06688d706 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -28,6 +28,7 @@ Module['i32'] = Module['_BinaryenTypeInt32']();
Module['i64'] = Module['_BinaryenTypeInt64']();
Module['f32'] = Module['_BinaryenTypeFloat32']();
Module['f64'] = Module['_BinaryenTypeFloat64']();
+Module['v128'] = Module['_BinaryenTypeVec128']();
Module['unreachable'] = Module['_BinaryenTypeUnreachable']();
Module['auto'] = /* deprecated */ Module['undefined'] = Module['_BinaryenTypeAuto']();
@@ -1629,4 +1630,3 @@ Module['exit'] = function(status) {
// a stack trace, for debuggability.
if (status != 0) throw new Error('exiting due to error: ' + status);
};
-
diff --git a/src/parsing.h b/src/parsing.h
index 3304122f2..6eecb38f2 100644
--- a/src/parsing.h
+++ b/src/parsing.h
@@ -213,6 +213,7 @@ inline Expression* parseConst(cashew::IString s, Type type, MixedArena& allocato
ret->value = Literal(strtod(str, &end));
break;
}
+ case v128: WASM_UNREACHABLE();
case none:
case unreachable: {
return nullptr;
diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp
index c0798fe78..77ac5d251 100644
--- a/src/passes/ConstHoisting.cpp
+++ b/src/passes/ConstHoisting.cpp
@@ -92,6 +92,10 @@ private:
size = getTypeSize(value.type);
break;
}
+ case v128: {
+ // v128 not implemented yet
+ return false;
+ }
case none:
case unreachable: {
WASM_UNREACHABLE();
diff --git a/src/passes/FuncCastEmulation.cpp b/src/passes/FuncCastEmulation.cpp
index 301a4b9fd..5e50afcdc 100644
--- a/src/passes/FuncCastEmulation.cpp
+++ b/src/passes/FuncCastEmulation.cpp
@@ -64,6 +64,10 @@ static Expression* toABI(Expression* value, Module* module) {
value = builder.makeUnary(ReinterpretFloat64, value);
break;
}
+ case v128: {
+ assert(false && "v128 not implemented yet");
+ WASM_UNREACHABLE();
+ }
case none: {
// the value is none, but we need a value here
value = builder.makeSequence(
@@ -103,6 +107,10 @@ static Expression* fromABI(Expression* value, Type type, Module* module) {
value = builder.makeUnary(ReinterpretInt64, value);
break;
}
+ case v128: {
+ assert(false && "v128 not implemented yet");
+ WASM_UNREACHABLE();
+ }
case none: {
value = builder.makeDrop(value);
}
diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp
index 9a8c34024..f582004d5 100644
--- a/src/passes/InstrumentLocals.cpp
+++ b/src/passes/InstrumentLocals.cpp
@@ -72,6 +72,7 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case i64: return; // TODO
case f32: import = get_f32; break;
case f64: import = get_f64; break;
+ case v128: assert(false && "v128 not implemented yet");
case none: WASM_UNREACHABLE();
case unreachable: WASM_UNREACHABLE();
}
@@ -96,6 +97,7 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case i64: return; // TODO
case f32: import = set_f32; break;
case f64: import = set_f64; break;
+ case v128: assert(false && "v128 not implemented yet");
case unreachable: return; // nothing to do here
case none: WASM_UNREACHABLE();
}
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp
index 42127901c..db34b9ffb 100644
--- a/src/passes/Precompute.cpp
+++ b/src/passes/Precompute.cpp
@@ -345,4 +345,3 @@ Pass *createPrecomputePropagatePass() {
}
} // namespace wasm
-
diff --git a/src/shell-interface.h b/src/shell-interface.h
index 139db23e5..85010a4b2 100644
--- a/src/shell-interface.h
+++ b/src/shell-interface.h
@@ -126,6 +126,7 @@ struct ShellExternalInterface final : ModuleInstance::ExternalInterface {
case i64: globals[import->name] = Literal(int64_t(666)); break;
case f32: globals[import->name] = Literal(float(666.6)); break;
case f64: globals[import->name] = Literal(double(666.6)); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index 9a33524ec..3b1a418b5 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -671,6 +671,7 @@ private:
case i64:
case f32:
case f64: ret = _makeConcrete(type); break;
+ case v128: assert(false && "v128 not implemented yet");
case none: ret = _makenone(); break;
case unreachable: ret = _makeunreachable(); break;
}
@@ -1087,6 +1088,7 @@ private:
case f64: {
return builder.makeLoad(8, false, offset, pick(1, 2, 4, 8), ptr, type);
}
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -1149,6 +1151,7 @@ private:
case f64: {
return builder.makeStore(8, offset, pick(1, 2, 4, 8), ptr, value, type);
}
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -1176,6 +1179,7 @@ private:
case i64: value = Literal(get64()); break;
case f32: value = Literal(getFloat()); break;
case f64: value = Literal(getDouble()); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -1198,6 +1202,7 @@ private:
case i64: value = Literal(int64_t(small)); break;
case f32: value = Literal(float(small)); break;
case f64: value = Literal(double(small)); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -1235,6 +1240,7 @@ private:
std::numeric_limits<int64_t>::min(), std::numeric_limits<int64_t>::max(),
std::numeric_limits<uint32_t>::max(),
std::numeric_limits<uint64_t>::max())); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: {
WASM_UNREACHABLE();
@@ -1256,6 +1262,7 @@ private:
case i64: value = Literal(int64_t(1) << upTo(64)); break;
case f32: value = Literal(float(int64_t(1) << upTo(64))); break;
case f64: value = Literal(double(int64_t(1) << upTo(64))); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -1334,6 +1341,7 @@ private:
}
WASM_UNREACHABLE();
}
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: {
WASM_UNREACHABLE();
@@ -1373,6 +1381,7 @@ private:
case f64: {
return makeDeNanOp(makeBinary({ pick(AddFloat64, SubFloat64, MulFloat64, DivFloat64, CopySignFloat64, MinFloat64, MaxFloat64), make(f64), make(f64) }));
}
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
diff --git a/src/tools/spec-wrapper.h b/src/tools/spec-wrapper.h
index ed27b6f34..d6aa0d87e 100644
--- a/src/tools/spec-wrapper.h
+++ b/src/tools/spec-wrapper.h
@@ -34,6 +34,7 @@ static std::string generateSpecWrapper(Module& wasm) {
case i64: ret += "(i64.const 0)"; break;
case f32: ret += "(f32.const 0)"; break;
case f64: ret += "(f64.const 0)"; break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 76a3034cf..b7dbc79f3 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -505,6 +505,7 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
case i64: fixed = builder->makeUnary(WrapInt64, child); break;
case f32: fixed = builder->makeUnary(TruncSFloat32ToInt32, child); break;
case f64: fixed = builder->makeUnary(TruncSFloat64ToInt32, child); break;
+ case v128: continue; // v128 not implemented yet
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -516,6 +517,7 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
case i64: WASM_UNREACHABLE();
case f32: fixed = builder->makeUnary(TruncSFloat32ToInt64, child); break;
case f64: fixed = builder->makeUnary(TruncSFloat64ToInt64, child); break;
+ case v128: continue; // v128 not implemented yet
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -527,6 +529,7 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
case i64: fixed = builder->makeUnary(ConvertSInt64ToFloat32, child); break;
case f32: WASM_UNREACHABLE();
case f64: fixed = builder->makeUnary(DemoteFloat64, child); break;
+ case v128: continue; // v128 not implemented yet
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -538,11 +541,13 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
case i64: fixed = builder->makeUnary(ConvertSInt64ToFloat64, child); break;
case f32: fixed = builder->makeUnary(PromoteFloat32, child); break;
case f64: WASM_UNREACHABLE();
+ case v128: continue; // v128 not implemented yet
case none:
case unreachable: WASM_UNREACHABLE();
}
break;
}
+ case v128: continue; // v128 not implemented yet
case none:
case unreachable: WASM_UNREACHABLE();
}
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index ad7e44d8c..c767cf5eb 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -651,6 +651,7 @@ inline S32LEB binaryType(Type type) {
case i64: ret = BinaryConsts::EncodedType::i64; break;
case f32: ret = BinaryConsts::EncodedType::f32; break;
case f64: ret = BinaryConsts::EncodedType::f64; break;
+ case v128: assert(false && "v128 not implemented yet");
case unreachable: WASM_UNREACHABLE();
}
return S32LEB(ret);
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index f59646869..f36ec7a88 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -474,6 +474,7 @@ public:
case i64: value = Literal(int64_t(0)); break;
case f32: value = Literal(float(0)); break;
case f64: value = Literal(double(0)); break;
+ case v128: assert(false && "v128 not implemented yet");
case none: return ExpressionManipulator::nop(curr);
case unreachable: return ExpressionManipulator::convert<T, Unreachable>(curr);
}
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 36d8539e4..39ea488ef 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -578,6 +578,7 @@ public:
}
case f32: return Literal(load32u(addr)).castToF32();
case f64: return Literal(load64u(addr)).castToF64();
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -607,6 +608,7 @@ public:
// write floats carefully, ensuring all bits reach memory
case f32: store32(addr, value.reinterpreti32()); break;
case f64: store64(addr, value.reinterpreti64()); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -925,7 +927,6 @@ public:
// TODO: add threads support!
return Literal(int32_t(0)); // none woken up
}
-
Flow visitHost(Host *curr) {
NOTE_ENTER("Host");
switch (curr->op) {
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index 6e4b03aca..a6e751dcc 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -253,6 +253,7 @@ extern "C" void EMSCRIPTEN_KEEPALIVE instantiate() {
case i64: WASM_UNREACHABLE();
case f32: return Literal((float)ret);
case f64: return Literal((double)ret);
+ case v128: assert(false && "v128 not implemented yet");
case unreachable: WASM_UNREACHABLE();
}
WASM_UNREACHABLE();
diff --git a/src/wasm-stack.h b/src/wasm-stack.h
index c013a57f1..1a937f81d 100644
--- a/src/wasm-stack.h
+++ b/src/wasm-stack.h
@@ -291,6 +291,11 @@ void StackWriter<Mode, Parent>::mapLocalsAndEmitHeader() {
mappedLocals[i] = index + currLocalsByType[f64] - 1;
continue;
}
+ index += numLocalsByType[f64];
+ if (type == v128) {
+ mappedLocals[i] = index + currLocalsByType[v128] - 1;
+ continue;
+ }
WASM_UNREACHABLE();
}
// Emit them.
@@ -298,12 +303,14 @@ void StackWriter<Mode, Parent>::mapLocalsAndEmitHeader() {
(numLocalsByType[i32] ? 1 : 0) +
(numLocalsByType[i64] ? 1 : 0) +
(numLocalsByType[f32] ? 1 : 0) +
- (numLocalsByType[f64] ? 1 : 0)
+ (numLocalsByType[f64] ? 1 : 0) +
+ (numLocalsByType[v128] ? 1 : 0)
);
if (numLocalsByType[i32]) o << U32LEB(numLocalsByType[i32]) << binaryType(i32);
if (numLocalsByType[i64]) o << U32LEB(numLocalsByType[i64]) << binaryType(i64);
if (numLocalsByType[f32]) o << U32LEB(numLocalsByType[f32]) << binaryType(f32);
if (numLocalsByType[f64]) o << U32LEB(numLocalsByType[f64]) << binaryType(f64);
+ if (numLocalsByType[v128]) o << U32LEB(numLocalsByType[v128]) << binaryType(v128);
}
template<StackWriterMode Mode, typename Parent>
@@ -627,6 +634,7 @@ void StackWriter<Mode, Parent>::visitLoad(Load* curr) {
}
case f32: o << int8_t(BinaryConsts::F32LoadMem); break;
case f64: o << int8_t(BinaryConsts::F64LoadMem); break;
+ case v128: assert(false && "v128 not implemented yet");
case unreachable: return; // the pointer is unreachable, so we are never reached; just don't emit a load
case none: WASM_UNREACHABLE();
}
@@ -693,6 +701,7 @@ void StackWriter<Mode, Parent>::visitStore(Store* curr) {
}
case f32: o << int8_t(BinaryConsts::F32StoreMem); break;
case f64: o << int8_t(BinaryConsts::F64StoreMem); break;
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
@@ -883,6 +892,7 @@ void StackWriter<Mode, Parent>::visitConst(Const* curr) {
o << int8_t(BinaryConsts::F64Const) << curr->value.reinterpreti64();
break;
}
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: WASM_UNREACHABLE();
}
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 6b2618c8c..0b99fa53a 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -25,6 +25,7 @@ enum Type {
i64,
f32,
f64,
+ v128,
unreachable // none means no type, e.g. a block can have no return type. but
// unreachable is different, as it can be "ignored" when doing
// type checking across branches
@@ -37,6 +38,7 @@ Type getReachableType(Type a, Type b);
bool isConcreteType(Type type);
bool isFloatType(Type type);
bool isIntegerType(Type type);
+bool isVectorType(Type type);
} // namespace wasm
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index 3eb508bde..7b248010e 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -75,6 +75,7 @@ int64_t Literal::getBits() const {
switch (type) {
case Type::i32: case Type::f32: return i32;
case Type::i64: case Type::f64: return i64;
+ case Type::v128: assert(false && "v128 not implemented");
case Type::none: case Type::unreachable: WASM_UNREACHABLE();
}
WASM_UNREACHABLE();
@@ -164,6 +165,7 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
case Type::i64: o << literal.i64; break;
case Type::f32: literal.printFloat(o, literal.getf32()); break;
case Type::f64: literal.printDouble(o, literal.getf64()); break;
+ case Type::v128: assert(false && "v128 not implemented yet");
case Type::unreachable: WASM_UNREACHABLE();
}
restoreNormalColor(o);
@@ -260,6 +262,7 @@ Literal Literal::eqz() const {
case Type::i64: return eq(Literal(int64_t(0)));
case Type::f32: return eq(Literal(float(0)));
case Type::f64: return eq(Literal(double(0)));
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -272,6 +275,7 @@ Literal Literal::neg() const {
case Type::i64: return Literal(-uint64_t(i64));
case Type::f32: return Literal(i32 ^ 0x80000000).castToF32();
case Type::f64: return Literal(int64_t(i64 ^ 0x8000000000000000ULL)).castToF64();
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -284,6 +288,7 @@ Literal Literal::abs() const {
case Type::i64: return Literal(int64_t(i64 & 0x7fffffffffffffffULL));
case Type::f32: return Literal(i32 & 0x7fffffff).castToF32();
case Type::f64: return Literal(int64_t(i64 & 0x7fffffffffffffffULL)).castToF64();
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -351,6 +356,7 @@ Literal Literal::add(const Literal& other) const {
case Type::i64: return Literal(uint64_t(i64) + uint64_t(other.i64));
case Type::f32: return Literal(getf32() + other.getf32());
case Type::f64: return Literal(getf64() + other.getf64());
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -363,6 +369,7 @@ Literal Literal::sub(const Literal& other) const {
case Type::i64: return Literal(uint64_t(i64) - uint64_t(other.i64));
case Type::f32: return Literal(getf32() - other.getf32());
case Type::f64: return Literal(getf64() - other.getf64());
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -375,6 +382,7 @@ Literal Literal::mul(const Literal& other) const {
case Type::i64: return Literal(uint64_t(i64) * uint64_t(other.i64));
case Type::f32: return Literal(getf32() * other.getf32());
case Type::f64: return Literal(getf64() * other.getf64());
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -529,6 +537,7 @@ Literal Literal::eq(const Literal& other) const {
case Type::i64: return Literal(i64 == other.i64);
case Type::f32: return Literal(getf32() == other.getf32());
case Type::f64: return Literal(getf64() == other.getf64());
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
@@ -541,6 +550,7 @@ Literal Literal::ne(const Literal& other) const {
case Type::i64: return Literal(i64 != other.i64);
case Type::f32: return Literal(getf32() != other.getf32());
case Type::f64: return Literal(getf64() != other.getf64());
+ case Type::v128:
case Type::none:
case Type::unreachable: WASM_UNREACHABLE();
}
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index 89eadcd47..b7ed12947 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -28,6 +28,7 @@ const char* printType(Type type) {
case Type::i64: return "i64";
case Type::f32: return "f32";
case Type::f64: return "f64";
+ case Type::v128: return "v128";
case Type::unreachable: return "unreachable";
}
WASM_UNREACHABLE();
@@ -40,6 +41,7 @@ unsigned getTypeSize(Type type) {
case Type::i64: return 8;
case Type::f32: return 4;
case Type::f64: return 8;
+ case Type::v128: return 16;
case Type::unreachable: WASM_UNREACHABLE();
}
WASM_UNREACHABLE();
@@ -49,6 +51,7 @@ Type getType(unsigned size, bool float_) {
if (size < 4) return Type::i32;
if (size == 4) return float_ ? Type::f32 : Type::i32;
if (size == 8) return float_ ? Type::f64 : Type::i64;
+ if (size == 16) return Type::v128;
WASM_UNREACHABLE();
}
@@ -76,4 +79,8 @@ bool isFloatType(Type type) {
}
}
+bool isVectorType(Type type) {
+ return type == v128;
+}
+
} // namespace wasm
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 092394ad3..a08c9a129 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -862,6 +862,7 @@ void FunctionValidator::validateAlignment(size_t align, Type type, Index bytes,
shouldBeTrue(align <= 8, curr, "alignment must not exceed natural");
break;
}
+ case v128: assert(false && "v128 not implemented yet");
case none:
case unreachable: {}
}