From 4615f3bbdea8de2f2b6fa79eb095a88a307b9e6a Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 28 Nov 2018 11:27:57 -0800 Subject: [PATCH 01/36] V128 Literals and operations --- src/binaryen-c.cpp | 7 +- src/binaryen-c.h | 2 + src/ir/ExpressionAnalyzer.cpp | 7 +- src/ir/literal-utils.h | 6 +- src/literal.h | 186 ++++++++++- src/wasm/literal.cpp | 588 +++++++++++++++++++++++++++++++++- 6 files changed, 775 insertions(+), 21 deletions(-) diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 88a3d033e6d..7c6b0f07fda 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -49,7 +49,10 @@ 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::v128: { + memcpy(&ret.v128, x.getv128Ptr(), 16); + break; + } case Type::none: case Type::unreachable: WASM_UNREACHABLE(); } @@ -62,6 +65,7 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) { case Type::i64: return Literal(x.i64); case Type::f32: return Literal(x.i32).castToF32(); case Type::f64: return Literal(x.i64).castToF64(); + case Type::v128: return Literal(x.v128); case Type::none: case Type::unreachable: WASM_UNREACHABLE(); } @@ -325,6 +329,7 @@ BinaryenLiteral BinaryenLiteralInt32(int32_t x) { return toBinaryenLiteral(Liter BinaryenLiteral BinaryenLiteralInt64(int64_t x) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralFloat32(float x) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralFloat64(double x) { return toBinaryenLiteral(Literal(x)); } +BinaryenLiteral BinaryenLiteralVec128(uint8_t x[16]) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralFloat32Bits(int32_t x) { return toBinaryenLiteral(Literal(x).castToF32()); } BinaryenLiteral BinaryenLiteralFloat64Bits(int64_t x) { return toBinaryenLiteral(Literal(x).castToF64()); } diff --git a/src/binaryen-c.h b/src/binaryen-c.h index dc47b379fc2..f92c783cd5d 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -166,6 +166,7 @@ struct BinaryenLiteral { int64_t i64; float f32; double f64; + uint8_t v128[16]; }; }; @@ -173,6 +174,7 @@ struct BinaryenLiteral BinaryenLiteralInt32(int32_t x); struct BinaryenLiteral BinaryenLiteralInt64(int64_t x); struct BinaryenLiteral BinaryenLiteralFloat32(float x); struct BinaryenLiteral BinaryenLiteralFloat64(double x); +struct BinaryenLiteral BinaryenLiteralVec128(uint8_t x[16]); struct BinaryenLiteral BinaryenLiteralFloat32Bits(int32_t x); struct BinaryenLiteral BinaryenLiteralFloat64Bits(int64_t x); diff --git a/src/ir/ExpressionAnalyzer.cpp b/src/ir/ExpressionAnalyzer.cpp index 7788f7cdeaf..43f9b2eb7b1 100644 --- a/src/ir/ExpressionAnalyzer.cpp +++ b/src/ir/ExpressionAnalyzer.cpp @@ -499,12 +499,7 @@ HashType ExpressionAnalyzer::hash(Expression* curr) { case Expression::Id::ConstId: { auto* c = curr->cast(); hash(c->type); - auto bits = c->value.getBits(); - if (getTypeSize(c->type) == 4) { - hash(HashType(bits)); - } else { - hash64(bits); - } + hash(std::hash()(c->value)); break; } case Expression::Id::UnaryId: { diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h index e00f05c5288..b35b19a4099 100644 --- a/src/ir/literal-utils.h +++ b/src/ir/literal-utils.h @@ -29,7 +29,11 @@ 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 v128: return Literal( + std::array{ + Literal(x), Literal(int32_t(0)), Literal(int32_t(0)), Literal(int32_t(0)) + } + ); case none: case unreachable: WASM_UNREACHABLE(); } diff --git a/src/literal.h b/src/literal.h index 4ed23b80d51..a54a0d0e30e 100644 --- a/src/literal.h +++ b/src/literal.h @@ -36,10 +36,11 @@ class Literal { union { int32_t i32; int64_t i64; + uint8_t v128[16]; }; public: - Literal() : type(Type::none), i64(0) {} + Literal() : type(Type::none), v128() {} explicit Literal(Type type) : type(type), i64(0) {} explicit Literal(int32_t init) : type(Type::i32), i32(init) {} explicit Literal(uint32_t init) : type(Type::i32), i32(init) {} @@ -47,6 +48,11 @@ class Literal { explicit Literal(uint64_t init) : type(Type::i64), i64(init) {} explicit Literal(float init) : type(Type::f32), i32(bit_cast(init)) {} explicit Literal(double init) : type(Type::f64), i64(bit_cast(init)) {} + explicit Literal(uint8_t init[16]); + explicit Literal(const std::array&); + explicit Literal(const std::array&); + explicit Literal(const std::array&); + explicit Literal(const std::array&); bool isConcrete() { return type != none; } bool isNull() { return type == none; } @@ -60,8 +66,12 @@ class Literal { int64_t geti64() const { assert(type == Type::i64); return i64; } float getf32() const { assert(type == Type::f32); return bit_cast(i32); } double getf64() const { assert(type == Type::f64); return bit_cast(i64); } + std::array getv128() const; + int32_t* geti32Ptr() { assert(type == Type::i32); return &i32; } // careful! + uint8_t* getv128Ptr() { assert(type == Type::v128); return v128; } + const uint8_t* getv128Ptr() const { assert(type == Type::v128); return v128; } int32_t reinterpreti32() const { assert(type == Type::f32); return i32; } int64_t reinterpreti64() const { assert(type == Type::f64); return i64; } @@ -70,7 +80,7 @@ class Literal { int64_t getInteger() const; double getFloat() const; - int64_t getBits() const; + void getBits(uint8_t (&buf)[16]) const; // Equality checks for the type and the bits, so a nan float would // be compared bitwise (which means that a Literal containing a nan // would be equal to itself, if the bits are equal). @@ -84,6 +94,7 @@ class Literal { static void printFloat(std::ostream &o, float f); static void printDouble(std::ostream& o, double d); + static void printVec128(std::ostream& o, const std::array& v); friend std::ostream& operator<<(std::ostream& o, Literal literal); @@ -158,6 +169,153 @@ class Literal { Literal min(const Literal& other) const; Literal max(const Literal& other) const; Literal copysign(const Literal& other) const; + + std::array getLanesSI8x16() const; + std::array getLanesUI8x16() const; + std::array getLanesSI16x8() const; + std::array getLanesUI16x8() const; + std::array getLanesI32x4() const; + std::array getLanesI64x2() const; + std::array getLanesF32x4() const; + std::array getLanesF64x2() const; + + Literal shuffleV8x16(const Literal& other, const std::array& mask) const; + Literal splatI8x16() const; + Literal extractLaneSI8x16(uint8_t idx) const; + Literal extractLaneUI8x16(uint8_t idx) const; + Literal replaceLaneI8x16(const Literal& other, uint8_t idx) const; + Literal splatI16x8() const; + Literal extractLaneSI16x8(uint8_t idx) const; + Literal extractLaneUI16x8(uint8_t idx) const; + Literal replaceLaneI16x8(const Literal& other, uint8_t idx) const; + Literal splatI32x4() const; + Literal extractLaneI32x4(uint8_t idx) const; + Literal replaceLaneI32x4(const Literal& other, uint8_t idx) const; + Literal splatI64x2() const; + Literal extractLaneI64x2(uint8_t idx) const; + Literal replaceLaneI64x2(const Literal& other, uint8_t idx) const; + Literal splatF32x4() const; + Literal extractLaneF32x4(uint8_t idx) const; + Literal replaceLaneF32x4(const Literal& other, uint8_t idx) const; + Literal splatF64x2() const; + Literal extractLaneF64x2(uint8_t idx) const; + Literal replaceLaneF64x2(const Literal& other, uint8_t idx) const; + Literal eqI8x16(const Literal& other) const; + Literal neI8x16(const Literal& other) const; + Literal ltSI8x16(const Literal& other) const; + Literal ltUI8x16(const Literal& other) const; + Literal gtSI8x16(const Literal& other) const; + Literal gtUI8x16(const Literal& other) const; + Literal leSI8x16(const Literal& other) const; + Literal leUI8x16(const Literal& other) const; + Literal geSI8x16(const Literal& other) const; + Literal geUI8x16(const Literal& other) const; + Literal eqI16x8(const Literal& other) const; + Literal neI16x8(const Literal& other) const; + Literal ltSI16x8(const Literal& other) const; + Literal ltUI16x8(const Literal& other) const; + Literal gtSI16x8(const Literal& other) const; + Literal gtUI16x8(const Literal& other) const; + Literal leSI16x8(const Literal& other) const; + Literal leUI16x8(const Literal& other) const; + Literal geSI16x8(const Literal& other) const; + Literal geUI16x8(const Literal& other) const; + Literal eqI32x4(const Literal& other) const; + Literal neI32x4(const Literal& other) const; + Literal ltSI32x4(const Literal& other) const; + Literal ltUI32x4(const Literal& other) const; + Literal gtSI32x4(const Literal& other) const; + Literal gtUI32x4(const Literal& other) const; + Literal leSI32x4(const Literal& other) const; + Literal leUI32x4(const Literal& other) const; + Literal geSI32x4(const Literal& other) const; + Literal geUI32x4(const Literal& other) const; + Literal eqF32x4(const Literal& other) const; + Literal neF32x4(const Literal& other) const; + Literal ltF32x4(const Literal& other) const; + Literal gtF32x4(const Literal& other) const; + Literal leF32x4(const Literal& other) const; + Literal geF32x4(const Literal& other) const; + Literal eqF64x2(const Literal& other) const; + Literal neF64x2(const Literal& other) const; + Literal ltF64x2(const Literal& other) const; + Literal gtF64x2(const Literal& other) const; + Literal leF64x2(const Literal& other) const; + Literal geF64x2(const Literal& other) const; + Literal notV128() const; + Literal andV128(const Literal& other) const; + Literal orV128(const Literal& other) const; + Literal xorV128(const Literal& other) const; + Literal bitselectV128(const Literal& left, const Literal& right) const; + Literal negI8x16() const; + Literal anyTrueI8x16() const; + Literal allTrueI8x16() const; + Literal shlI8x16(const Literal& other) const; + Literal shrSI8x16(const Literal& other) const; + Literal shrUI8x16(const Literal& other) const; + Literal addI8x16(const Literal& other) const; + Literal addSaturateSI8x16(const Literal& other) const; + Literal addSaturateUI8x16(const Literal& other) const; + Literal subI8x16(const Literal& other) const; + Literal subSaturateSI8x16(const Literal& other) const; + Literal subSaturateUI8x16(const Literal& other) const; + Literal mulI8x16(const Literal& other) const; + Literal negI16x8() const; + Literal anyTrueI16x8() const; + Literal allTrueI16x8() const; + Literal shlI16x8(const Literal& other) const; + Literal shrSI16x8(const Literal& other) const; + Literal shrUI16x8(const Literal& other) const; + Literal addI16x8(const Literal& other) const; + Literal addSaturateSI16x8(const Literal& other) const; + Literal addSaturateUI16x8(const Literal& other) const; + Literal subI16x8(const Literal& other) const; + Literal subSaturateSI16x8(const Literal& other) const; + Literal subSaturateUI16x8(const Literal& other) const; + Literal mulI16x8(const Literal& other) const; + Literal negI32x4() const; + Literal anyTrueI32x4() const; + Literal allTrueI32x4() const; + Literal shlI32x4(const Literal& other) const; + Literal shrSI32x4(const Literal& other) const; + Literal shrUI32x4(const Literal& other) const; + Literal addI32x4(const Literal& other) const; + Literal subI32x4(const Literal& other) const; + Literal mulI32x4(const Literal& other) const; + Literal negI64x2() const; + Literal anyTrueI64x2() const; + Literal allTrueI64x2() const; + Literal shlI64x2(const Literal& other) const; + Literal shrSI64x2(const Literal& other) const; + Literal shrUI64x2(const Literal& other) const; + Literal addI64x2(const Literal& other) const; + Literal subI64x2(const Literal& other) const; + Literal absF32x4() const; + Literal negF32x4() const; + Literal sqrtF32x4() const; + Literal addF32x4(const Literal& other) const; + Literal subF32x4(const Literal& other) const; + Literal mulF32x4(const Literal& other) const; + Literal divF32x4(const Literal& other) const; + Literal minF32x4(const Literal& other) const; + Literal maxF32x4(const Literal& other) const; + Literal absF64x2() const; + Literal negF64x2() const; + Literal sqrtF64x2() const; + Literal addF64x2(const Literal& other) const; + Literal subF64x2(const Literal& other) const; + Literal mulF64x2(const Literal& other) const; + Literal divF64x2(const Literal& other) const; + Literal minF64x2(const Literal& other) const; + Literal maxF64x2(const Literal& other) const; + Literal truncSatToSI32x4() const; + Literal truncSatToUI32x4() const; + Literal truncSatToSI64x2() const; + Literal truncSatToUI64x2() const; + Literal convertSToF32x4() const; + Literal convertUToF32x4() const; + Literal convertSToF64x2() const; + Literal convertUToF64x2() const; }; } // namespace wasm @@ -165,9 +323,16 @@ class Literal { namespace std { template<> struct hash { size_t operator()(const wasm::Literal& a) const { + uint8_t bytes[16] = {}; + a.getBits(bytes); + int64_t chunks[2]; + memcpy(chunks, bytes, sizeof(chunks)); return wasm::rehash( - uint64_t(hash()(size_t(a.type))), - uint64_t(hash()(a.getBits())) + wasm::rehash( + uint64_t(hash()(size_t(a.type))), + uint64_t(hash()(chunks[0])) + ), + uint64_t(hash()(chunks[1])) ); } }; @@ -175,7 +340,18 @@ template<> struct less { bool operator()(const wasm::Literal& a, const wasm::Literal& b) const { if (a.type < b.type) return true; if (a.type > b.type) return false; - return a.getBits() < b.getBits(); + switch (a.type) { + case wasm::Type::i32: return a.geti32() < b.geti32(); + case wasm::Type::f32: return a.getf32() < b.getf32(); + case wasm::Type::i64: return a.geti64() < b.geti64(); + case wasm::Type::f64: return b.getf64() < b.getf64(); + case wasm::Type::v128: { + return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0; + } + case wasm::Type::none: + case wasm::Type::unreachable: return false; + } + WASM_UNREACHABLE(); } }; } diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 7b9e64e431a..8298a0cc08a 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -28,6 +28,52 @@ namespace wasm { +template +using LaneArray = std::array; + +Literal::Literal(uint8_t init[16]) : type(Type::v128) { + memcpy(&v128, &init, 16); +} + +template +static void extract_bytes(uint8_t (&dest)[16], const LaneArray& lanes) { + std::array bytes; + const size_t lane_width = 16 / Lanes; + for (size_t lane_idx = 0; lane_idx < Lanes; ++lane_idx) { + uint8_t bits[16]; + lanes[lane_idx].getBits(bits); + LaneT lane; + memcpy(&lane, bits, sizeof(lane)); + for (size_t offset = 0; offset < lane_width; ++offset) { + bytes.at(lane_idx * lane_width + offset) = uint8_t(lane >> (8 * offset)); + } + } + memcpy(&dest, bytes.data(), sizeof(bytes)); +} + +Literal::Literal(const LaneArray<16>& lanes) : type(Type::v128) { + extract_bytes(v128, lanes); +} + +Literal::Literal(const LaneArray<8>& lanes) : type(Type::v128) { + extract_bytes(v128, lanes); +} + +Literal::Literal(const LaneArray<4>& lanes) : type(Type::v128) { + extract_bytes(v128, lanes); +} + +Literal::Literal(const LaneArray<2>& lanes) : type(Type::v128) { + extract_bytes(v128, lanes); +} + +std::array Literal::getv128() const { + assert(type == Type::v128); + std::array ret; + memcpy(ret.data(), v128, sizeof(ret)); + return ret; +} + Literal Literal::castToF32() { assert(type == Type::i32); Literal ret(i32); @@ -72,20 +118,25 @@ double Literal::getFloat() const { } } -int64_t Literal::getBits() const { +void Literal::getBits(uint8_t (&buf)[16]) 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(); + case Type::i32: + case Type::f32: memcpy(buf, &i32, sizeof(i32)); break; + case Type::i64: + case Type::f64: memcpy(buf, &i64, sizeof(i64)); break; + case Type::v128: memcpy(buf, &v128, sizeof(v128)); break; + case Type::none: + case Type::unreachable: WASM_UNREACHABLE(); } - WASM_UNREACHABLE(); } bool Literal::operator==(const Literal& other) const { if (type != other.type) return false; if (type == none) return true; - return getBits() == other.getBits(); + uint8_t bits[16] = {}, other_bits[16] = {}; + getBits(bits); + other.getBits(other_bits); + return memcmp(bits, other_bits, 16) == 0; } bool Literal::operator!=(const Literal& other) const { @@ -158,6 +209,15 @@ void Literal::printDouble(std::ostream& o, double d) { o << text; } +void Literal::printVec128(std::ostream& o, const std::array& v) { + o << std::hex; + for (auto i = 0; i < 16; ++i) { + o << uint32_t(v[i]); + if (i < 15) o << " "; + } + o << std::dec; +} + std::ostream& operator<<(std::ostream& o, Literal literal) { prepareMinorColor(o) << printType(literal.type) << ".const "; switch (literal.type) { @@ -166,7 +226,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::v128: literal.printVec128(o, literal.getv128()); break; case Type::unreachable: WASM_UNREACHABLE(); } restoreNormalColor(o); @@ -784,4 +844,516 @@ Literal Literal::copysign(const Literal& other) const { } } +template +static LaneArray getLanes(const Literal& val) { + assert(val.type == Type::v128); + const size_t lane_width = 16 / Lanes; + std::array bytes = val.getv128(); + LaneArray lanes; + for (size_t lane_idx = 0; lane_idx < Lanes; ++lane_idx) { + LaneT lane(0); + for (size_t offset = 0; offset < lane_width; ++offset) { + lane |= bytes.at(lane_idx * lane_width + offset) << (8 * offset); + } + lanes.at(lane_idx) = Literal(lane); + } + return lanes; +} + +LaneArray<16> Literal::getLanesSI8x16() const { + return getLanes(*this); +} +LaneArray<16> Literal::getLanesUI8x16() const { + return getLanes(*this); +} +LaneArray<8> Literal::getLanesSI16x8() const { + return getLanes(*this); +} +LaneArray<8> Literal::getLanesUI16x8() const { + return getLanes(*this); +} +LaneArray<4> Literal::getLanesI32x4() const { + return getLanes(*this); +} +LaneArray<2> Literal::getLanesI64x2() const { + return getLanes(*this); +} +LaneArray<4> Literal::getLanesF32x4() const { + auto lanes = getLanesI32x4(); + for (size_t i = 0; i < lanes.size(); ++i) { + lanes[i] = lanes[i].castToF32(); + } + return lanes; +} +LaneArray<2> Literal::getLanesF64x2() const { + auto lanes = getLanesI64x2(); + for (size_t i = 0; i < lanes.size(); ++i) { + lanes[i] = lanes[i].castToF64(); + } + return lanes; +} + +Literal Literal::shuffleV8x16(const Literal& other, const std::array& mask) const { + assert(type == Type::v128); + uint8_t bytes[16]; + for (size_t i = 0; i < mask.size(); ++i) { + bytes[i] = (mask[i] < 16) ? v128[i] : other.v128[i - 16]; + } + return Literal(bytes); +} + +template +static Literal splat(const Literal& val) { + assert(val.type == Ty); + LaneArray lanes; + lanes.fill(val); + return Literal(lanes); +} + +Literal Literal::splatI8x16() const { return splat(*this); } +Literal Literal::splatI16x8() const { return splat(*this); } +Literal Literal::splatI32x4() const { return splat(*this); } +Literal Literal::splatI64x2() const { return splat(*this); } +Literal Literal::splatF32x4() const { return splat(*this); } +Literal Literal::splatF64x2() const { return splat(*this); } + +Literal Literal::extractLaneSI8x16(uint8_t idx) const { return getLanesSI8x16().at(idx); } +Literal Literal::extractLaneUI8x16(uint8_t idx) const { return getLanesUI8x16().at(idx); } +Literal Literal::extractLaneSI16x8(uint8_t idx) const { return getLanesSI16x8().at(idx); } +Literal Literal::extractLaneUI16x8(uint8_t idx) const { return getLanesUI16x8().at(idx); } +Literal Literal::extractLaneI32x4(uint8_t idx) const { return getLanesI32x4().at(idx); } +Literal Literal::extractLaneI64x2(uint8_t idx) const { return getLanesI64x2().at(idx); } +Literal Literal::extractLaneF32x4(uint8_t idx) const { return getLanesF32x4().at(idx); } +Literal Literal::extractLaneF64x2(uint8_t idx) const { return getLanesF64x2().at(idx); } + +template (Literal::*IntoLanes)() const> +static Literal replace(const Literal& val, const Literal& other, uint8_t idx) { + LaneArray lanes = (val.*IntoLanes)(); + lanes.at(idx) = other; + auto ret = Literal(lanes); + return ret; +} + +Literal Literal::replaceLaneI8x16(const Literal& other, uint8_t idx) const { + return replace<16, &Literal::getLanesUI8x16>(*this, other, idx); +} +Literal Literal::replaceLaneI16x8(const Literal& other, uint8_t idx) const { + return replace<8, &Literal::getLanesUI16x8>(*this, other, idx); +} +Literal Literal::replaceLaneI32x4(const Literal& other, uint8_t idx) const { + return replace<4, &Literal::getLanesI32x4>(*this, other, idx); +} +Literal Literal::replaceLaneI64x2(const Literal& other, uint8_t idx) const { + return replace<2, &Literal::getLanesI64x2>(*this, other, idx); +} +Literal Literal::replaceLaneF32x4(const Literal& other, uint8_t idx) const { + return replace<4, &Literal::getLanesF32x4>(*this, other, idx); +} +Literal Literal::replaceLaneF64x2(const Literal& other, uint8_t idx) const { + return replace<2, &Literal::getLanesF64x2>(*this, other, idx); +} + +template (Literal::*IntoLanes)() const, + Literal (Literal::*BinaryOp)(const Literal&) const> +static Literal binary(const Literal& val, const Literal& other) { + LaneArray lanes = (val.*IntoLanes)(); + LaneArray other_lanes = (other.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + lanes[i] = (lanes[i].*BinaryOp)(other_lanes[i]); + } + return Literal(lanes); +} + +Literal Literal::eqI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::eq>(*this, other); +} +Literal Literal::neI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::ne>(*this, other); +} +Literal Literal::ltSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::ltS>(*this, other); +} +Literal Literal::ltUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::ltU>(*this, other); +} +Literal Literal::gtSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::gtS>(*this, other); +} +Literal Literal::gtUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::gtU>(*this, other); +} +Literal Literal::leSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::leS>(*this, other); +} +Literal Literal::leUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::leU>(*this, other); +} +Literal Literal::geSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::geS>(*this, other); +} +Literal Literal::geUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::geU>(*this, other); +} +Literal Literal::eqI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::eq>(*this, other); +} +Literal Literal::neI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::ne>(*this, other); +} +Literal Literal::ltSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::ltS>(*this, other); +} +Literal Literal::ltUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::ltU>(*this, other); +} +Literal Literal::gtSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::gtS>(*this, other); +} +Literal Literal::gtUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::gtU>(*this, other); +} +Literal Literal::leSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::leS>(*this, other); +} +Literal Literal::leUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::leU>(*this, other); +} +Literal Literal::geSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::geS>(*this, other); +} +Literal Literal::geUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::geU>(*this, other); +} +Literal Literal::eqI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::eq>(*this, other); +} +Literal Literal::neI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::ne>(*this, other); +} +Literal Literal::ltSI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::ltS>(*this, other); +} +Literal Literal::ltUI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::ltU>(*this, other); +} +Literal Literal::gtSI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::gtS>(*this, other); +} +Literal Literal::gtUI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::gtU>(*this, other); +} +Literal Literal::leSI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::leS>(*this, other); +} +Literal Literal::leUI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::leU>(*this, other); +} +Literal Literal::geSI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::geS>(*this, other); +} +Literal Literal::geUI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::geU>(*this, other); +} +Literal Literal::eqF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::eq>(*this, other); +} +Literal Literal::neF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::ne>(*this, other); +} +Literal Literal::ltF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::lt>(*this, other); +} +Literal Literal::gtF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::gt>(*this, other); +} +Literal Literal::leF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::le>(*this, other); +} +Literal Literal::geF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::ge>(*this, other); +} +Literal Literal::eqF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::eq>(*this, other); +} +Literal Literal::neF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::ne>(*this, other); +} +Literal Literal::ltF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::lt>(*this, other); +} +Literal Literal::gtF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::gt>(*this, other); +} +Literal Literal::leF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::le>(*this, other); +} +Literal Literal::geF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::ge>(*this, other); +} +Literal Literal::andV128(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::and_>(*this, other); +} +Literal Literal::orV128(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::or_>(*this, other); +} +Literal Literal::xorV128(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::xor_>(*this, other); +} +Literal Literal::addI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::add>(*this, other); +} +Literal Literal::subI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::sub>(*this, other); +} +Literal Literal::mulI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::mul>(*this, other); +} +Literal Literal::addI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::add>(*this, other); +} +Literal Literal::subI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::sub>(*this, other); +} +Literal Literal::mulI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::mul>(*this, other); +} +Literal Literal::addI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::add>(*this, other); +} +Literal Literal::subI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::sub>(*this, other); +} +Literal Literal::mulI32x4(const Literal& other) const { + return binary<4, &Literal::getLanesI32x4, &Literal::mul>(*this, other); +} +Literal Literal::addI64x2(const Literal& other) const { + return binary<2, &Literal::getLanesI64x2, &Literal::add>(*this, other); +} +Literal Literal::subI64x2(const Literal& other) const { + return binary<2, &Literal::getLanesI64x2, &Literal::sub>(*this, other); +} +Literal Literal::addF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::add>(*this, other); +} +Literal Literal::subF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::sub>(*this, other); +} +Literal Literal::mulF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::mul>(*this, other); +} +Literal Literal::divF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::div>(*this, other); +} +Literal Literal::minF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::min>(*this, other); +} +Literal Literal::maxF32x4(const Literal& other) const { + return binary<4, &Literal::getLanesF32x4, &Literal::max>(*this, other); +} +Literal Literal::addF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::add>(*this, other); +} +Literal Literal::subF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::sub>(*this, other); +} +Literal Literal::mulF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::mul>(*this, other); +} +Literal Literal::divF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::div>(*this, other); +} +Literal Literal::minF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::min>(*this, other); +} +Literal Literal::maxF64x2(const Literal& other) const { + return binary<2, &Literal::getLanesF64x2, &Literal::max>(*this, other); +} + +template (Literal::*IntoLanes)() const, + Literal (Literal::*UnaryOp)(void) const> +static Literal unary(const Literal& val) { + LaneArray lanes = (val.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + lanes[i] = (lanes[i].*UnaryOp)(); + } + return Literal(lanes); +} + +Literal Literal::notV128() const { + WASM_UNREACHABLE(); +} +Literal Literal::negI8x16() const { + return unary<16, &Literal::getLanesUI8x16, &Literal::neg>(*this); +} +Literal Literal::negI16x8() const { + return unary<8, &Literal::getLanesUI16x8, &Literal::neg>(*this); +} +Literal Literal::negI32x4() const { + return unary<4, &Literal::getLanesI32x4, &Literal::neg>(*this); +} +Literal Literal::negI64x2() const { + return unary<2, &Literal::getLanesI64x2, &Literal::neg>(*this); +} +Literal Literal::absF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::abs>(*this); +} +Literal Literal::negF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::neg>(*this); +} +Literal Literal::sqrtF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::sqrt>(*this); +} +Literal Literal::absF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::abs>(*this); +} +Literal Literal::negF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::neg>(*this); +} +Literal Literal::sqrtF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::sqrt>(*this); +} +Literal Literal::truncSatToSI32x4() const { + return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToSI32>(*this); +} +Literal Literal::truncSatToUI32x4() const { + return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToUI32>(*this); +} +Literal Literal::truncSatToSI64x2() const { + return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToSI64>(*this); +} +Literal Literal::truncSatToUI64x2() const { + return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToUI64>(*this); +} +Literal Literal::convertSToF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::convertSIToF32>(*this); +} +Literal Literal::convertUToF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::convertUIToF32>(*this); +} +Literal Literal::convertSToF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::convertSIToF64>(*this); +} +Literal Literal::convertUToF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::convertUIToF64>(*this); +} + +Literal Literal::bitselectV128(const Literal& left, const Literal& right) const { + WASM_UNREACHABLE(); +} + + + +Literal Literal::anyTrueI8x16() const { + WASM_UNREACHABLE(); +} + +Literal Literal::allTrueI8x16() const { + WASM_UNREACHABLE(); +} + +Literal Literal::shlI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrSI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrUI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::addSaturateSI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::addSaturateUI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::subSaturateSI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::subSaturateUI8x16(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::anyTrueI16x8() const { + WASM_UNREACHABLE(); +} + +Literal Literal::allTrueI16x8() const { + WASM_UNREACHABLE(); +} + +Literal Literal::shlI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrSI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrUI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::addSaturateSI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::addSaturateUI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::subSaturateSI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::subSaturateUI16x8(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::anyTrueI32x4() const { + WASM_UNREACHABLE(); +} + +Literal Literal::allTrueI32x4() const { + WASM_UNREACHABLE(); +} + +Literal Literal::shlI32x4(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrSI32x4(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrUI32x4(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::anyTrueI64x2() const { + WASM_UNREACHABLE(); +} + +Literal Literal::allTrueI64x2() const { + WASM_UNREACHABLE(); +} + +Literal Literal::shlI64x2(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrSI64x2(const Literal& other) const { + WASM_UNREACHABLE(); +} + +Literal Literal::shrUI64x2(const Literal& other) const { + WASM_UNREACHABLE(); +} + + } // namespace wasm From 874addf68f4ed2a4f1b8c051f6329471e0b364a8 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 3 Dec 2018 20:32:08 -0800 Subject: [PATCH 02/36] Move makeLiteralFromInt32 and makeLiteralZero to literal.h --- src/dataflow/graph.h | 2 +- src/ir/literal-utils.h | 23 +---------------------- src/literal.h | 21 +++++++++++++++++++++ src/passes/OptimizeInstructions.cpp | 8 ++++---- src/passes/Precompute.cpp | 2 +- src/passes/RedundantSetElimination.cpp | 2 +- src/tools/fuzzing.h | 6 +++--- src/tools/wasm-ctor-eval.cpp | 4 ++-- src/tools/wasm-reduce.cpp | 2 +- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/dataflow/graph.h b/src/dataflow/graph.h index 7f5654f8df7..29de8cf4f8f 100644 --- a/src/dataflow/graph.h +++ b/src/dataflow/graph.h @@ -153,7 +153,7 @@ struct Graph : public UnifiedExpressionVisitor { } Node* makeZero(wasm::Type type) { - return makeConst(LiteralUtils::makeLiteralZero(type)); + return makeConst(Literal::makeLiteralZero(type)); } // Add a new node to our list of owned nodes. diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h index b35b19a4099..32a28a4cb54 100644 --- a/src/ir/literal-utils.h +++ b/src/ir/literal-utils.h @@ -23,30 +23,9 @@ namespace wasm { namespace LiteralUtils { -inline Literal makeLiteralFromInt32(int32_t x, Type type) { - switch (type) { - case i32: return Literal(int32_t(x)); break; - case i64: return Literal(int64_t(x)); break; - case f32: return Literal(float(x)); break; - case f64: return Literal(double(x)); break; - case v128: return Literal( - std::array{ - Literal(x), Literal(int32_t(0)), Literal(int32_t(0)), Literal(int32_t(0)) - } - ); - case none: - case unreachable: WASM_UNREACHABLE(); - } - WASM_UNREACHABLE(); -} - -inline Literal makeLiteralZero(Type type) { - return makeLiteralFromInt32(0, type); -} - inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) { auto* ret = wasm.allocator.alloc(); - ret->value = makeLiteralFromInt32(x, type); + ret->value = Literal::makeLiteralFromInt32(x, type); ret->type = type; return ret; } diff --git a/src/literal.h b/src/literal.h index a54a0d0e30e..8104b21893b 100644 --- a/src/literal.h +++ b/src/literal.h @@ -57,6 +57,27 @@ class Literal { bool isConcrete() { return type != none; } bool isNull() { return type == none; } + inline static Literal makeLiteralFromInt32(int32_t x, Type type) { + switch (type) { + case Type::i32: return Literal(int32_t(x)); break; + case Type::i64: return Literal(int64_t(x)); break; + case Type::f32: return Literal(float(x)); break; + case Type::f64: return Literal(double(x)); break; + case Type::v128: return Literal( + std::array{ + Literal(x), Literal(int32_t(0)), Literal(int32_t(0)), Literal(int32_t(0)) + } + ); + case none: + case unreachable: WASM_UNREACHABLE(); + } + WASM_UNREACHABLE(); + } + + inline static Literal makeLiteralZero(Type type) { + return makeLiteralFromInt32(0, type); + } + Literal castToF32(); Literal castToF64(); Literal castToI32(); diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 1dd05dd0acd..21c9d1684ca 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -461,7 +461,7 @@ struct OptimizeInstructions : public WalkerPasstype)) { // no overflow, we can do this - leftRight->value = LiteralUtils::makeLiteralFromInt32(total, right->type); + leftRight->value = Literal::makeLiteralFromInt32(total, right->type); return left; } // TODO: handle overflows } @@ -1096,7 +1096,7 @@ struct OptimizeInstructions : public WalkerPassright->cast(); if (isIntegerType(type)) { // operations on zero - if (right->value == LiteralUtils::makeLiteralFromInt32(0, type)) { + if (right->value == Literal::makeLiteralFromInt32(0, type)) { if (binary->op == Abstract::getBinary(type, Abstract::Shl) || binary->op == Abstract::getBinary(type, Abstract::ShrU) || binary->op == Abstract::getBinary(type, Abstract::ShrS) || @@ -1152,7 +1152,7 @@ struct OptimizeInstructions : public WalkerPassvalue == LiteralUtils::makeLiteralFromInt32(1, type)) { + if (right->value == Literal::makeLiteralFromInt32(1, type)) { if (binary->op == Abstract::getBinary(type, Abstract::Mul) || binary->op == Abstract::getBinary(type, Abstract::DivS) || binary->op == Abstract::getBinary(type, Abstract::DivU)) { @@ -1171,7 +1171,7 @@ struct OptimizeInstructions : public WalkerPassleft->cast(); if (isIntegerType(type)) { // operations on zero - if (left->value == LiteralUtils::makeLiteralFromInt32(0, type)) { + if (left->value == Literal::makeLiteralFromInt32(0, type)) { if ((binary->op == Abstract::getBinary(type, Abstract::Shl) || binary->op == Abstract::getBinary(type, Abstract::ShrU) || binary->op == Abstract::getBinary(type, Abstract::ShrS)) && diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index db34b9ffbda..ff1eb0ab5fc 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -297,7 +297,7 @@ struct Precompute : public WalkerPassisVar(get->index)) { - curr = LiteralUtils::makeLiteralZero(getFunction()->getLocalType(get->index)); + curr = Literal::makeLiteralZero(getFunction()->getLocalType(get->index)); } else { // it's a param, so it's hopeless value = Literal(); diff --git a/src/passes/RedundantSetElimination.cpp b/src/passes/RedundantSetElimination.cpp index 8c00a0880d5..6b4a2f5dafe 100644 --- a/src/passes/RedundantSetElimination.cpp +++ b/src/passes/RedundantSetElimination.cpp @@ -172,7 +172,7 @@ struct RedundantSetElimination : public WalkerPassgetLocalType(i))); + start[i] = getLiteralValue(Literal::makeLiteralZero(func->getLocalType(i))); } } } else { diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 243616c8a16..9bffed47216 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -1268,10 +1268,10 @@ class TranslateToFuzzReader { } // tweak around special values if (oneIn(3)) { // +- 1 - value = value.add(LiteralUtils::makeLiteralFromInt32(upTo(3) - 1, type)); + value = value.add(Literal::makeLiteralFromInt32(upTo(3) - 1, type)); } if (oneIn(2)) { // flip sign - value = value.mul(LiteralUtils::makeLiteralFromInt32(-1, type)); + value = value.mul(Literal::makeLiteralFromInt32(-1, type)); } break; } @@ -1288,7 +1288,7 @@ class TranslateToFuzzReader { } // maybe negative if (oneIn(2)) { - value = value.mul(LiteralUtils::makeLiteralFromInt32(-1, type)); + value = value.mul(Literal::makeLiteralFromInt32(-1, type)); } } } diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index b0e2e2ce7d8..950f3733858 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -195,12 +195,12 @@ struct CtorEvalExternalInterface : EvallingModuleInstance::ExternalInterface { // fill in fake values for everything else, which is dangerous to use ModuleUtils::iterDefinedGlobals(wasm_, [&](Global* defined) { if (globals.find(defined->name) == globals.end()) { - globals[defined->name] = LiteralUtils::makeLiteralZero(defined->type); + globals[defined->name] = Literal::makeLiteralZero(defined->type); } }); ModuleUtils::iterImportedGlobals(wasm_, [&](Global* import) { if (globals.find(import->name) == globals.end()) { - globals[import->name] = LiteralUtils::makeLiteralZero(import->type); + globals[import->name] = Literal::makeLiteralZero(import->type); } }); } diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 8c5df7a1b15..65930ce31a7 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -839,7 +839,7 @@ struct Reducer : public WalkerPassmakeConst(Literal(int32_t(0))); if (tryToReplaceCurrent(c)) return true; - c->value = LiteralUtils::makeLiteralFromInt32(1, curr->type); + c->value = Literal::makeLiteralFromInt32(1, curr->type); c->type = curr->type; return tryToReplaceCurrent(c); } From 19b44ed0bde297adefd71f0cadde19d15cac9269 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 3 Dec 2018 20:36:22 -0800 Subject: [PATCH 03/36] Finish implementing SIMD literal ops --- src/literal.h | 10 + src/wasm/literal.cpp | 424 ++++++++++++++++++++++++------------------- 2 files changed, 244 insertions(+), 190 deletions(-) diff --git a/src/literal.h b/src/literal.h index 8104b21893b..c84cf3a61cb 100644 --- a/src/literal.h +++ b/src/literal.h @@ -337,6 +337,16 @@ class Literal { Literal convertUToF32x4() const; Literal convertSToF64x2() const; Literal convertUToF64x2() const; + + private: + Literal addSatSI8(const Literal& other) const; + Literal addSatUI8(const Literal& other) const; + Literal addSatSI16(const Literal& other) const; + Literal addSatUI16(const Literal& other) const; + Literal subSatSI8(const Literal& other) const; + Literal subSatUI8(const Literal& other) const; + Literal subSatSI16(const Literal& other) const; + Literal subSatUI16(const Literal& other) const; }; } // namespace wasm diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 8298a0cc08a..c98b4ad9dcf 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -28,14 +28,14 @@ namespace wasm { -template +template using LaneArray = std::array; Literal::Literal(uint8_t init[16]) : type(Type::v128) { memcpy(&v128, &init, 16); } -template +template static void extract_bytes(uint8_t (&dest)[16], const LaneArray& lanes) { std::array bytes; const size_t lane_width = 16 / Lanes; @@ -510,6 +510,43 @@ Literal Literal::sub(const Literal& other) const { WASM_UNREACHABLE(); } +template +static Literal sat_arith(const Literal& val, const Literal& other) { + assert(val.type == Type::i32 && other.type == Type::i32); + Literal sum = val.add(other); + if (sum.geti32() > std::numeric_limits::max()) { + return Literal(std::numeric_limits::max()); + } else if (sum.geti32() < std::numeric_limits::min()) { + return Literal(std::numeric_limits::min()); + } + return sum; +} + +Literal Literal::addSatSI8(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::addSatUI8(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::addSatSI16(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::addSatUI16(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::subSatSI8(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::subSatUI8(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::subSatSI16(const Literal& other) const { + return sat_arith(*this, other); +} +Literal Literal::subSatUI16(const Literal& other) const { + return sat_arith(*this, other); +} + Literal Literal::mul(const Literal& other) const { switch (type) { case Type::i32: return Literal(uint32_t(i32) * uint32_t(other.i32)); @@ -844,7 +881,7 @@ Literal Literal::copysign(const Literal& other) const { } } -template +template static LaneArray getLanes(const Literal& val) { assert(val.type == Type::v128); const size_t lane_width = 16 / Lanes; @@ -902,7 +939,7 @@ Literal Literal::shuffleV8x16(const Literal& other, const std::array +template static Literal splat(const Literal& val) { assert(val.type == Ty); LaneArray lanes; @@ -926,7 +963,7 @@ Literal Literal::extractLaneI64x2(uint8_t idx) const { return getLanesI64x2().at Literal Literal::extractLaneF32x4(uint8_t idx) const { return getLanesF32x4().at(idx); } Literal Literal::extractLaneF64x2(uint8_t idx) const { return getLanesF64x2().at(idx); } -template (Literal::*IntoLanes)() const> +template (Literal::*IntoLanes)() const> static Literal replace(const Literal& val, const Literal& other, uint8_t idx) { LaneArray lanes = (val.*IntoLanes)(); lanes.at(idx) = other; @@ -953,7 +990,173 @@ Literal Literal::replaceLaneF64x2(const Literal& other, uint8_t idx) const { return replace<2, &Literal::getLanesF64x2>(*this, other, idx); } -template (Literal::*IntoLanes)() const, +template (Literal::*IntoLanes)() const, + Literal (Literal::*UnaryOp)(void) const> +static Literal unary(const Literal& val) { + LaneArray lanes = (val.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + lanes[i] = (lanes[i].*UnaryOp)(); + } + return Literal(lanes); +} + +Literal Literal::notV128() const { + std::array ones; + ones.fill(0xff); + return xorV128(Literal(ones.data())); +} +Literal Literal::negI8x16() const { + return unary<16, &Literal::getLanesUI8x16, &Literal::neg>(*this); +} +Literal Literal::negI16x8() const { + return unary<8, &Literal::getLanesUI16x8, &Literal::neg>(*this); +} +Literal Literal::negI32x4() const { + return unary<4, &Literal::getLanesI32x4, &Literal::neg>(*this); +} +Literal Literal::negI64x2() const { + return unary<2, &Literal::getLanesI64x2, &Literal::neg>(*this); +} +Literal Literal::absF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::abs>(*this); +} +Literal Literal::negF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::neg>(*this); +} +Literal Literal::sqrtF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::sqrt>(*this); +} +Literal Literal::absF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::abs>(*this); +} +Literal Literal::negF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::neg>(*this); +} +Literal Literal::sqrtF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::sqrt>(*this); +} +Literal Literal::truncSatToSI32x4() const { + return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToSI32>(*this); +} +Literal Literal::truncSatToUI32x4() const { + return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToUI32>(*this); +} +Literal Literal::truncSatToSI64x2() const { + return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToSI64>(*this); +} +Literal Literal::truncSatToUI64x2() const { + return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToUI64>(*this); +} +Literal Literal::convertSToF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::convertSIToF32>(*this); +} +Literal Literal::convertUToF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::convertUIToF32>(*this); +} +Literal Literal::convertSToF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::convertSIToF64>(*this); +} +Literal Literal::convertUToF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::convertUIToF64>(*this); +} + +template (Literal::*IntoLanes)() const> +static Literal any_true(const Literal& val) { + LaneArray lanes = (val.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + if (lanes[i] != Literal::makeLiteralZero(lanes[i].type)) { + return Literal(int32_t(1)); + } + } + return Literal(int32_t(0)); +} + +template (Literal::*IntoLanes)() const> +static Literal all_true(const Literal& val) { + LaneArray lanes = (val.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + if (lanes[i] == Literal::makeLiteralZero(lanes[i].type)) { + return Literal(int32_t(0)); + } + } + return Literal(int32_t(1)); +} + +Literal Literal::anyTrueI8x16() const { + return any_true<16, &Literal::getLanesUI8x16>(*this); +} +Literal Literal::allTrueI8x16() const { + return all_true<16, &Literal::getLanesUI8x16>(*this); +} +Literal Literal::anyTrueI16x8() const { + return any_true<8, &Literal::getLanesUI16x8>(*this); +} +Literal Literal::allTrueI16x8() const { + return all_true<8, &Literal::getLanesUI16x8>(*this); +} +Literal Literal::anyTrueI32x4() const { + return any_true<4, &Literal::getLanesI32x4>(*this); +} +Literal Literal::allTrueI32x4() const { + return all_true<4, &Literal::getLanesI32x4>(*this); +} +Literal Literal::anyTrueI64x2() const { + return any_true<2, &Literal::getLanesI64x2>(*this); +} +Literal Literal::allTrueI64x2() const { + return all_true<2, &Literal::getLanesI64x2>(*this); +} + +template (Literal::*IntoLanes)() const, + Literal (Literal::*ShiftOp)(const Literal&) const> +static Literal shift(const Literal& val, const Literal& other) { + assert(other.type == Type::i32); + LaneArray lanes = (val.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + lanes[i] = (lanes[i].*ShiftOp)(other); + } + return Literal(lanes); +} + +Literal Literal::shlI8x16(const Literal& other) const { + return shift<16, &Literal::getLanesUI8x16, &Literal::shl>(*this, other); +} +Literal Literal::shrSI8x16(const Literal& other) const { + return shift<16, &Literal::getLanesSI8x16, &Literal::shrS>(*this, other); +} +Literal Literal::shrUI8x16(const Literal& other) const { + return shift<16, &Literal::getLanesUI8x16, &Literal::shrU>(*this, other); +} +Literal Literal::shlI16x8(const Literal& other) const { + return shift<8, &Literal::getLanesUI16x8, &Literal::shl>(*this, other); +} +Literal Literal::shrSI16x8(const Literal& other) const { + return shift<8, &Literal::getLanesSI16x8, &Literal::shrS>(*this, other); +} +Literal Literal::shrUI16x8(const Literal& other) const { + return shift<8, &Literal::getLanesUI16x8, &Literal::shrU>(*this, other); +} +Literal Literal::shlI32x4(const Literal& other) const { + return shift<4, &Literal::getLanesI32x4, &Literal::shl>(*this, other); +} +Literal Literal::shrSI32x4(const Literal& other) const { + return shift<4, &Literal::getLanesI32x4, &Literal::shrS>(*this, other); +} +Literal Literal::shrUI32x4(const Literal& other) const { + return shift<4, &Literal::getLanesI32x4, &Literal::shrU>(*this, other); +} +Literal Literal::shlI64x2(const Literal& other) const { + return shift<2, &Literal::getLanesI64x2, &Literal::shl>(*this, other); +} +Literal Literal::shrSI64x2(const Literal& other) const { + return shift<2, &Literal::getLanesI64x2, &Literal::shrS>(*this, other); +} +Literal Literal::shrUI64x2(const Literal& other) const { + return shift<2, &Literal::getLanesI64x2, &Literal::shrU>(*this, other); +} + + +template (Literal::*IntoLanes)() const, Literal (Literal::*BinaryOp)(const Literal&) const> static Literal binary(const Literal& val, const Literal& other) { LaneArray lanes = (val.*IntoLanes)(); @@ -1102,18 +1305,42 @@ Literal Literal::xorV128(const Literal& other) const { Literal Literal::addI8x16(const Literal& other) const { return binary<16, &Literal::getLanesUI8x16, &Literal::add>(*this, other); } +Literal Literal::addSaturateSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::addSatSI8>(*this, other); +} +Literal Literal::addSaturateUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::addSatUI8>(*this, other); +} Literal Literal::subI8x16(const Literal& other) const { return binary<16, &Literal::getLanesUI8x16, &Literal::sub>(*this, other); } +Literal Literal::subSaturateSI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesUI8x16, &Literal::subSatSI8>(*this, other); +} +Literal Literal::subSaturateUI8x16(const Literal& other) const { + return binary<16, &Literal::getLanesSI8x16, &Literal::subSatUI8>(*this, other); +} Literal Literal::mulI8x16(const Literal& other) const { return binary<16, &Literal::getLanesUI8x16, &Literal::mul>(*this, other); } Literal Literal::addI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::add>(*this, other); } +Literal Literal::addSaturateSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::addSatSI16>(*this, other); +} +Literal Literal::addSaturateUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::addSatUI16>(*this, other); +} Literal Literal::subI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::sub>(*this, other); } +Literal Literal::subSaturateSI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesUI16x8, &Literal::subSatSI16>(*this, other); +} +Literal Literal::subSaturateUI16x8(const Literal& other) const { + return binary<8, &Literal::getLanesSI16x8, &Literal::subSatUI16>(*this, other); +} Literal Literal::mulI16x8(const Literal& other) const { return binary<8, &Literal::getLanesUI16x8, &Literal::mul>(*this, other); } @@ -1169,191 +1396,8 @@ Literal Literal::maxF64x2(const Literal& other) const { return binary<2, &Literal::getLanesF64x2, &Literal::max>(*this, other); } -template (Literal::*IntoLanes)() const, - Literal (Literal::*UnaryOp)(void) const> -static Literal unary(const Literal& val) { - LaneArray lanes = (val.*IntoLanes)(); - for (size_t i = 0; i < Lanes; ++i) { - lanes[i] = (lanes[i].*UnaryOp)(); - } - return Literal(lanes); -} - -Literal Literal::notV128() const { - WASM_UNREACHABLE(); -} -Literal Literal::negI8x16() const { - return unary<16, &Literal::getLanesUI8x16, &Literal::neg>(*this); -} -Literal Literal::negI16x8() const { - return unary<8, &Literal::getLanesUI16x8, &Literal::neg>(*this); -} -Literal Literal::negI32x4() const { - return unary<4, &Literal::getLanesI32x4, &Literal::neg>(*this); -} -Literal Literal::negI64x2() const { - return unary<2, &Literal::getLanesI64x2, &Literal::neg>(*this); -} -Literal Literal::absF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::abs>(*this); -} -Literal Literal::negF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::neg>(*this); -} -Literal Literal::sqrtF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::sqrt>(*this); -} -Literal Literal::absF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::abs>(*this); -} -Literal Literal::negF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::neg>(*this); -} -Literal Literal::sqrtF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::sqrt>(*this); -} -Literal Literal::truncSatToSI32x4() const { - return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToSI32>(*this); -} -Literal Literal::truncSatToUI32x4() const { - return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToUI32>(*this); -} -Literal Literal::truncSatToSI64x2() const { - return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToSI64>(*this); -} -Literal Literal::truncSatToUI64x2() const { - return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToUI64>(*this); -} -Literal Literal::convertSToF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::convertSIToF32>(*this); -} -Literal Literal::convertUToF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::convertUIToF32>(*this); -} -Literal Literal::convertSToF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::convertSIToF64>(*this); -} -Literal Literal::convertUToF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::convertUIToF64>(*this); -} - Literal Literal::bitselectV128(const Literal& left, const Literal& right) const { - WASM_UNREACHABLE(); -} - - - -Literal Literal::anyTrueI8x16() const { - WASM_UNREACHABLE(); -} - -Literal Literal::allTrueI8x16() const { - WASM_UNREACHABLE(); -} - -Literal Literal::shlI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrSI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrUI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::addSaturateSI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::addSaturateUI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::subSaturateSI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::subSaturateUI8x16(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::anyTrueI16x8() const { - WASM_UNREACHABLE(); -} - -Literal Literal::allTrueI16x8() const { - WASM_UNREACHABLE(); -} - -Literal Literal::shlI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrSI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrUI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::addSaturateSI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::addSaturateUI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::subSaturateSI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::subSaturateUI16x8(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::anyTrueI32x4() const { - WASM_UNREACHABLE(); -} - -Literal Literal::allTrueI32x4() const { - WASM_UNREACHABLE(); -} - -Literal Literal::shlI32x4(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrSI32x4(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrUI32x4(const Literal& other) const { - WASM_UNREACHABLE(); + return andV128(left).orV128(notV128().andV128(right)); } -Literal Literal::anyTrueI64x2() const { - WASM_UNREACHABLE(); -} - -Literal Literal::allTrueI64x2() const { - WASM_UNREACHABLE(); -} - -Literal Literal::shlI64x2(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrSI64x2(const Literal& other) const { - WASM_UNREACHABLE(); -} - -Literal Literal::shrUI64x2(const Literal& other) const { - WASM_UNREACHABLE(); -} - - } // namespace wasm From b2f5c56c67d47281c8c20d7a4843327e747ec102 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 3 Dec 2018 22:22:10 -0800 Subject: [PATCH 04/36] Implement lots of SIMD visitors all over the place --- scripts/gen-s-parser.py | 143 +- src/gen-s-parser.inc | 2852 ++++++++++++++++++---------- src/ir/ExpressionAnalyzer.cpp | 64 + src/ir/ReFinalize.cpp | 6 +- src/ir/cost.h | 109 ++ src/ir/utils.h | 10 + src/passes/DeadCodeElimination.cpp | 5 + src/passes/Print.cpp | 259 ++- src/wasm-binary.h | 160 +- src/wasm-builder.h | 7 +- src/wasm-interpreter.h | 196 +- src/wasm-s-parser.h | 5 + src/wasm-stack.h | 211 +- src/wasm-traversal.h | 60 + src/wasm.h | 111 +- src/wasm/wasm-binary.cpp | 299 ++- src/wasm/wasm-s-parser.cpp | 62 + src/wasm/wasm-validator.cpp | 232 ++- src/wasm/wasm.cpp | 88 + 19 files changed, 3806 insertions(+), 1073 deletions(-) diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index f33107ea633..daf3c03a657 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -268,6 +268,147 @@ ("i64.trunc_u:sat/f32", "makeUnary(s, UnaryOp::TruncSatUFloat32ToInt64)"), ("i64.trunc_s:sat/f64", "makeUnary(s, UnaryOp::TruncSatSFloat64ToInt64)"), ("i64.trunc_u:sat/f64", "makeUnary(s, UnaryOp::TruncSatUFloat64ToInt64)"), + # SIMD ops + ("v128.load", "makeLoad(s, v128, /*isAtomic=*/false)"), + ("v128.store", "makeStore(s, v128, /*isAtomic=*/false)"), + ("v128.const", "makeConst(s, v128)"), + ("v8x16.shuffle", "makeSIMDShuffle(s)"), + ("i8x16.splat", "makeUnary(s, UnaryOp::SplatVecI8x16)"), + ("i8x16.extract_lane_s", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneSVecI8x16, 16)"), + ("i8x16.extract_lane_u", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneUVecI8x16, 16)"), + ("i8x16.replace_lane", "makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI8x16, 16)"), + ("i16x8.splat", "makeUnary(s, UnaryOp::SplatVecI16x8)"), + ("i16x8.extract_lane_s", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneSVecI16x8, 8)"), + ("i16x8.extract_lane_u", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneUVecI16x8, 8)"), + ("i16x8.replace_lane", "makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI16x8, 8)"), + ("i32x4.splat", "makeUnary(s, UnaryOp::SplatVecI32x4)"), + ("i32x4.extract_lane", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecI32x4, 4)"), + ("i32x4.replace_lane", "makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI32x4, 4)"), + ("i64x2.splat", "makeUnary(s, UnaryOp::SplatVecI64x2)"), + ("i64x2.extract_lane", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecI64x2, 2)"), + ("i64x2.replace_lane", "makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI64x2, 2)"), + ("f32x4.splat", "makeUnary(s, UnaryOp::SplatVecF32x4)"), + ("f32x4.extract_lane", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecF32x4, 4)"), + ("f32x4.replace_lane", "makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecF32x4, 4)"), + ("f64x2.splat", "makeUnary(s, UnaryOp::SplatVecF64x2)"), + ("f64x2.extract_lane", "makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecF64x2, 2)"), + ("f64x2.replace_lane", "makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecF64x2, 2)"), + ("i8x16.eq", "makeBinary(s, BinaryOp::EqVecI8x16)"), + ("i8x16.ne", "makeBinary(s, BinaryOp::NeVecI8x16)"), + ("i8x16.lt_s", "makeBinary(s, BinaryOp::LtSVecI8x16)"), + ("i8x16.lt_u", "makeBinary(s, BinaryOp::LtUVecI8x16)"), + ("i8x16.gt_s", "makeBinary(s, BinaryOp::LeSVecI8x16)"), + ("i8x16.gt_u", "makeBinary(s, BinaryOp::LeUVecI8x16)"), + ("i8x16.le_s", "makeBinary(s, BinaryOp::GtSVecI8x16)"), + ("i8x16.le_u", "makeBinary(s, BinaryOp::GtUVecI8x16)"), + ("i8x16.ge_s", "makeBinary(s, BinaryOp::GeSVecI8x16)"), + ("i8x16.ge_u", "makeBinary(s, BinaryOp::GeUVecI8x16)"), + ("i16x8.eq", "makeBinary(s, BinaryOp::EqVecI16x8)"), + ("i16x8.ne", "makeBinary(s, BinaryOp::NeVecI16x8)"), + ("i16x8.lt_s", "makeBinary(s, BinaryOp::LtSVecI16x8)"), + ("i16x8.lt_u", "makeBinary(s, BinaryOp::LtUVecI16x8)"), + ("i16x8.gt_s", "makeBinary(s, BinaryOp::LeSVecI16x8)"), + ("i16x8.gt_u", "makeBinary(s, BinaryOp::LeUVecI16x8)"), + ("i16x8.le_s", "makeBinary(s, BinaryOp::GtSVecI16x8)"), + ("i16x8.le_u", "makeBinary(s, BinaryOp::GtUVecI16x8)"), + ("i16x8.ge_s", "makeBinary(s, BinaryOp::GeSVecI16x8)"), + ("i16x8.ge_u", "makeBinary(s, BinaryOp::GeUVecI16x8)"), + ("i32x4.eq", "makeBinary(s, BinaryOp::EqVecI32x4)"), + ("i32x4.ne", "makeBinary(s, BinaryOp::NeVecI32x4)"), + ("i32x4.lt_s", "makeBinary(s, BinaryOp::LtSVecI32x4)"), + ("i32x4.lt_u", "makeBinary(s, BinaryOp::LtUVecI32x4)"), + ("i32x4.gt_s", "makeBinary(s, BinaryOp::LeSVecI32x4)"), + ("i32x4.gt_u", "makeBinary(s, BinaryOp::LeUVecI32x4)"), + ("i32x4.le_s", "makeBinary(s, BinaryOp::GtSVecI32x4)"), + ("i32x4.le_u", "makeBinary(s, BinaryOp::GtUVecI32x4)"), + ("i32x4.ge_s", "makeBinary(s, BinaryOp::GeSVecI32x4)"), + ("i32x4.ge_u", "makeBinary(s, BinaryOp::GeUVecI32x4)"), + ("f32x4.eq", "makeBinary(s, BinaryOp::EqVecF32x4)"), + ("f32x4.ne", "makeBinary(s, BinaryOp::NeVecF32x4)"), + ("f32x4.lt", "makeBinary(s, BinaryOp::LtVecF32x4)"), + ("f32x4.gt", "makeBinary(s, BinaryOp::LeVecF32x4)"), + ("f32x4.le", "makeBinary(s, BinaryOp::GtVecF32x4)"), + ("f32x4.ge", "makeBinary(s, BinaryOp::GeVecF32x4)"), + ("f64x2.eq", "makeBinary(s, BinaryOp::EqVecF64x2)"), + ("f64x2.ne", "makeBinary(s, BinaryOp::NeVecF64x2)"), + ("f64x2.lt", "makeBinary(s, BinaryOp::LtVecF64x2)"), + ("f64x2.gt", "makeBinary(s, BinaryOp::LeVecF64x2)"), + ("f64x2.le", "makeBinary(s, BinaryOp::GtVecF64x2)"), + ("f64x2.ge", "makeBinary(s, BinaryOp::GeVecF64x2)"), + ("v128.not", "makeUnary(s, UnaryOp::NotVec128)"), + ("v128.and", "makeBinary(s, BinaryOp::AndVec128)"), + ("v128.or", "makeBinary(s, BinaryOp::OrVec128)"), + ("v128.xor", "makeBinary(s, BinaryOp::XorVec128)"), + ("v128.bitselect", "makeSIMDBitselect(s)"), + ("i8x16.neg", "makeUnary(s, UnaryOp::NegVecI8x16)"), + ("i8x16.any_true", "makeUnary(s, UnaryOp::AnyTrueVecI8x16)"), + ("i8x16.all_true", "makeUnary(s, UnaryOp::AllTrueVecI8x16)"), + ("i8x16.shl", "makeSIMDShift(s, SIMDShiftOp::ShlVecI8x16)"), + ("i8x16.shr_s", "makeSIMDShift(s, SIMDShiftOp::ShrSVecI8x16)"), + ("i8x16.shr_u", "makeSIMDShift(s, SIMDShiftOp::ShrUVecI8x16)"), + ("i8x16.add", "makeBinary(s, BinaryOp::AddVecI8x16)"), + ("i8x16.add_saturate_s", "makeBinary(s, BinaryOp::AddSatSVecI8x16)"), + ("i8x16.add_saturate_u", "makeBinary(s, BinaryOp::AddSatUVecI8x16)"), + ("i8x16.sub", "makeBinary(s, BinaryOp::SubVecI8x16)"), + ("i8x16.sub_saturate_s", "makeBinary(s, BinaryOp::SubSatSVecI8x16)"), + ("i8x16.sub_saturate_u", "makeBinary(s, BinaryOp::SubSatUVecI8x16)"), + ("i8x16.mul", "makeBinary(s, BinaryOp::MulVecI8x16)"), + ("i16x8.neg", "makeUnary(s, UnaryOp::NegVecI16x8)"), + ("i16x8.any_true", "makeUnary(s, UnaryOp::AnyTrueVecI16x8)"), + ("i16x8.all_true", "makeUnary(s, UnaryOp::AllTrueVecI16x8)"), + ("i16x8.shl", "makeSIMDShift(s, SIMDShiftOp::ShlVecI16x8)"), + ("i16x8.shr_s", "makeSIMDShift(s, SIMDShiftOp::ShrSVecI16x8)"), + ("i16x8.shr_u", "makeSIMDShift(s, SIMDShiftOp::ShrUVecI16x8)"), + ("i16x8.add", "makeBinary(s, BinaryOp::AddVecI16x8)"), + ("i16x8.add_saturate_s", "makeBinary(s, BinaryOp::AddSatSVecI16x8)"), + ("i16x8.add_saturate_u", "makeBinary(s, BinaryOp::AddSatUVecI16x8)"), + ("i16x8.sub", "makeBinary(s, BinaryOp::SubVecI16x8)"), + ("i16x8.sub_saturate_s", "makeBinary(s, BinaryOp::SubSatSVecI16x8)"), + ("i16x8.sub_saturate_u", "makeBinary(s, BinaryOp::SubSatUVecI16x8)"), + ("i16x8.mul", "makeBinary(s, BinaryOp::MulVecI16x8)"), + ("i32x4.neg", "makeUnary(s, UnaryOp::NegVecI32x4)"), + ("i32x4.any_true", "makeUnary(s, UnaryOp::AnyTrueVecI32x4)"), + ("i32x4.all_true", "makeUnary(s, UnaryOp::AllTrueVecI32x4)"), + ("i32x4.shl", "makeSIMDShift(s, SIMDShiftOp::ShlVecI32x4)"), + ("i32x4.shr_s", "makeSIMDShift(s, SIMDShiftOp::ShrSVecI32x4)"), + ("i32x4.shr_u", "makeSIMDShift(s, SIMDShiftOp::ShrUVecI32x4)"), + ("i32x4.add", "makeBinary(s, BinaryOp::AddVecI32x4)"), + ("i32x4.sub", "makeBinary(s, BinaryOp::SubVecI32x4)"), + ("i32x4.mul", "makeBinary(s, BinaryOp::MulVecI32x4)"), + ("i64x2.neg", "makeUnary(s, UnaryOp::NegVecI64x2)"), + ("i64x2.any_true", "makeUnary(s, UnaryOp::AnyTrueVecI64x2)"), + ("i64x2.all_true", "makeUnary(s, UnaryOp::AllTrueVecI64x2)"), + ("i64x2.shl", "makeSIMDShift(s, SIMDShiftOp::ShlVecI64x2)"), + ("i64x2.shr_s", "makeSIMDShift(s, SIMDShiftOp::ShrSVecI64x2)"), + ("i64x2.shr_u", "makeSIMDShift(s, SIMDShiftOp::ShrUVecI64x2)"), + ("i64x2.add", "makeBinary(s, BinaryOp::AddVecI64x2)"), + ("i64x2.sub", "makeBinary(s, BinaryOp::SubVecI64x2)"), + ("f32x4.abs", "makeUnary(s, UnaryOp::AbsVecF32x4)"), + ("f32x4.neg", "makeUnary(s, UnaryOp::NegVecF32x4)"), + ("f32x4.sqrt", "makeUnary(s, UnaryOp::SqrtVecF32x4)"), + ("f32x4.add", "makeBinary(s, BinaryOp::AddVecF32x4)"), + ("f32x4.sub", "makeBinary(s, BinaryOp::SubVecF32x4)"), + ("f32x4.mul", "makeBinary(s, BinaryOp::MulVecF32x4)"), + ("f32x4.div", "makeBinary(s, BinaryOp::DivVecF32x4)"), + ("f32x4.min", "makeBinary(s, BinaryOp::MinVecF32x4)"), + ("f32x4.max", "makeBinary(s, BinaryOp::MaxVecF32x4)"), + ("f64x2.abs", "makeUnary(s, UnaryOp::AbsVecF64x2)"), + ("f64x2.neg", "makeUnary(s, UnaryOp::NegVecF64x2)"), + ("f64x2.sqrt", "makeUnary(s, UnaryOp::SqrtVecF64x2)"), + ("f64x2.add", "makeBinary(s, BinaryOp::AddVecF64x2)"), + ("f64x2.sub", "makeBinary(s, BinaryOp::SubVecF64x2)"), + ("f64x2.mul", "makeBinary(s, BinaryOp::MulVecF64x2)"), + ("f64x2.div", "makeBinary(s, BinaryOp::DivVecF64x2)"), + ("f64x2.min", "makeBinary(s, BinaryOp::MinVecF64x2)"), + ("f64x2.max", "makeBinary(s, BinaryOp::MaxVecF64x2)"), + ("i32x4.trunc_s/f32x4:sat", "makeUnary(s, UnaryOp::TruncSatSVecF32x4ToVecI32x4)"), + ("i32x4.trunc_u/f32x4:sat", "makeUnary(s, UnaryOp::TruncSatUVecF32x4ToVecI32x4)"), + ("i64x2.trunc_s/f64x2:sat", "makeUnary(s, UnaryOp::TruncSatSVecF64x2ToVecI64x2)"), + ("i64x2.trunc_u/f64x2:sat", "makeUnary(s, UnaryOp::TruncSatUVecF64x2ToVecI64x2)"), + ("f32x4.convert_s/i32x4", "makeUnary(s, UnaryOp::ConvertSVecI32x4ToVecF32x4)"), + ("f32x4.convert_u/i32x4", "makeUnary(s, UnaryOp::ConvertUVecI32x4ToVecF32x4)"), + ("f64x2.convert_s/i64x2", "makeUnary(s, UnaryOp::ConvertSVecI64x2ToVecF64x2)"), + ("f64x2.convert_u/i64x2", "makeUnary(s, UnaryOp::ConvertUVecI64x2ToVecF64x2)") ] @@ -308,7 +449,7 @@ def _common_prefix(a, b): def do_insert(self, full_inst, inst, expr): if inst is "": - assert self.expr is None, "Repeated instruction" + assert self.expr is None, "Repeated instruction " + full_inst self.expr = expr self.inst = full_inst return diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index 16399bfba7b..daa296d2520 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -60,211 +60,1303 @@ switch (op[0]) { case 'f': { switch (op[1]) { case '3': { - switch (op[4]) { - case 'a': { - switch (op[5]) { - case 'b': - if (strcmp(op, "f32.abs") == 0) return makeUnary(s, UnaryOp::AbsFloat32); - goto parse_error; - case 'd': - if (strcmp(op, "f32.add") == 0) return makeBinary(s, BinaryOp::AddFloat32); - goto parse_error; - default: goto parse_error; - } - } - case 'c': { - switch (op[5]) { - case 'e': - if (strcmp(op, "f32.ceil") == 0) return makeUnary(s, UnaryOp::CeilFloat32); - goto parse_error; - case 'o': { - switch (op[6]) { - case 'n': { - switch (op[7]) { - case 's': - if (strcmp(op, "f32.const") == 0) return makeConst(s, f32); - goto parse_error; - case 'v': { - switch (op[12]) { - case 's': { - switch (op[15]) { - case '3': - if (strcmp(op, "f32.convert_s/i32") == 0) return makeUnary(s, UnaryOp::ConvertSInt32ToFloat32); - goto parse_error; - case '6': - if (strcmp(op, "f32.convert_s/i64") == 0) return makeUnary(s, UnaryOp::ConvertSInt64ToFloat32); - goto parse_error; - default: goto parse_error; - } - } - case 'u': { - switch (op[15]) { - case '3': - if (strcmp(op, "f32.convert_u/i32") == 0) return makeUnary(s, UnaryOp::ConvertUInt32ToFloat32); - goto parse_error; - case '6': - if (strcmp(op, "f32.convert_u/i64") == 0) return makeUnary(s, UnaryOp::ConvertUInt64ToFloat32); - goto parse_error; + switch (op[3]) { + case '.': { + switch (op[4]) { + case 'a': { + switch (op[5]) { + case 'b': + if (strcmp(op, "f32.abs") == 0) return makeUnary(s, UnaryOp::AbsFloat32); + goto parse_error; + case 'd': + if (strcmp(op, "f32.add") == 0) return makeBinary(s, BinaryOp::AddFloat32); + goto parse_error; + default: goto parse_error; + } + } + case 'c': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f32.ceil") == 0) return makeUnary(s, UnaryOp::CeilFloat32); + goto parse_error; + case 'o': { + switch (op[6]) { + case 'n': { + switch (op[7]) { + case 's': + if (strcmp(op, "f32.const") == 0) return makeConst(s, f32); + goto parse_error; + case 'v': { + switch (op[12]) { + case 's': { + switch (op[15]) { + case '3': + if (strcmp(op, "f32.convert_s/i32") == 0) return makeUnary(s, UnaryOp::ConvertSInt32ToFloat32); + goto parse_error; + case '6': + if (strcmp(op, "f32.convert_s/i64") == 0) return makeUnary(s, UnaryOp::ConvertSInt64ToFloat32); + goto parse_error; + default: goto parse_error; + } + } + case 'u': { + switch (op[15]) { + case '3': + if (strcmp(op, "f32.convert_u/i32") == 0) return makeUnary(s, UnaryOp::ConvertUInt32ToFloat32); + goto parse_error; + case '6': + if (strcmp(op, "f32.convert_u/i64") == 0) return makeUnary(s, UnaryOp::ConvertUInt64ToFloat32); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } default: goto parse_error; } } + case 'p': + if (strcmp(op, "f32.copysign") == 0) return makeBinary(s, BinaryOp::CopySignFloat32); + goto parse_error; default: goto parse_error; } } - case 'p': - if (strcmp(op, "f32.copysign") == 0) return makeBinary(s, BinaryOp::CopySignFloat32); + default: goto parse_error; + } + } + case 'd': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f32.demote/f64") == 0) return makeUnary(s, UnaryOp::DemoteFloat64); + goto parse_error; + case 'i': + if (strcmp(op, "f32.div") == 0) return makeBinary(s, BinaryOp::DivFloat32); goto parse_error; default: goto parse_error; } } - default: goto parse_error; - } - } - case 'd': { - switch (op[5]) { case 'e': - if (strcmp(op, "f32.demote/f64") == 0) return makeUnary(s, UnaryOp::DemoteFloat64); + if (strcmp(op, "f32.eq") == 0) return makeBinary(s, BinaryOp::EqFloat32); goto parse_error; - case 'i': - if (strcmp(op, "f32.div") == 0) return makeBinary(s, BinaryOp::DivFloat32); + case 'f': + if (strcmp(op, "f32.floor") == 0) return makeUnary(s, UnaryOp::FloorFloat32); goto parse_error; - default: goto parse_error; - } - } - case 'e': - if (strcmp(op, "f32.eq") == 0) return makeBinary(s, BinaryOp::EqFloat32); - goto parse_error; - case 'f': - if (strcmp(op, "f32.floor") == 0) return makeUnary(s, UnaryOp::FloorFloat32); - goto parse_error; - case 'g': { - switch (op[5]) { - case 'e': - if (strcmp(op, "f32.ge") == 0) return makeBinary(s, BinaryOp::GeFloat32); + case 'g': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f32.ge") == 0) return makeBinary(s, BinaryOp::GeFloat32); + goto parse_error; + case 't': + if (strcmp(op, "f32.gt") == 0) return makeBinary(s, BinaryOp::GtFloat32); + goto parse_error; + default: goto parse_error; + } + } + case 'l': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f32.le") == 0) return makeBinary(s, BinaryOp::LeFloat32); + goto parse_error; + case 'o': + if (strcmp(op, "f32.load") == 0) return makeLoad(s, f32, /*isAtomic=*/false); + goto parse_error; + case 't': + if (strcmp(op, "f32.lt") == 0) return makeBinary(s, BinaryOp::LtFloat32); + goto parse_error; + default: goto parse_error; + } + } + case 'm': { + switch (op[5]) { + case 'a': + if (strcmp(op, "f32.max") == 0) return makeBinary(s, BinaryOp::MaxFloat32); + goto parse_error; + case 'i': + if (strcmp(op, "f32.min") == 0) return makeBinary(s, BinaryOp::MinFloat32); + goto parse_error; + case 'u': + if (strcmp(op, "f32.mul") == 0) return makeBinary(s, BinaryOp::MulFloat32); + goto parse_error; + default: goto parse_error; + } + } + case 'n': { + switch (op[6]) { + case '\0': + if (strcmp(op, "f32.ne") == 0) return makeBinary(s, BinaryOp::NeFloat32); + goto parse_error; + case 'a': + if (strcmp(op, "f32.nearest") == 0) return makeUnary(s, UnaryOp::NearestFloat32); + goto parse_error; + case 'g': + if (strcmp(op, "f32.neg") == 0) return makeUnary(s, UnaryOp::NegFloat32); + goto parse_error; + default: goto parse_error; + } + } + case 'r': + if (strcmp(op, "f32.reinterpret/i32") == 0) return makeUnary(s, UnaryOp::ReinterpretInt32); goto parse_error; + case 's': { + switch (op[5]) { + case 'q': + if (strcmp(op, "f32.sqrt") == 0) return makeUnary(s, UnaryOp::SqrtFloat32); + goto parse_error; + case 't': + if (strcmp(op, "f32.store") == 0) return makeStore(s, f32, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "f32.sub") == 0) return makeBinary(s, BinaryOp::SubFloat32); + goto parse_error; + default: goto parse_error; + } + } case 't': - if (strcmp(op, "f32.gt") == 0) return makeBinary(s, BinaryOp::GtFloat32); + if (strcmp(op, "f32.trunc") == 0) return makeUnary(s, UnaryOp::TruncFloat32); goto parse_error; default: goto parse_error; } } - case 'l': { - switch (op[5]) { - case 'e': - if (strcmp(op, "f32.le") == 0) return makeBinary(s, BinaryOp::LeFloat32); - goto parse_error; - case 'o': - if (strcmp(op, "f32.load") == 0) return makeLoad(s, f32, /*isAtomic=*/false); + case 'x': { + switch (op[6]) { + case 'a': { + switch (op[7]) { + case 'b': + if (strcmp(op, "f32x4.abs") == 0) return makeUnary(s, UnaryOp::AbsVecF32x4); + goto parse_error; + case 'd': + if (strcmp(op, "f32x4.add") == 0) return makeBinary(s, BinaryOp::AddVecF32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'c': { + switch (op[14]) { + case 's': + if (strcmp(op, "f32x4.convert_s/i32x4") == 0) return makeUnary(s, UnaryOp::ConvertSVecI32x4ToVecF32x4); + goto parse_error; + case 'u': + if (strcmp(op, "f32x4.convert_u/i32x4") == 0) return makeUnary(s, UnaryOp::ConvertUVecI32x4ToVecF32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'd': + if (strcmp(op, "f32x4.div") == 0) return makeBinary(s, BinaryOp::DivVecF32x4); goto parse_error; - case 't': - if (strcmp(op, "f32.lt") == 0) return makeBinary(s, BinaryOp::LtFloat32); + case 'e': { + switch (op[7]) { + case 'q': + if (strcmp(op, "f32x4.eq") == 0) return makeBinary(s, BinaryOp::EqVecF32x4); + goto parse_error; + case 'x': + if (strcmp(op, "f32x4.extract_lane") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecF32x4, 4); + goto parse_error; + default: goto parse_error; + } + } + case 'g': { + switch (op[7]) { + case 'e': + if (strcmp(op, "f32x4.ge") == 0) return makeBinary(s, BinaryOp::GeVecF32x4); + goto parse_error; + case 't': + if (strcmp(op, "f32x4.gt") == 0) return makeBinary(s, BinaryOp::LeVecF32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'l': { + switch (op[7]) { + case 'e': + if (strcmp(op, "f32x4.le") == 0) return makeBinary(s, BinaryOp::GtVecF32x4); + goto parse_error; + case 't': + if (strcmp(op, "f32x4.lt") == 0) return makeBinary(s, BinaryOp::LtVecF32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'm': { + switch (op[7]) { + case 'a': + if (strcmp(op, "f32x4.max") == 0) return makeBinary(s, BinaryOp::MaxVecF32x4); + goto parse_error; + case 'i': + if (strcmp(op, "f32x4.min") == 0) return makeBinary(s, BinaryOp::MinVecF32x4); + goto parse_error; + case 'u': + if (strcmp(op, "f32x4.mul") == 0) return makeBinary(s, BinaryOp::MulVecF32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'n': { + switch (op[8]) { + case '\0': + if (strcmp(op, "f32x4.ne") == 0) return makeBinary(s, BinaryOp::NeVecF32x4); + goto parse_error; + case 'g': + if (strcmp(op, "f32x4.neg") == 0) return makeUnary(s, UnaryOp::NegVecF32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'r': + if (strcmp(op, "f32x4.replace_lane") == 0) return makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecF32x4, 4); goto parse_error; + case 's': { + switch (op[7]) { + case 'p': + if (strcmp(op, "f32x4.splat") == 0) return makeUnary(s, UnaryOp::SplatVecF32x4); + goto parse_error; + case 'q': + if (strcmp(op, "f32x4.sqrt") == 0) return makeUnary(s, UnaryOp::SqrtVecF32x4); + goto parse_error; + case 'u': + if (strcmp(op, "f32x4.sub") == 0) return makeBinary(s, BinaryOp::SubVecF32x4); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } - case 'm': { - switch (op[5]) { - case 'a': - if (strcmp(op, "f32.max") == 0) return makeBinary(s, BinaryOp::MaxFloat32); - goto parse_error; - case 'i': - if (strcmp(op, "f32.min") == 0) return makeBinary(s, BinaryOp::MinFloat32); - goto parse_error; - case 'u': - if (strcmp(op, "f32.mul") == 0) return makeBinary(s, BinaryOp::MulFloat32); + default: goto parse_error; + } + } + case '6': { + switch (op[3]) { + case '.': { + switch (op[4]) { + case 'a': { + switch (op[5]) { + case 'b': + if (strcmp(op, "f64.abs") == 0) return makeUnary(s, UnaryOp::AbsFloat64); + goto parse_error; + case 'd': + if (strcmp(op, "f64.add") == 0) return makeBinary(s, BinaryOp::AddFloat64); + goto parse_error; + default: goto parse_error; + } + } + case 'c': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f64.ceil") == 0) return makeUnary(s, UnaryOp::CeilFloat64); + goto parse_error; + case 'o': { + switch (op[6]) { + case 'n': { + switch (op[7]) { + case 's': + if (strcmp(op, "f64.const") == 0) return makeConst(s, f64); + goto parse_error; + case 'v': { + switch (op[12]) { + case 's': { + switch (op[15]) { + case '3': + if (strcmp(op, "f64.convert_s/i32") == 0) return makeUnary(s, UnaryOp::ConvertSInt32ToFloat64); + goto parse_error; + case '6': + if (strcmp(op, "f64.convert_s/i64") == 0) return makeUnary(s, UnaryOp::ConvertSInt64ToFloat64); + goto parse_error; + default: goto parse_error; + } + } + case 'u': { + switch (op[15]) { + case '3': + if (strcmp(op, "f64.convert_u/i32") == 0) return makeUnary(s, UnaryOp::ConvertUInt32ToFloat64); + goto parse_error; + case '6': + if (strcmp(op, "f64.convert_u/i64") == 0) return makeUnary(s, UnaryOp::ConvertUInt64ToFloat64); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'p': + if (strcmp(op, "f64.copysign") == 0) return makeBinary(s, BinaryOp::CopySignFloat64); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'd': + if (strcmp(op, "f64.div") == 0) return makeBinary(s, BinaryOp::DivFloat64); goto parse_error; - default: goto parse_error; - } - } - case 'n': { - switch (op[6]) { - case '\0': - if (strcmp(op, "f32.ne") == 0) return makeBinary(s, BinaryOp::NeFloat32); + case 'e': + if (strcmp(op, "f64.eq") == 0) return makeBinary(s, BinaryOp::EqFloat64); goto parse_error; - case 'a': - if (strcmp(op, "f32.nearest") == 0) return makeUnary(s, UnaryOp::NearestFloat32); + case 'f': + if (strcmp(op, "f64.floor") == 0) return makeUnary(s, UnaryOp::FloorFloat64); goto parse_error; - case 'g': - if (strcmp(op, "f32.neg") == 0) return makeUnary(s, UnaryOp::NegFloat32); + case 'g': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f64.ge") == 0) return makeBinary(s, BinaryOp::GeFloat64); + goto parse_error; + case 't': + if (strcmp(op, "f64.gt") == 0) return makeBinary(s, BinaryOp::GtFloat64); + goto parse_error; + default: goto parse_error; + } + } + case 'l': { + switch (op[5]) { + case 'e': + if (strcmp(op, "f64.le") == 0) return makeBinary(s, BinaryOp::LeFloat64); + goto parse_error; + case 'o': + if (strcmp(op, "f64.load") == 0) return makeLoad(s, f64, /*isAtomic=*/false); + goto parse_error; + case 't': + if (strcmp(op, "f64.lt") == 0) return makeBinary(s, BinaryOp::LtFloat64); + goto parse_error; + default: goto parse_error; + } + } + case 'm': { + switch (op[5]) { + case 'a': + if (strcmp(op, "f64.max") == 0) return makeBinary(s, BinaryOp::MaxFloat64); + goto parse_error; + case 'i': + if (strcmp(op, "f64.min") == 0) return makeBinary(s, BinaryOp::MinFloat64); + goto parse_error; + case 'u': + if (strcmp(op, "f64.mul") == 0) return makeBinary(s, BinaryOp::MulFloat64); + goto parse_error; + default: goto parse_error; + } + } + case 'n': { + switch (op[6]) { + case '\0': + if (strcmp(op, "f64.ne") == 0) return makeBinary(s, BinaryOp::NeFloat64); + goto parse_error; + case 'a': + if (strcmp(op, "f64.nearest") == 0) return makeUnary(s, UnaryOp::NearestFloat64); + goto parse_error; + case 'g': + if (strcmp(op, "f64.neg") == 0) return makeUnary(s, UnaryOp::NegFloat64); + goto parse_error; + default: goto parse_error; + } + } + case 'p': + if (strcmp(op, "f64.promote/f32") == 0) return makeUnary(s, UnaryOp::PromoteFloat32); goto parse_error; - default: goto parse_error; - } - } - case 'r': - if (strcmp(op, "f32.reinterpret/i32") == 0) return makeUnary(s, UnaryOp::ReinterpretInt32); - goto parse_error; - case 's': { - switch (op[5]) { - case 'q': - if (strcmp(op, "f32.sqrt") == 0) return makeUnary(s, UnaryOp::SqrtFloat32); + case 'r': + if (strcmp(op, "f64.reinterpret/i64") == 0) return makeUnary(s, UnaryOp::ReinterpretInt64); goto parse_error; + case 's': { + switch (op[5]) { + case 'q': + if (strcmp(op, "f64.sqrt") == 0) return makeUnary(s, UnaryOp::SqrtFloat64); + goto parse_error; + case 't': + if (strcmp(op, "f64.store") == 0) return makeStore(s, f64, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "f64.sub") == 0) return makeBinary(s, BinaryOp::SubFloat64); + goto parse_error; + default: goto parse_error; + } + } case 't': - if (strcmp(op, "f32.store") == 0) return makeStore(s, f32, /*isAtomic=*/false); - goto parse_error; - case 'u': - if (strcmp(op, "f32.sub") == 0) return makeBinary(s, BinaryOp::SubFloat32); + if (strcmp(op, "f64.trunc") == 0) return makeUnary(s, UnaryOp::TruncFloat64); goto parse_error; default: goto parse_error; } } - case 't': - if (strcmp(op, "f32.trunc") == 0) return makeUnary(s, UnaryOp::TruncFloat32); - goto parse_error; - default: goto parse_error; - } - } - case '6': { - switch (op[4]) { - case 'a': { - switch (op[5]) { - case 'b': - if (strcmp(op, "f64.abs") == 0) return makeUnary(s, UnaryOp::AbsFloat64); - goto parse_error; + case 'x': { + switch (op[6]) { + case 'a': { + switch (op[7]) { + case 'b': + if (strcmp(op, "f64x2.abs") == 0) return makeUnary(s, UnaryOp::AbsVecF64x2); + goto parse_error; + case 'd': + if (strcmp(op, "f64x2.add") == 0) return makeBinary(s, BinaryOp::AddVecF64x2); + goto parse_error; + default: goto parse_error; + } + } + case 'c': { + switch (op[14]) { + case 's': + if (strcmp(op, "f64x2.convert_s/i64x2") == 0) return makeUnary(s, UnaryOp::ConvertSVecI64x2ToVecF64x2); + goto parse_error; + case 'u': + if (strcmp(op, "f64x2.convert_u/i64x2") == 0) return makeUnary(s, UnaryOp::ConvertUVecI64x2ToVecF64x2); + goto parse_error; + default: goto parse_error; + } + } case 'd': - if (strcmp(op, "f64.add") == 0) return makeBinary(s, BinaryOp::AddFloat64); + if (strcmp(op, "f64x2.div") == 0) return makeBinary(s, BinaryOp::DivVecF64x2); + goto parse_error; + case 'e': { + switch (op[7]) { + case 'q': + if (strcmp(op, "f64x2.eq") == 0) return makeBinary(s, BinaryOp::EqVecF64x2); + goto parse_error; + case 'x': + if (strcmp(op, "f64x2.extract_lane") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecF64x2, 2); + goto parse_error; + default: goto parse_error; + } + } + case 'g': { + switch (op[7]) { + case 'e': + if (strcmp(op, "f64x2.ge") == 0) return makeBinary(s, BinaryOp::GeVecF64x2); + goto parse_error; + case 't': + if (strcmp(op, "f64x2.gt") == 0) return makeBinary(s, BinaryOp::LeVecF64x2); + goto parse_error; + default: goto parse_error; + } + } + case 'l': { + switch (op[7]) { + case 'e': + if (strcmp(op, "f64x2.le") == 0) return makeBinary(s, BinaryOp::GtVecF64x2); + goto parse_error; + case 't': + if (strcmp(op, "f64x2.lt") == 0) return makeBinary(s, BinaryOp::LtVecF64x2); + goto parse_error; + default: goto parse_error; + } + } + case 'm': { + switch (op[7]) { + case 'a': + if (strcmp(op, "f64x2.max") == 0) return makeBinary(s, BinaryOp::MaxVecF64x2); + goto parse_error; + case 'i': + if (strcmp(op, "f64x2.min") == 0) return makeBinary(s, BinaryOp::MinVecF64x2); + goto parse_error; + case 'u': + if (strcmp(op, "f64x2.mul") == 0) return makeBinary(s, BinaryOp::MulVecF64x2); + goto parse_error; + default: goto parse_error; + } + } + case 'n': { + switch (op[8]) { + case '\0': + if (strcmp(op, "f64x2.ne") == 0) return makeBinary(s, BinaryOp::NeVecF64x2); + goto parse_error; + case 'g': + if (strcmp(op, "f64x2.neg") == 0) return makeUnary(s, UnaryOp::NegVecF64x2); + goto parse_error; + default: goto parse_error; + } + } + case 'r': + if (strcmp(op, "f64x2.replace_lane") == 0) return makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecF64x2, 2); + goto parse_error; + case 's': { + switch (op[7]) { + case 'p': + if (strcmp(op, "f64x2.splat") == 0) return makeUnary(s, UnaryOp::SplatVecF64x2); + goto parse_error; + case 'q': + if (strcmp(op, "f64x2.sqrt") == 0) return makeUnary(s, UnaryOp::SqrtVecF64x2); + goto parse_error; + case 'u': + if (strcmp(op, "f64x2.sub") == 0) return makeBinary(s, BinaryOp::SubVecF64x2); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'g': { + switch (op[1]) { + case 'e': { + switch (op[4]) { + case 'g': + if (strcmp(op, "get_global") == 0) return makeGetGlobal(s); + goto parse_error; + case 'l': + if (strcmp(op, "get_local") == 0) return makeGetLocal(s); + goto parse_error; + default: goto parse_error; + } + } + case 'r': + if (strcmp(op, "grow_memory") == 0) return makeHost(s, HostOp::GrowMemory); + goto parse_error; + default: goto parse_error; + } + } + case 'i': { + switch (op[1]) { + case '1': { + switch (op[6]) { + case 'a': { + switch (op[7]) { + case 'd': { + switch (op[9]) { + case '\0': + if (strcmp(op, "i16x8.add") == 0) return makeBinary(s, BinaryOp::AddVecI16x8); + goto parse_error; + case '_': { + switch (op[19]) { + case 's': + if (strcmp(op, "i16x8.add_saturate_s") == 0) return makeBinary(s, BinaryOp::AddSatSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.add_saturate_u") == 0) return makeBinary(s, BinaryOp::AddSatUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'l': + if (strcmp(op, "i16x8.all_true") == 0) return makeUnary(s, UnaryOp::AllTrueVecI16x8); + goto parse_error; + case 'n': + if (strcmp(op, "i16x8.any_true") == 0) return makeUnary(s, UnaryOp::AnyTrueVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + case 'e': { + switch (op[7]) { + case 'q': + if (strcmp(op, "i16x8.eq") == 0) return makeBinary(s, BinaryOp::EqVecI16x8); + goto parse_error; + case 'x': { + switch (op[19]) { + case 's': + if (strcmp(op, "i16x8.extract_lane_s") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneSVecI16x8, 8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.extract_lane_u") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneUVecI16x8, 8); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'g': { + switch (op[7]) { + case 'e': { + switch (op[9]) { + case 's': + if (strcmp(op, "i16x8.ge_s") == 0) return makeBinary(s, BinaryOp::GeSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.ge_u") == 0) return makeBinary(s, BinaryOp::GeUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[9]) { + case 's': + if (strcmp(op, "i16x8.gt_s") == 0) return makeBinary(s, BinaryOp::LeSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.gt_u") == 0) return makeBinary(s, BinaryOp::LeUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'l': { + switch (op[7]) { + case 'e': { + switch (op[9]) { + case 's': + if (strcmp(op, "i16x8.le_s") == 0) return makeBinary(s, BinaryOp::GtSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.le_u") == 0) return makeBinary(s, BinaryOp::GtUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[9]) { + case 's': + if (strcmp(op, "i16x8.lt_s") == 0) return makeBinary(s, BinaryOp::LtSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.lt_u") == 0) return makeBinary(s, BinaryOp::LtUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'm': + if (strcmp(op, "i16x8.mul") == 0) return makeBinary(s, BinaryOp::MulVecI16x8); + goto parse_error; + case 'n': { + switch (op[8]) { + case '\0': + if (strcmp(op, "i16x8.ne") == 0) return makeBinary(s, BinaryOp::NeVecI16x8); + goto parse_error; + case 'g': + if (strcmp(op, "i16x8.neg") == 0) return makeUnary(s, UnaryOp::NegVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + case 'r': + if (strcmp(op, "i16x8.replace_lane") == 0) return makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI16x8, 8); + goto parse_error; + case 's': { + switch (op[7]) { + case 'h': { + switch (op[8]) { + case 'l': + if (strcmp(op, "i16x8.shl") == 0) return makeSIMDShift(s, SIMDShiftOp::ShlVecI16x8); + goto parse_error; + case 'r': { + switch (op[10]) { + case 's': + if (strcmp(op, "i16x8.shr_s") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.shr_u") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'p': + if (strcmp(op, "i16x8.splat") == 0) return makeUnary(s, UnaryOp::SplatVecI16x8); + goto parse_error; + case 'u': { + switch (op[9]) { + case '\0': + if (strcmp(op, "i16x8.sub") == 0) return makeBinary(s, BinaryOp::SubVecI16x8); + goto parse_error; + case '_': { + switch (op[19]) { + case 's': + if (strcmp(op, "i16x8.sub_saturate_s") == 0) return makeBinary(s, BinaryOp::SubSatSVecI16x8); + goto parse_error; + case 'u': + if (strcmp(op, "i16x8.sub_saturate_u") == 0) return makeBinary(s, BinaryOp::SubSatUVecI16x8); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case '3': { + switch (op[3]) { + case '.': { + switch (op[4]) { + case 'a': { + switch (op[5]) { + case 'd': + if (strcmp(op, "i32.add") == 0) return makeBinary(s, BinaryOp::AddInt32); + goto parse_error; + case 'n': + if (strcmp(op, "i32.and") == 0) return makeBinary(s, BinaryOp::AndInt32); + goto parse_error; + case 't': { + switch (op[11]) { + case 'l': { + switch (op[15]) { + case '\0': + if (strcmp(op, "i32.atomic.load") == 0) return makeLoad(s, i32, /*isAtomic=*/true); + goto parse_error; + case '1': + if (strcmp(op, "i32.atomic.load16_u") == 0) return makeLoad(s, i32, /*isAtomic=*/true); + goto parse_error; + case '8': + if (strcmp(op, "i32.atomic.load8_u") == 0) return makeLoad(s, i32, /*isAtomic=*/true); + goto parse_error; + default: goto parse_error; + } + } + case 'r': { + switch (op[14]) { + case '.': { + switch (op[15]) { + case 'a': { + switch (op[16]) { + case 'd': + if (strcmp(op, "i32.atomic.rmw.add") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'n': + if (strcmp(op, "i32.atomic.rmw.and") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + default: goto parse_error; + } + } + case 'c': + if (strcmp(op, "i32.atomic.rmw.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.atomic.rmw.or") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 's': + if (strcmp(op, "i32.atomic.rmw.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'x': { + switch (op[16]) { + case 'c': + if (strcmp(op, "i32.atomic.rmw.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.atomic.rmw.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case '1': { + switch (op[19]) { + case 'a': { + switch (op[20]) { + case 'd': + if (strcmp(op, "i32.atomic.rmw16_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'n': + if (strcmp(op, "i32.atomic.rmw16_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + default: goto parse_error; + } + } + case 'c': + if (strcmp(op, "i32.atomic.rmw16_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.atomic.rmw16_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 's': + if (strcmp(op, "i32.atomic.rmw16_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'x': { + switch (op[20]) { + case 'c': + if (strcmp(op, "i32.atomic.rmw16_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.atomic.rmw16_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case '8': { + switch (op[18]) { + case 'a': { + switch (op[19]) { + case 'd': + if (strcmp(op, "i32.atomic.rmw8_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'n': + if (strcmp(op, "i32.atomic.rmw8_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + default: goto parse_error; + } + } + case 'c': + if (strcmp(op, "i32.atomic.rmw8_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.atomic.rmw8_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 's': + if (strcmp(op, "i32.atomic.rmw8_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'x': { + switch (op[19]) { + case 'c': + if (strcmp(op, "i32.atomic.rmw8_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.atomic.rmw8_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 's': { + switch (op[16]) { + case '\0': + if (strcmp(op, "i32.atomic.store") == 0) return makeStore(s, i32, /*isAtomic=*/true); + goto parse_error; + case '1': + if (strcmp(op, "i32.atomic.store16") == 0) return makeStore(s, i32, /*isAtomic=*/true); + goto parse_error; + case '8': + if (strcmp(op, "i32.atomic.store8") == 0) return makeStore(s, i32, /*isAtomic=*/true); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'c': { + switch (op[5]) { + case 'l': + if (strcmp(op, "i32.clz") == 0) return makeUnary(s, UnaryOp::ClzInt32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.const") == 0) return makeConst(s, i32); + goto parse_error; + case 't': + if (strcmp(op, "i32.ctz") == 0) return makeUnary(s, UnaryOp::CtzInt32); + goto parse_error; + default: goto parse_error; + } + } + case 'd': { + switch (op[8]) { + case 's': + if (strcmp(op, "i32.div_s") == 0) return makeBinary(s, BinaryOp::DivSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.div_u") == 0) return makeBinary(s, BinaryOp::DivUInt32); + goto parse_error; + default: goto parse_error; + } + } + case 'e': { + switch (op[5]) { + case 'q': { + switch (op[6]) { + case '\0': + if (strcmp(op, "i32.eq") == 0) return makeBinary(s, BinaryOp::EqInt32); + goto parse_error; + case 'z': + if (strcmp(op, "i32.eqz") == 0) return makeUnary(s, UnaryOp::EqZInt32); + goto parse_error; + default: goto parse_error; + } + } + case 'x': { + switch (op[10]) { + case '1': + if (strcmp(op, "i32.extend16_s") == 0) return makeUnary(s, UnaryOp::ExtendS16Int32); + goto parse_error; + case '8': + if (strcmp(op, "i32.extend8_s") == 0) return makeUnary(s, UnaryOp::ExtendS8Int32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'g': { + switch (op[5]) { + case 'e': { + switch (op[7]) { + case 's': + if (strcmp(op, "i32.ge_s") == 0) return makeBinary(s, BinaryOp::GeSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.ge_u") == 0) return makeBinary(s, BinaryOp::GeUInt32); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[7]) { + case 's': + if (strcmp(op, "i32.gt_s") == 0) return makeBinary(s, BinaryOp::GtSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.gt_u") == 0) return makeBinary(s, BinaryOp::GtUInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'l': { + switch (op[5]) { + case 'e': { + switch (op[7]) { + case 's': + if (strcmp(op, "i32.le_s") == 0) return makeBinary(s, BinaryOp::LeSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.le_u") == 0) return makeBinary(s, BinaryOp::LeUInt32); + goto parse_error; + default: goto parse_error; + } + } + case 'o': { + switch (op[8]) { + case '\0': + if (strcmp(op, "i32.load") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + goto parse_error; + case '1': { + switch (op[11]) { + case 's': + if (strcmp(op, "i32.load16_s") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "i32.load16_u") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + goto parse_error; + default: goto parse_error; + } + } + case '8': { + switch (op[10]) { + case 's': + if (strcmp(op, "i32.load8_s") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "i32.load8_u") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 't': { + switch (op[7]) { + case 's': + if (strcmp(op, "i32.lt_s") == 0) return makeBinary(s, BinaryOp::LtSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.lt_u") == 0) return makeBinary(s, BinaryOp::LtUInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'm': + if (strcmp(op, "i32.mul") == 0) return makeBinary(s, BinaryOp::MulInt32); + goto parse_error; + case 'n': + if (strcmp(op, "i32.ne") == 0) return makeBinary(s, BinaryOp::NeInt32); + goto parse_error; + case 'o': + if (strcmp(op, "i32.or") == 0) return makeBinary(s, BinaryOp::OrInt32); + goto parse_error; + case 'p': + if (strcmp(op, "i32.popcnt") == 0) return makeUnary(s, UnaryOp::PopcntInt32); + goto parse_error; + case 'r': { + switch (op[5]) { + case 'e': { + switch (op[6]) { + case 'i': + if (strcmp(op, "i32.reinterpret/f32") == 0) return makeUnary(s, UnaryOp::ReinterpretFloat32); + goto parse_error; + case 'm': { + switch (op[8]) { + case 's': + if (strcmp(op, "i32.rem_s") == 0) return makeBinary(s, BinaryOp::RemSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.rem_u") == 0) return makeBinary(s, BinaryOp::RemUInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'o': { + switch (op[7]) { + case 'l': + if (strcmp(op, "i32.rotl") == 0) return makeBinary(s, BinaryOp::RotLInt32); + goto parse_error; + case 'r': + if (strcmp(op, "i32.rotr") == 0) return makeBinary(s, BinaryOp::RotRInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 's': { + switch (op[5]) { + case 'h': { + switch (op[6]) { + case 'l': + if (strcmp(op, "i32.shl") == 0) return makeBinary(s, BinaryOp::ShlInt32); + goto parse_error; + case 'r': { + switch (op[8]) { + case 's': + if (strcmp(op, "i32.shr_s") == 0) return makeBinary(s, BinaryOp::ShrSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i32.shr_u") == 0) return makeBinary(s, BinaryOp::ShrUInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 't': { + switch (op[9]) { + case '\0': + if (strcmp(op, "i32.store") == 0) return makeStore(s, i32, /*isAtomic=*/false); + goto parse_error; + case '1': + if (strcmp(op, "i32.store16") == 0) return makeStore(s, i32, /*isAtomic=*/false); + goto parse_error; + case '8': + if (strcmp(op, "i32.store8") == 0) return makeStore(s, i32, /*isAtomic=*/false); + goto parse_error; + default: goto parse_error; + } + } + case 'u': + if (strcmp(op, "i32.sub") == 0) return makeBinary(s, BinaryOp::SubInt32); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[10]) { + case 's': { + switch (op[11]) { + case '/': { + switch (op[13]) { + case '3': + if (strcmp(op, "i32.trunc_s/f32") == 0) return makeUnary(s, UnaryOp::TruncSFloat32ToInt32); + goto parse_error; + case '6': + if (strcmp(op, "i32.trunc_s/f64") == 0) return makeUnary(s, UnaryOp::TruncSFloat64ToInt32); + goto parse_error; + default: goto parse_error; + } + } + case ':': { + switch (op[17]) { + case '3': + if (strcmp(op, "i32.trunc_s:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat32ToInt32); + goto parse_error; + case '6': + if (strcmp(op, "i32.trunc_s:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat64ToInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'u': { + switch (op[11]) { + case '/': { + switch (op[13]) { + case '3': + if (strcmp(op, "i32.trunc_u/f32") == 0) return makeUnary(s, UnaryOp::TruncUFloat32ToInt32); + goto parse_error; + case '6': + if (strcmp(op, "i32.trunc_u/f64") == 0) return makeUnary(s, UnaryOp::TruncUFloat64ToInt32); + goto parse_error; + default: goto parse_error; + } + } + case ':': { + switch (op[17]) { + case '3': + if (strcmp(op, "i32.trunc_u:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat32ToInt32); + goto parse_error; + case '6': + if (strcmp(op, "i32.trunc_u:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat64ToInt32); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'w': { + switch (op[5]) { + case 'a': + if (strcmp(op, "i32.wait") == 0) return makeAtomicWait(s, i32); + goto parse_error; + case 'r': + if (strcmp(op, "i32.wrap/i64") == 0) return makeUnary(s, UnaryOp::WrapInt64); + goto parse_error; + default: goto parse_error; + } + } + case 'x': + if (strcmp(op, "i32.xor") == 0) return makeBinary(s, BinaryOp::XorInt32); + goto parse_error; + default: goto parse_error; + } + } + case 'x': { + switch (op[6]) { + case 'a': { + switch (op[7]) { + case 'd': + if (strcmp(op, "i32x4.add") == 0) return makeBinary(s, BinaryOp::AddVecI32x4); + goto parse_error; + case 'l': + if (strcmp(op, "i32x4.all_true") == 0) return makeUnary(s, UnaryOp::AllTrueVecI32x4); + goto parse_error; + case 'n': + if (strcmp(op, "i32x4.any_true") == 0) return makeUnary(s, UnaryOp::AnyTrueVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'e': { + switch (op[7]) { + case 'q': + if (strcmp(op, "i32x4.eq") == 0) return makeBinary(s, BinaryOp::EqVecI32x4); + goto parse_error; + case 'x': + if (strcmp(op, "i32x4.extract_lane") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecI32x4, 4); + goto parse_error; + default: goto parse_error; + } + } + case 'g': { + switch (op[7]) { + case 'e': { + switch (op[9]) { + case 's': + if (strcmp(op, "i32x4.ge_s") == 0) return makeBinary(s, BinaryOp::GeSVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.ge_u") == 0) return makeBinary(s, BinaryOp::GeUVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[9]) { + case 's': + if (strcmp(op, "i32x4.gt_s") == 0) return makeBinary(s, BinaryOp::LeSVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.gt_u") == 0) return makeBinary(s, BinaryOp::LeUVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'l': { + switch (op[7]) { + case 'e': { + switch (op[9]) { + case 's': + if (strcmp(op, "i32x4.le_s") == 0) return makeBinary(s, BinaryOp::GtSVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.le_u") == 0) return makeBinary(s, BinaryOp::GtUVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[9]) { + case 's': + if (strcmp(op, "i32x4.lt_s") == 0) return makeBinary(s, BinaryOp::LtSVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.lt_u") == 0) return makeBinary(s, BinaryOp::LtUVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'm': + if (strcmp(op, "i32x4.mul") == 0) return makeBinary(s, BinaryOp::MulVecI32x4); goto parse_error; - default: goto parse_error; - } - } - case 'c': { - switch (op[5]) { - case 'e': - if (strcmp(op, "f64.ceil") == 0) return makeUnary(s, UnaryOp::CeilFloat64); + case 'n': { + switch (op[8]) { + case '\0': + if (strcmp(op, "i32x4.ne") == 0) return makeBinary(s, BinaryOp::NeVecI32x4); + goto parse_error; + case 'g': + if (strcmp(op, "i32x4.neg") == 0) return makeUnary(s, UnaryOp::NegVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + case 'r': + if (strcmp(op, "i32x4.replace_lane") == 0) return makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI32x4, 4); goto parse_error; - case 'o': { - switch (op[6]) { - case 'n': { - switch (op[7]) { - case 's': - if (strcmp(op, "f64.const") == 0) return makeConst(s, f64); + case 's': { + switch (op[7]) { + case 'h': { + switch (op[8]) { + case 'l': + if (strcmp(op, "i32x4.shl") == 0) return makeSIMDShift(s, SIMDShiftOp::ShlVecI32x4); goto parse_error; - case 'v': { - switch (op[12]) { - case 's': { - switch (op[15]) { - case '3': - if (strcmp(op, "f64.convert_s/i32") == 0) return makeUnary(s, UnaryOp::ConvertSInt32ToFloat64); - goto parse_error; - case '6': - if (strcmp(op, "f64.convert_s/i64") == 0) return makeUnary(s, UnaryOp::ConvertSInt64ToFloat64); - goto parse_error; - default: goto parse_error; - } - } - case 'u': { - switch (op[15]) { - case '3': - if (strcmp(op, "f64.convert_u/i32") == 0) return makeUnary(s, UnaryOp::ConvertUInt32ToFloat64); - goto parse_error; - case '6': - if (strcmp(op, "f64.convert_u/i64") == 0) return makeUnary(s, UnaryOp::ConvertUInt64ToFloat64); - goto parse_error; - default: goto parse_error; - } - } + case 'r': { + switch (op[10]) { + case 's': + if (strcmp(op, "i32x4.shr_s") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrSVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.shr_u") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrUVecI32x4); + goto parse_error; default: goto parse_error; } } @@ -272,7 +1364,21 @@ switch (op[0]) { } } case 'p': - if (strcmp(op, "f64.copysign") == 0) return makeBinary(s, BinaryOp::CopySignFloat64); + if (strcmp(op, "i32x4.splat") == 0) return makeUnary(s, UnaryOp::SplatVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.sub") == 0) return makeBinary(s, BinaryOp::SubVecI32x4); + goto parse_error; + default: goto parse_error; + } + } + case 't': { + switch (op[12]) { + case 's': + if (strcmp(op, "i32x4.trunc_s/f32x4:sat") == 0) return makeUnary(s, UnaryOp::TruncSatSVecF32x4ToVecI32x4); + goto parse_error; + case 'u': + if (strcmp(op, "i32x4.trunc_u/f32x4:sat") == 0) return makeUnary(s, UnaryOp::TruncSatUVecF32x4ToVecI32x4); goto parse_error; default: goto parse_error; } @@ -280,474 +1386,298 @@ switch (op[0]) { default: goto parse_error; } } - case 'd': - if (strcmp(op, "f64.div") == 0) return makeBinary(s, BinaryOp::DivFloat64); - goto parse_error; - case 'e': - if (strcmp(op, "f64.eq") == 0) return makeBinary(s, BinaryOp::EqFloat64); - goto parse_error; - case 'f': - if (strcmp(op, "f64.floor") == 0) return makeUnary(s, UnaryOp::FloorFloat64); - goto parse_error; - case 'g': { - switch (op[5]) { - case 'e': - if (strcmp(op, "f64.ge") == 0) return makeBinary(s, BinaryOp::GeFloat64); - goto parse_error; - case 't': - if (strcmp(op, "f64.gt") == 0) return makeBinary(s, BinaryOp::GtFloat64); - goto parse_error; - default: goto parse_error; - } - } - case 'l': { - switch (op[5]) { - case 'e': - if (strcmp(op, "f64.le") == 0) return makeBinary(s, BinaryOp::LeFloat64); - goto parse_error; - case 'o': - if (strcmp(op, "f64.load") == 0) return makeLoad(s, f64, /*isAtomic=*/false); - goto parse_error; - case 't': - if (strcmp(op, "f64.lt") == 0) return makeBinary(s, BinaryOp::LtFloat64); - goto parse_error; - default: goto parse_error; - } - } - case 'm': { - switch (op[5]) { - case 'a': - if (strcmp(op, "f64.max") == 0) return makeBinary(s, BinaryOp::MaxFloat64); - goto parse_error; - case 'i': - if (strcmp(op, "f64.min") == 0) return makeBinary(s, BinaryOp::MinFloat64); - goto parse_error; - case 'u': - if (strcmp(op, "f64.mul") == 0) return makeBinary(s, BinaryOp::MulFloat64); - goto parse_error; - default: goto parse_error; - } - } - case 'n': { - switch (op[6]) { - case '\0': - if (strcmp(op, "f64.ne") == 0) return makeBinary(s, BinaryOp::NeFloat64); - goto parse_error; - case 'a': - if (strcmp(op, "f64.nearest") == 0) return makeUnary(s, UnaryOp::NearestFloat64); - goto parse_error; - case 'g': - if (strcmp(op, "f64.neg") == 0) return makeUnary(s, UnaryOp::NegFloat64); - goto parse_error; - default: goto parse_error; - } - } - case 'p': - if (strcmp(op, "f64.promote/f32") == 0) return makeUnary(s, UnaryOp::PromoteFloat32); - goto parse_error; - case 'r': - if (strcmp(op, "f64.reinterpret/i64") == 0) return makeUnary(s, UnaryOp::ReinterpretInt64); - goto parse_error; - case 's': { - switch (op[5]) { - case 'q': - if (strcmp(op, "f64.sqrt") == 0) return makeUnary(s, UnaryOp::SqrtFloat64); - goto parse_error; - case 't': - if (strcmp(op, "f64.store") == 0) return makeStore(s, f64, /*isAtomic=*/false); - goto parse_error; - case 'u': - if (strcmp(op, "f64.sub") == 0) return makeBinary(s, BinaryOp::SubFloat64); - goto parse_error; - default: goto parse_error; - } - } - case 't': - if (strcmp(op, "f64.trunc") == 0) return makeUnary(s, UnaryOp::TruncFloat64); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 'g': { - switch (op[1]) { - case 'e': { - switch (op[4]) { - case 'g': - if (strcmp(op, "get_global") == 0) return makeGetGlobal(s); - goto parse_error; - case 'l': - if (strcmp(op, "get_local") == 0) return makeGetLocal(s); - goto parse_error; default: goto parse_error; } } - case 'r': - if (strcmp(op, "grow_memory") == 0) return makeHost(s, HostOp::GrowMemory); - goto parse_error; - default: goto parse_error; - } - } - case 'i': { - switch (op[1]) { - case '3': { - switch (op[4]) { - case 'a': { - switch (op[5]) { - case 'd': - if (strcmp(op, "i32.add") == 0) return makeBinary(s, BinaryOp::AddInt32); - goto parse_error; - case 'n': - if (strcmp(op, "i32.and") == 0) return makeBinary(s, BinaryOp::AndInt32); - goto parse_error; - case 't': { - switch (op[11]) { - case 'l': { - switch (op[15]) { - case '\0': - if (strcmp(op, "i32.atomic.load") == 0) return makeLoad(s, i32, /*isAtomic=*/true); - goto parse_error; - case '1': - if (strcmp(op, "i32.atomic.load16_u") == 0) return makeLoad(s, i32, /*isAtomic=*/true); - goto parse_error; - case '8': - if (strcmp(op, "i32.atomic.load8_u") == 0) return makeLoad(s, i32, /*isAtomic=*/true); - goto parse_error; - default: goto parse_error; - } - } - case 'r': { - switch (op[14]) { - case '.': { + case '6': { + switch (op[3]) { + case '.': { + switch (op[4]) { + case 'a': { + switch (op[5]) { + case 'd': + if (strcmp(op, "i64.add") == 0) return makeBinary(s, BinaryOp::AddInt64); + goto parse_error; + case 'n': + if (strcmp(op, "i64.and") == 0) return makeBinary(s, BinaryOp::AndInt64); + goto parse_error; + case 't': { + switch (op[11]) { + case 'l': { switch (op[15]) { - case 'a': { - switch (op[16]) { - case 'd': - if (strcmp(op, "i32.atomic.rmw.add") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 'n': - if (strcmp(op, "i32.atomic.rmw.and") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - default: goto parse_error; - } - } - case 'c': - if (strcmp(op, "i32.atomic.rmw.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case '\0': + if (strcmp(op, "i64.atomic.load") == 0) return makeLoad(s, i64, /*isAtomic=*/true); goto parse_error; - case 'o': - if (strcmp(op, "i32.atomic.rmw.or") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case '1': + if (strcmp(op, "i64.atomic.load16_u") == 0) return makeLoad(s, i64, /*isAtomic=*/true); goto parse_error; - case 's': - if (strcmp(op, "i32.atomic.rmw.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case '3': + if (strcmp(op, "i64.atomic.load32_u") == 0) return makeLoad(s, i64, /*isAtomic=*/true); + goto parse_error; + case '8': + if (strcmp(op, "i64.atomic.load8_u") == 0) return makeLoad(s, i64, /*isAtomic=*/true); goto parse_error; - case 'x': { - switch (op[16]) { - case 'c': - if (strcmp(op, "i32.atomic.rmw.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 'o': - if (strcmp(op, "i32.atomic.rmw.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - default: goto parse_error; - } - } default: goto parse_error; } } - case '1': { - switch (op[19]) { - case 'a': { - switch (op[20]) { - case 'd': - if (strcmp(op, "i32.atomic.rmw16_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case 'r': { + switch (op[14]) { + case '.': { + switch (op[15]) { + case 'a': { + switch (op[16]) { + case 'd': + if (strcmp(op, "i64.atomic.rmw.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'n': + if (strcmp(op, "i64.atomic.rmw.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } + case 'c': + if (strcmp(op, "i64.atomic.rmw.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'o': + if (strcmp(op, "i64.atomic.rmw.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; - case 'n': - if (strcmp(op, "i32.atomic.rmw16_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case 's': + if (strcmp(op, "i64.atomic.rmw.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; + case 'x': { + switch (op[16]) { + case 'c': + if (strcmp(op, "i64.atomic.rmw.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'o': + if (strcmp(op, "i64.atomic.rmw.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } - case 'c': - if (strcmp(op, "i32.atomic.rmw16_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 'o': - if (strcmp(op, "i32.atomic.rmw16_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 's': - if (strcmp(op, "i32.atomic.rmw16_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 'x': { - switch (op[20]) { + case '1': { + switch (op[19]) { + case 'a': { + switch (op[20]) { + case 'd': + if (strcmp(op, "i64.atomic.rmw16_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'n': + if (strcmp(op, "i64.atomic.rmw16_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } case 'c': - if (strcmp(op, "i32.atomic.rmw16_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + if (strcmp(op, "i64.atomic.rmw16_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; case 'o': - if (strcmp(op, "i32.atomic.rmw16_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + if (strcmp(op, "i64.atomic.rmw16_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 's': + if (strcmp(op, "i64.atomic.rmw16_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; + case 'x': { + switch (op[20]) { + case 'c': + if (strcmp(op, "i64.atomic.rmw16_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'o': + if (strcmp(op, "i64.atomic.rmw16_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } - default: goto parse_error; - } - } - case '8': { - switch (op[18]) { - case 'a': { + case '3': { switch (op[19]) { - case 'd': - if (strcmp(op, "i32.atomic.rmw8_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case 'a': { + switch (op[20]) { + case 'd': + if (strcmp(op, "i64.atomic.rmw32_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'n': + if (strcmp(op, "i64.atomic.rmw32_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } + case 'c': + if (strcmp(op, "i64.atomic.rmw32_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'o': + if (strcmp(op, "i64.atomic.rmw32_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; - case 'n': - if (strcmp(op, "i32.atomic.rmw8_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + case 's': + if (strcmp(op, "i64.atomic.rmw32_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; + case 'x': { + switch (op[20]) { + case 'c': + if (strcmp(op, "i64.atomic.rmw32_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'o': + if (strcmp(op, "i64.atomic.rmw32_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } - case 'c': - if (strcmp(op, "i32.atomic.rmw8_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 'o': - if (strcmp(op, "i32.atomic.rmw8_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 's': - if (strcmp(op, "i32.atomic.rmw8_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i32); - goto parse_error; - case 'x': { - switch (op[19]) { + case '8': { + switch (op[18]) { + case 'a': { + switch (op[19]) { + case 'd': + if (strcmp(op, "i64.atomic.rmw8_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'n': + if (strcmp(op, "i64.atomic.rmw8_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } case 'c': - if (strcmp(op, "i32.atomic.rmw8_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + if (strcmp(op, "i64.atomic.rmw8_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; case 'o': - if (strcmp(op, "i32.atomic.rmw8_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i32); + if (strcmp(op, "i64.atomic.rmw8_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); goto parse_error; + case 's': + if (strcmp(op, "i64.atomic.rmw8_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'x': { + switch (op[19]) { + case 'c': + if (strcmp(op, "i64.atomic.rmw8_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + case 'o': + if (strcmp(op, "i64.atomic.rmw8_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } default: goto parse_error; } } - default: goto parse_error; - } - } - case 's': { - switch (op[16]) { - case '\0': - if (strcmp(op, "i32.atomic.store") == 0) return makeStore(s, i32, /*isAtomic=*/true); - goto parse_error; - case '1': - if (strcmp(op, "i32.atomic.store16") == 0) return makeStore(s, i32, /*isAtomic=*/true); - goto parse_error; - case '8': - if (strcmp(op, "i32.atomic.store8") == 0) return makeStore(s, i32, /*isAtomic=*/true); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 'c': { - switch (op[5]) { - case 'l': - if (strcmp(op, "i32.clz") == 0) return makeUnary(s, UnaryOp::ClzInt32); - goto parse_error; - case 'o': - if (strcmp(op, "i32.const") == 0) return makeConst(s, i32); - goto parse_error; - case 't': - if (strcmp(op, "i32.ctz") == 0) return makeUnary(s, UnaryOp::CtzInt32); - goto parse_error; - default: goto parse_error; - } - } - case 'd': { - switch (op[8]) { - case 's': - if (strcmp(op, "i32.div_s") == 0) return makeBinary(s, BinaryOp::DivSInt32); - goto parse_error; - case 'u': - if (strcmp(op, "i32.div_u") == 0) return makeBinary(s, BinaryOp::DivUInt32); - goto parse_error; - default: goto parse_error; - } - } - case 'e': { - switch (op[5]) { - case 'q': { - switch (op[6]) { - case '\0': - if (strcmp(op, "i32.eq") == 0) return makeBinary(s, BinaryOp::EqInt32); - goto parse_error; - case 'z': - if (strcmp(op, "i32.eqz") == 0) return makeUnary(s, UnaryOp::EqZInt32); - goto parse_error; - default: goto parse_error; - } - } - case 'x': { - switch (op[10]) { - case '1': - if (strcmp(op, "i32.extend16_s") == 0) return makeUnary(s, UnaryOp::ExtendS16Int32); - goto parse_error; - case '8': - if (strcmp(op, "i32.extend8_s") == 0) return makeUnary(s, UnaryOp::ExtendS8Int32); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 'g': { - switch (op[5]) { - case 'e': { - switch (op[7]) { - case 's': - if (strcmp(op, "i32.ge_s") == 0) return makeBinary(s, BinaryOp::GeSInt32); - goto parse_error; - case 'u': - if (strcmp(op, "i32.ge_u") == 0) return makeBinary(s, BinaryOp::GeUInt32); - goto parse_error; + case 's': { + switch (op[16]) { + case '\0': + if (strcmp(op, "i64.atomic.store") == 0) return makeStore(s, i64, /*isAtomic=*/true); + goto parse_error; + case '1': + if (strcmp(op, "i64.atomic.store16") == 0) return makeStore(s, i64, /*isAtomic=*/true); + goto parse_error; + case '3': + if (strcmp(op, "i64.atomic.store32") == 0) return makeStore(s, i64, /*isAtomic=*/true); + goto parse_error; + case '8': + if (strcmp(op, "i64.atomic.store8") == 0) return makeStore(s, i64, /*isAtomic=*/true); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } default: goto parse_error; } } - case 't': { - switch (op[7]) { - case 's': - if (strcmp(op, "i32.gt_s") == 0) return makeBinary(s, BinaryOp::GtSInt32); + case 'c': { + switch (op[5]) { + case 'l': + if (strcmp(op, "i64.clz") == 0) return makeUnary(s, UnaryOp::ClzInt64); goto parse_error; - case 'u': - if (strcmp(op, "i32.gt_u") == 0) return makeBinary(s, BinaryOp::GtUInt32); + case 'o': + if (strcmp(op, "i64.const") == 0) return makeConst(s, i64); + goto parse_error; + case 't': + if (strcmp(op, "i64.ctz") == 0) return makeUnary(s, UnaryOp::CtzInt64); goto parse_error; default: goto parse_error; } } - default: goto parse_error; - } - } - case 'l': { - switch (op[5]) { - case 'e': { - switch (op[7]) { + case 'd': { + switch (op[8]) { case 's': - if (strcmp(op, "i32.le_s") == 0) return makeBinary(s, BinaryOp::LeSInt32); + if (strcmp(op, "i64.div_s") == 0) return makeBinary(s, BinaryOp::DivSInt64); goto parse_error; case 'u': - if (strcmp(op, "i32.le_u") == 0) return makeBinary(s, BinaryOp::LeUInt32); + if (strcmp(op, "i64.div_u") == 0) return makeBinary(s, BinaryOp::DivUInt64); goto parse_error; default: goto parse_error; } } - case 'o': { - switch (op[8]) { - case '\0': - if (strcmp(op, "i32.load") == 0) return makeLoad(s, i32, /*isAtomic=*/false); - goto parse_error; - case '1': { - switch (op[11]) { - case 's': - if (strcmp(op, "i32.load16_s") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + case 'e': { + switch (op[5]) { + case 'q': { + switch (op[6]) { + case '\0': + if (strcmp(op, "i64.eq") == 0) return makeBinary(s, BinaryOp::EqInt64); goto parse_error; - case 'u': - if (strcmp(op, "i32.load16_u") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + case 'z': + if (strcmp(op, "i64.eqz") == 0) return makeUnary(s, UnaryOp::EqZInt64); goto parse_error; default: goto parse_error; } } - case '8': { + case 'x': { switch (op[10]) { - case 's': - if (strcmp(op, "i32.load8_s") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + case '1': + if (strcmp(op, "i64.extend16_s") == 0) return makeUnary(s, UnaryOp::ExtendS16Int64); goto parse_error; - case 'u': - if (strcmp(op, "i32.load8_u") == 0) return makeLoad(s, i32, /*isAtomic=*/false); + case '3': + if (strcmp(op, "i64.extend32_s") == 0) return makeUnary(s, UnaryOp::ExtendS32Int64); + goto parse_error; + case '8': + if (strcmp(op, "i64.extend8_s") == 0) return makeUnary(s, UnaryOp::ExtendS8Int64); goto parse_error; + case '_': { + switch (op[11]) { + case 's': + if (strcmp(op, "i64.extend_s/i32") == 0) return makeUnary(s, UnaryOp::ExtendSInt32); + goto parse_error; + case 'u': + if (strcmp(op, "i64.extend_u/i32") == 0) return makeUnary(s, UnaryOp::ExtendUInt32); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } default: goto parse_error; } } - case 't': { - switch (op[7]) { - case 's': - if (strcmp(op, "i32.lt_s") == 0) return makeBinary(s, BinaryOp::LtSInt32); - goto parse_error; - case 'u': - if (strcmp(op, "i32.lt_u") == 0) return makeBinary(s, BinaryOp::LtUInt32); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 'm': - if (strcmp(op, "i32.mul") == 0) return makeBinary(s, BinaryOp::MulInt32); - goto parse_error; - case 'n': - if (strcmp(op, "i32.ne") == 0) return makeBinary(s, BinaryOp::NeInt32); - goto parse_error; - case 'o': - if (strcmp(op, "i32.or") == 0) return makeBinary(s, BinaryOp::OrInt32); - goto parse_error; - case 'p': - if (strcmp(op, "i32.popcnt") == 0) return makeUnary(s, UnaryOp::PopcntInt32); - goto parse_error; - case 'r': { - switch (op[5]) { - case 'e': { - switch (op[6]) { - case 'i': - if (strcmp(op, "i32.reinterpret/f32") == 0) return makeUnary(s, UnaryOp::ReinterpretFloat32); - goto parse_error; - case 'm': { - switch (op[8]) { + case 'g': { + switch (op[5]) { + case 'e': { + switch (op[7]) { case 's': - if (strcmp(op, "i32.rem_s") == 0) return makeBinary(s, BinaryOp::RemSInt32); + if (strcmp(op, "i64.ge_s") == 0) return makeBinary(s, BinaryOp::GeSInt64); goto parse_error; case 'u': - if (strcmp(op, "i32.rem_u") == 0) return makeBinary(s, BinaryOp::RemUInt32); + if (strcmp(op, "i64.ge_u") == 0) return makeBinary(s, BinaryOp::GeUInt64); goto parse_error; default: goto parse_error; } } - default: goto parse_error; - } - } - case 'o': { - switch (op[7]) { - case 'l': - if (strcmp(op, "i32.rotl") == 0) return makeBinary(s, BinaryOp::RotLInt32); - goto parse_error; - case 'r': - if (strcmp(op, "i32.rotr") == 0) return makeBinary(s, BinaryOp::RotRInt32); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 's': { - switch (op[5]) { - case 'h': { - switch (op[6]) { - case 'l': - if (strcmp(op, "i32.shl") == 0) return makeBinary(s, BinaryOp::ShlInt32); - goto parse_error; - case 'r': { - switch (op[8]) { + case 't': { + switch (op[7]) { case 's': - if (strcmp(op, "i32.shr_s") == 0) return makeBinary(s, BinaryOp::ShrSInt32); + if (strcmp(op, "i64.gt_s") == 0) return makeBinary(s, BinaryOp::GtSInt64); goto parse_error; case 'u': - if (strcmp(op, "i32.shr_u") == 0) return makeBinary(s, BinaryOp::ShrUInt32); + if (strcmp(op, "i64.gt_u") == 0) return makeBinary(s, BinaryOp::GtUInt64); goto parse_error; default: goto parse_error; } @@ -755,75 +1685,67 @@ switch (op[0]) { default: goto parse_error; } } - case 't': { - switch (op[9]) { - case '\0': - if (strcmp(op, "i32.store") == 0) return makeStore(s, i32, /*isAtomic=*/false); - goto parse_error; - case '1': - if (strcmp(op, "i32.store16") == 0) return makeStore(s, i32, /*isAtomic=*/false); - goto parse_error; - case '8': - if (strcmp(op, "i32.store8") == 0) return makeStore(s, i32, /*isAtomic=*/false); - goto parse_error; - default: goto parse_error; - } - } - case 'u': - if (strcmp(op, "i32.sub") == 0) return makeBinary(s, BinaryOp::SubInt32); - goto parse_error; - default: goto parse_error; - } - } - case 't': { - switch (op[10]) { - case 's': { - switch (op[11]) { - case '/': { - switch (op[13]) { - case '3': - if (strcmp(op, "i32.trunc_s/f32") == 0) return makeUnary(s, UnaryOp::TruncSFloat32ToInt32); - goto parse_error; - case '6': - if (strcmp(op, "i32.trunc_s/f64") == 0) return makeUnary(s, UnaryOp::TruncSFloat64ToInt32); - goto parse_error; - default: goto parse_error; - } - } - case ':': { - switch (op[17]) { - case '3': - if (strcmp(op, "i32.trunc_s:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat32ToInt32); + case 'l': { + switch (op[5]) { + case 'e': { + switch (op[7]) { + case 's': + if (strcmp(op, "i64.le_s") == 0) return makeBinary(s, BinaryOp::LeSInt64); goto parse_error; - case '6': - if (strcmp(op, "i32.trunc_s:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat64ToInt32); + case 'u': + if (strcmp(op, "i64.le_u") == 0) return makeBinary(s, BinaryOp::LeUInt64); goto parse_error; default: goto parse_error; } } - default: goto parse_error; - } - } - case 'u': { - switch (op[11]) { - case '/': { - switch (op[13]) { - case '3': - if (strcmp(op, "i32.trunc_u/f32") == 0) return makeUnary(s, UnaryOp::TruncUFloat32ToInt32); - goto parse_error; - case '6': - if (strcmp(op, "i32.trunc_u/f64") == 0) return makeUnary(s, UnaryOp::TruncUFloat64ToInt32); + case 'o': { + switch (op[8]) { + case '\0': + if (strcmp(op, "i64.load") == 0) return makeLoad(s, i64, /*isAtomic=*/false); goto parse_error; + case '1': { + switch (op[11]) { + case 's': + if (strcmp(op, "i64.load16_s") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "i64.load16_u") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + goto parse_error; + default: goto parse_error; + } + } + case '3': { + switch (op[11]) { + case 's': + if (strcmp(op, "i64.load32_s") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "i64.load32_u") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + goto parse_error; + default: goto parse_error; + } + } + case '8': { + switch (op[10]) { + case 's': + if (strcmp(op, "i64.load8_s") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + goto parse_error; + case 'u': + if (strcmp(op, "i64.load8_u") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } - case ':': { - switch (op[17]) { - case '3': - if (strcmp(op, "i32.trunc_u:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat32ToInt32); + case 't': { + switch (op[7]) { + case 's': + if (strcmp(op, "i64.lt_s") == 0) return makeBinary(s, BinaryOp::LtSInt64); goto parse_error; - case '6': - if (strcmp(op, "i32.trunc_u:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat64ToInt32); + case 'u': + if (strcmp(op, "i64.lt_u") == 0) return makeBinary(s, BinaryOp::LtUInt64); goto parse_error; default: goto parse_error; } @@ -831,283 +1753,253 @@ switch (op[0]) { default: goto parse_error; } } - default: goto parse_error; - } - } - case 'w': { - switch (op[5]) { - case 'a': - if (strcmp(op, "i32.wait") == 0) return makeAtomicWait(s, i32); + case 'm': + if (strcmp(op, "i64.mul") == 0) return makeBinary(s, BinaryOp::MulInt64); goto parse_error; - case 'r': - if (strcmp(op, "i32.wrap/i64") == 0) return makeUnary(s, UnaryOp::WrapInt64); + case 'n': + if (strcmp(op, "i64.ne") == 0) return makeBinary(s, BinaryOp::NeInt64); goto parse_error; - default: goto parse_error; - } - } - case 'x': - if (strcmp(op, "i32.xor") == 0) return makeBinary(s, BinaryOp::XorInt32); - goto parse_error; - default: goto parse_error; - } - } - case '6': { - switch (op[4]) { - case 'a': { - switch (op[5]) { - case 'd': - if (strcmp(op, "i64.add") == 0) return makeBinary(s, BinaryOp::AddInt64); + case 'o': + if (strcmp(op, "i64.or") == 0) return makeBinary(s, BinaryOp::OrInt64); goto parse_error; - case 'n': - if (strcmp(op, "i64.and") == 0) return makeBinary(s, BinaryOp::AndInt64); + case 'p': + if (strcmp(op, "i64.popcnt") == 0) return makeUnary(s, UnaryOp::PopcntInt64); goto parse_error; - case 't': { - switch (op[11]) { - case 'l': { - switch (op[15]) { - case '\0': - if (strcmp(op, "i64.atomic.load") == 0) return makeLoad(s, i64, /*isAtomic=*/true); - goto parse_error; - case '1': - if (strcmp(op, "i64.atomic.load16_u") == 0) return makeLoad(s, i64, /*isAtomic=*/true); - goto parse_error; - case '3': - if (strcmp(op, "i64.atomic.load32_u") == 0) return makeLoad(s, i64, /*isAtomic=*/true); - goto parse_error; - case '8': - if (strcmp(op, "i64.atomic.load8_u") == 0) return makeLoad(s, i64, /*isAtomic=*/true); + case 'r': { + switch (op[5]) { + case 'e': { + switch (op[6]) { + case 'i': + if (strcmp(op, "i64.reinterpret/f64") == 0) return makeUnary(s, UnaryOp::ReinterpretFloat64); goto parse_error; - default: goto parse_error; - } - } - case 'r': { - switch (op[14]) { - case '.': { - switch (op[15]) { - case 'a': { - switch (op[16]) { - case 'd': - if (strcmp(op, "i64.atomic.rmw.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'n': - if (strcmp(op, "i64.atomic.rmw.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } - case 'c': - if (strcmp(op, "i64.atomic.rmw.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; + case 'm': { + switch (op[8]) { case 's': - if (strcmp(op, "i64.atomic.rmw.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'x': { - switch (op[16]) { - case 'c': - if (strcmp(op, "i64.atomic.rmw.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case '1': { - switch (op[19]) { - case 'a': { - switch (op[20]) { - case 'd': - if (strcmp(op, "i64.atomic.rmw16_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'n': - if (strcmp(op, "i64.atomic.rmw16_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } - case 'c': - if (strcmp(op, "i64.atomic.rmw16_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw16_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + if (strcmp(op, "i64.rem_s") == 0) return makeBinary(s, BinaryOp::RemSInt64); goto parse_error; - case 's': - if (strcmp(op, "i64.atomic.rmw16_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + case 'u': + if (strcmp(op, "i64.rem_u") == 0) return makeBinary(s, BinaryOp::RemUInt64); goto parse_error; - case 'x': { - switch (op[20]) { - case 'c': - if (strcmp(op, "i64.atomic.rmw16_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw16_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } default: goto parse_error; } } - case '3': { - switch (op[19]) { - case 'a': { - switch (op[20]) { - case 'd': - if (strcmp(op, "i64.atomic.rmw32_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'n': - if (strcmp(op, "i64.atomic.rmw32_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } - case 'c': - if (strcmp(op, "i64.atomic.rmw32_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw32_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; + default: goto parse_error; + } + } + case 'o': { + switch (op[7]) { + case 'l': + if (strcmp(op, "i64.rotl") == 0) return makeBinary(s, BinaryOp::RotLInt64); + goto parse_error; + case 'r': + if (strcmp(op, "i64.rotr") == 0) return makeBinary(s, BinaryOp::RotRInt64); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 's': { + switch (op[5]) { + case 'h': { + switch (op[6]) { + case 'l': + if (strcmp(op, "i64.shl") == 0) return makeBinary(s, BinaryOp::ShlInt64); + goto parse_error; + case 'r': { + switch (op[8]) { case 's': - if (strcmp(op, "i64.atomic.rmw32_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'x': { - switch (op[20]) { - case 'c': - if (strcmp(op, "i64.atomic.rmw32_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw32_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case '8': { - switch (op[18]) { - case 'a': { - switch (op[19]) { - case 'd': - if (strcmp(op, "i64.atomic.rmw8_u.add") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'n': - if (strcmp(op, "i64.atomic.rmw8_u.and") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } - case 'c': - if (strcmp(op, "i64.atomic.rmw8_u.cmpxchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + if (strcmp(op, "i64.shr_s") == 0) return makeBinary(s, BinaryOp::ShrSInt64); goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw8_u.or") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 's': - if (strcmp(op, "i64.atomic.rmw8_u.sub") == 0) return makeAtomicRMWOrCmpxchg(s, i64); + case 'u': + if (strcmp(op, "i64.shr_u") == 0) return makeBinary(s, BinaryOp::ShrUInt64); goto parse_error; - case 'x': { - switch (op[19]) { - case 'c': - if (strcmp(op, "i64.atomic.rmw8_u.xchg") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.atomic.rmw8_u.xor") == 0) return makeAtomicRMWOrCmpxchg(s, i64); - goto parse_error; - default: goto parse_error; - } - } default: goto parse_error; } } default: goto parse_error; } } - case 's': { - switch (op[16]) { + case 't': { + switch (op[9]) { case '\0': - if (strcmp(op, "i64.atomic.store") == 0) return makeStore(s, i64, /*isAtomic=*/true); + if (strcmp(op, "i64.store") == 0) return makeStore(s, i64, /*isAtomic=*/false); goto parse_error; case '1': - if (strcmp(op, "i64.atomic.store16") == 0) return makeStore(s, i64, /*isAtomic=*/true); + if (strcmp(op, "i64.store16") == 0) return makeStore(s, i64, /*isAtomic=*/false); goto parse_error; case '3': - if (strcmp(op, "i64.atomic.store32") == 0) return makeStore(s, i64, /*isAtomic=*/true); + if (strcmp(op, "i64.store32") == 0) return makeStore(s, i64, /*isAtomic=*/false); goto parse_error; case '8': - if (strcmp(op, "i64.atomic.store8") == 0) return makeStore(s, i64, /*isAtomic=*/true); + if (strcmp(op, "i64.store8") == 0) return makeStore(s, i64, /*isAtomic=*/false); goto parse_error; default: goto parse_error; } } + case 'u': + if (strcmp(op, "i64.sub") == 0) return makeBinary(s, BinaryOp::SubInt64); + goto parse_error; default: goto parse_error; } } - default: goto parse_error; - } - } - case 'c': { - switch (op[5]) { - case 'l': - if (strcmp(op, "i64.clz") == 0) return makeUnary(s, UnaryOp::ClzInt64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.const") == 0) return makeConst(s, i64); + case 't': { + switch (op[10]) { + case 's': { + switch (op[11]) { + case '/': { + switch (op[13]) { + case '3': + if (strcmp(op, "i64.trunc_s/f32") == 0) return makeUnary(s, UnaryOp::TruncSFloat32ToInt64); + goto parse_error; + case '6': + if (strcmp(op, "i64.trunc_s/f64") == 0) return makeUnary(s, UnaryOp::TruncSFloat64ToInt64); + goto parse_error; + default: goto parse_error; + } + } + case ':': { + switch (op[17]) { + case '3': + if (strcmp(op, "i64.trunc_s:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat32ToInt64); + goto parse_error; + case '6': + if (strcmp(op, "i64.trunc_s:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat64ToInt64); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'u': { + switch (op[11]) { + case '/': { + switch (op[13]) { + case '3': + if (strcmp(op, "i64.trunc_u/f32") == 0) return makeUnary(s, UnaryOp::TruncUFloat32ToInt64); + goto parse_error; + case '6': + if (strcmp(op, "i64.trunc_u/f64") == 0) return makeUnary(s, UnaryOp::TruncUFloat64ToInt64); + goto parse_error; + default: goto parse_error; + } + } + case ':': { + switch (op[17]) { + case '3': + if (strcmp(op, "i64.trunc_u:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat32ToInt64); + goto parse_error; + case '6': + if (strcmp(op, "i64.trunc_u:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat64ToInt64); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'w': + if (strcmp(op, "i64.wait") == 0) return makeAtomicWait(s, i64); goto parse_error; - case 't': - if (strcmp(op, "i64.ctz") == 0) return makeUnary(s, UnaryOp::CtzInt64); + case 'x': + if (strcmp(op, "i64.xor") == 0) return makeBinary(s, BinaryOp::XorInt64); goto parse_error; default: goto parse_error; } } - case 'd': { - switch (op[8]) { - case 's': - if (strcmp(op, "i64.div_s") == 0) return makeBinary(s, BinaryOp::DivSInt64); + case 'x': { + switch (op[6]) { + case 'a': { + switch (op[7]) { + case 'd': + if (strcmp(op, "i64x2.add") == 0) return makeBinary(s, BinaryOp::AddVecI64x2); + goto parse_error; + case 'l': + if (strcmp(op, "i64x2.all_true") == 0) return makeUnary(s, UnaryOp::AllTrueVecI64x2); + goto parse_error; + case 'n': + if (strcmp(op, "i64x2.any_true") == 0) return makeUnary(s, UnaryOp::AnyTrueVecI64x2); + goto parse_error; + default: goto parse_error; + } + } + case 'e': + if (strcmp(op, "i64x2.extract_lane") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneVecI64x2, 2); + goto parse_error; + case 'n': + if (strcmp(op, "i64x2.neg") == 0) return makeUnary(s, UnaryOp::NegVecI64x2); goto parse_error; - case 'u': - if (strcmp(op, "i64.div_u") == 0) return makeBinary(s, BinaryOp::DivUInt64); + case 'r': + if (strcmp(op, "i64x2.replace_lane") == 0) return makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI64x2, 2); goto parse_error; - default: goto parse_error; - } - } - case 'e': { - switch (op[5]) { - case 'q': { - switch (op[6]) { - case '\0': - if (strcmp(op, "i64.eq") == 0) return makeBinary(s, BinaryOp::EqInt64); + case 's': { + switch (op[7]) { + case 'h': { + switch (op[8]) { + case 'l': + if (strcmp(op, "i64x2.shl") == 0) return makeSIMDShift(s, SIMDShiftOp::ShlVecI64x2); + goto parse_error; + case 'r': { + switch (op[10]) { + case 's': + if (strcmp(op, "i64x2.shr_s") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrSVecI64x2); + goto parse_error; + case 'u': + if (strcmp(op, "i64x2.shr_u") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrUVecI64x2); + goto parse_error; + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case 'p': + if (strcmp(op, "i64x2.splat") == 0) return makeUnary(s, UnaryOp::SplatVecI64x2); goto parse_error; - case 'z': - if (strcmp(op, "i64.eqz") == 0) return makeUnary(s, UnaryOp::EqZInt64); + case 'u': + if (strcmp(op, "i64x2.sub") == 0) return makeBinary(s, BinaryOp::SubVecI64x2); goto parse_error; default: goto parse_error; } } - case 'x': { - switch (op[10]) { - case '1': - if (strcmp(op, "i64.extend16_s") == 0) return makeUnary(s, UnaryOp::ExtendS16Int64); + case 't': { + switch (op[12]) { + case 's': + if (strcmp(op, "i64x2.trunc_s/f64x2:sat") == 0) return makeUnary(s, UnaryOp::TruncSatSVecF64x2ToVecI64x2); goto parse_error; - case '3': - if (strcmp(op, "i64.extend32_s") == 0) return makeUnary(s, UnaryOp::ExtendS32Int64); + case 'u': + if (strcmp(op, "i64x2.trunc_u/f64x2:sat") == 0) return makeUnary(s, UnaryOp::TruncSatUVecF64x2ToVecI64x2); goto parse_error; - case '8': - if (strcmp(op, "i64.extend8_s") == 0) return makeUnary(s, UnaryOp::ExtendS8Int64); + default: goto parse_error; + } + } + default: goto parse_error; + } + } + default: goto parse_error; + } + } + case '8': { + switch (op[6]) { + case 'a': { + switch (op[7]) { + case 'd': { + switch (op[9]) { + case '\0': + if (strcmp(op, "i8x16.add") == 0) return makeBinary(s, BinaryOp::AddVecI8x16); goto parse_error; case '_': { - switch (op[11]) { + switch (op[19]) { case 's': - if (strcmp(op, "i64.extend_s/i32") == 0) return makeUnary(s, UnaryOp::ExtendSInt32); + if (strcmp(op, "i8x16.add_saturate_s") == 0) return makeBinary(s, BinaryOp::AddSatSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i64.extend_u/i32") == 0) return makeUnary(s, UnaryOp::ExtendUInt32); + if (strcmp(op, "i8x16.add_saturate_u") == 0) return makeBinary(s, BinaryOp::AddSatUVecI8x16); goto parse_error; default: goto parse_error; } @@ -1115,29 +2007,54 @@ switch (op[0]) { default: goto parse_error; } } + case 'l': + if (strcmp(op, "i8x16.all_true") == 0) return makeUnary(s, UnaryOp::AllTrueVecI8x16); + goto parse_error; + case 'n': + if (strcmp(op, "i8x16.any_true") == 0) return makeUnary(s, UnaryOp::AnyTrueVecI8x16); + goto parse_error; + default: goto parse_error; + } + } + case 'e': { + switch (op[7]) { + case 'q': + if (strcmp(op, "i8x16.eq") == 0) return makeBinary(s, BinaryOp::EqVecI8x16); + goto parse_error; + case 'x': { + switch (op[19]) { + case 's': + if (strcmp(op, "i8x16.extract_lane_s") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneSVecI8x16, 16); + goto parse_error; + case 'u': + if (strcmp(op, "i8x16.extract_lane_u") == 0) return makeSIMDExtract(s, SIMDExtractOp::ExtractLaneUVecI8x16, 16); + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } case 'g': { - switch (op[5]) { + switch (op[7]) { case 'e': { - switch (op[7]) { + switch (op[9]) { case 's': - if (strcmp(op, "i64.ge_s") == 0) return makeBinary(s, BinaryOp::GeSInt64); + if (strcmp(op, "i8x16.ge_s") == 0) return makeBinary(s, BinaryOp::GeSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i64.ge_u") == 0) return makeBinary(s, BinaryOp::GeUInt64); + if (strcmp(op, "i8x16.ge_u") == 0) return makeBinary(s, BinaryOp::GeUVecI8x16); goto parse_error; default: goto parse_error; } } case 't': { - switch (op[7]) { + switch (op[9]) { case 's': - if (strcmp(op, "i64.gt_s") == 0) return makeBinary(s, BinaryOp::GtSInt64); + if (strcmp(op, "i8x16.gt_s") == 0) return makeBinary(s, BinaryOp::LeSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i64.gt_u") == 0) return makeBinary(s, BinaryOp::GtUInt64); + if (strcmp(op, "i8x16.gt_u") == 0) return makeBinary(s, BinaryOp::LeUVecI8x16); goto parse_error; default: goto parse_error; } @@ -1146,66 +2063,25 @@ switch (op[0]) { } } case 'l': { - switch (op[5]) { + switch (op[7]) { case 'e': { - switch (op[7]) { + switch (op[9]) { case 's': - if (strcmp(op, "i64.le_s") == 0) return makeBinary(s, BinaryOp::LeSInt64); + if (strcmp(op, "i8x16.le_s") == 0) return makeBinary(s, BinaryOp::GtSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i64.le_u") == 0) return makeBinary(s, BinaryOp::LeUInt64); - goto parse_error; - default: goto parse_error; - } - } - case 'o': { - switch (op[8]) { - case '\0': - if (strcmp(op, "i64.load") == 0) return makeLoad(s, i64, /*isAtomic=*/false); + if (strcmp(op, "i8x16.le_u") == 0) return makeBinary(s, BinaryOp::GtUVecI8x16); goto parse_error; - case '1': { - switch (op[11]) { - case 's': - if (strcmp(op, "i64.load16_s") == 0) return makeLoad(s, i64, /*isAtomic=*/false); - goto parse_error; - case 'u': - if (strcmp(op, "i64.load16_u") == 0) return makeLoad(s, i64, /*isAtomic=*/false); - goto parse_error; - default: goto parse_error; - } - } - case '3': { - switch (op[11]) { - case 's': - if (strcmp(op, "i64.load32_s") == 0) return makeLoad(s, i64, /*isAtomic=*/false); - goto parse_error; - case 'u': - if (strcmp(op, "i64.load32_u") == 0) return makeLoad(s, i64, /*isAtomic=*/false); - goto parse_error; - default: goto parse_error; - } - } - case '8': { - switch (op[10]) { - case 's': - if (strcmp(op, "i64.load8_s") == 0) return makeLoad(s, i64, /*isAtomic=*/false); - goto parse_error; - case 'u': - if (strcmp(op, "i64.load8_u") == 0) return makeLoad(s, i64, /*isAtomic=*/false); - goto parse_error; - default: goto parse_error; - } - } default: goto parse_error; } } case 't': { - switch (op[7]) { + switch (op[9]) { case 's': - if (strcmp(op, "i64.lt_s") == 0) return makeBinary(s, BinaryOp::LtSInt64); + if (strcmp(op, "i8x16.lt_s") == 0) return makeBinary(s, BinaryOp::LtSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i64.lt_u") == 0) return makeBinary(s, BinaryOp::LtUInt64); + if (strcmp(op, "i8x16.lt_u") == 0) return makeBinary(s, BinaryOp::LtUVecI8x16); goto parse_error; default: goto parse_error; } @@ -1214,66 +2090,36 @@ switch (op[0]) { } } case 'm': - if (strcmp(op, "i64.mul") == 0) return makeBinary(s, BinaryOp::MulInt64); - goto parse_error; - case 'n': - if (strcmp(op, "i64.ne") == 0) return makeBinary(s, BinaryOp::NeInt64); - goto parse_error; - case 'o': - if (strcmp(op, "i64.or") == 0) return makeBinary(s, BinaryOp::OrInt64); - goto parse_error; - case 'p': - if (strcmp(op, "i64.popcnt") == 0) return makeUnary(s, UnaryOp::PopcntInt64); + if (strcmp(op, "i8x16.mul") == 0) return makeBinary(s, BinaryOp::MulVecI8x16); goto parse_error; - case 'r': { - switch (op[5]) { - case 'e': { - switch (op[6]) { - case 'i': - if (strcmp(op, "i64.reinterpret/f64") == 0) return makeUnary(s, UnaryOp::ReinterpretFloat64); - goto parse_error; - case 'm': { - switch (op[8]) { - case 's': - if (strcmp(op, "i64.rem_s") == 0) return makeBinary(s, BinaryOp::RemSInt64); - goto parse_error; - case 'u': - if (strcmp(op, "i64.rem_u") == 0) return makeBinary(s, BinaryOp::RemUInt64); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 'o': { - switch (op[7]) { - case 'l': - if (strcmp(op, "i64.rotl") == 0) return makeBinary(s, BinaryOp::RotLInt64); - goto parse_error; - case 'r': - if (strcmp(op, "i64.rotr") == 0) return makeBinary(s, BinaryOp::RotRInt64); - goto parse_error; - default: goto parse_error; - } - } + case 'n': { + switch (op[8]) { + case '\0': + if (strcmp(op, "i8x16.ne") == 0) return makeBinary(s, BinaryOp::NeVecI8x16); + goto parse_error; + case 'g': + if (strcmp(op, "i8x16.neg") == 0) return makeUnary(s, UnaryOp::NegVecI8x16); + goto parse_error; default: goto parse_error; } } + case 'r': + if (strcmp(op, "i8x16.replace_lane") == 0) return makeSIMDReplace(s, SIMDReplaceOp::ReplaceLaneVecI8x16, 16); + goto parse_error; case 's': { - switch (op[5]) { + switch (op[7]) { case 'h': { - switch (op[6]) { + switch (op[8]) { case 'l': - if (strcmp(op, "i64.shl") == 0) return makeBinary(s, BinaryOp::ShlInt64); + if (strcmp(op, "i8x16.shl") == 0) return makeSIMDShift(s, SIMDShiftOp::ShlVecI8x16); goto parse_error; case 'r': { - switch (op[8]) { + switch (op[10]) { case 's': - if (strcmp(op, "i64.shr_s") == 0) return makeBinary(s, BinaryOp::ShrSInt64); + if (strcmp(op, "i8x16.shr_s") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i64.shr_u") == 0) return makeBinary(s, BinaryOp::ShrUInt64); + if (strcmp(op, "i8x16.shr_u") == 0) return makeSIMDShift(s, SIMDShiftOp::ShrUVecI8x16); goto parse_error; default: goto parse_error; } @@ -1281,78 +2127,21 @@ switch (op[0]) { default: goto parse_error; } } - case 't': { + case 'p': + if (strcmp(op, "i8x16.splat") == 0) return makeUnary(s, UnaryOp::SplatVecI8x16); + goto parse_error; + case 'u': { switch (op[9]) { case '\0': - if (strcmp(op, "i64.store") == 0) return makeStore(s, i64, /*isAtomic=*/false); + if (strcmp(op, "i8x16.sub") == 0) return makeBinary(s, BinaryOp::SubVecI8x16); goto parse_error; - case '1': - if (strcmp(op, "i64.store16") == 0) return makeStore(s, i64, /*isAtomic=*/false); - goto parse_error; - case '3': - if (strcmp(op, "i64.store32") == 0) return makeStore(s, i64, /*isAtomic=*/false); - goto parse_error; - case '8': - if (strcmp(op, "i64.store8") == 0) return makeStore(s, i64, /*isAtomic=*/false); - goto parse_error; - default: goto parse_error; - } - } - case 'u': - if (strcmp(op, "i64.sub") == 0) return makeBinary(s, BinaryOp::SubInt64); - goto parse_error; - default: goto parse_error; - } - } - case 't': { - switch (op[10]) { - case 's': { - switch (op[11]) { - case '/': { - switch (op[13]) { - case '3': - if (strcmp(op, "i64.trunc_s/f32") == 0) return makeUnary(s, UnaryOp::TruncSFloat32ToInt64); - goto parse_error; - case '6': - if (strcmp(op, "i64.trunc_s/f64") == 0) return makeUnary(s, UnaryOp::TruncSFloat64ToInt64); - goto parse_error; - default: goto parse_error; - } - } - case ':': { - switch (op[17]) { - case '3': - if (strcmp(op, "i64.trunc_s:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat32ToInt64); - goto parse_error; - case '6': - if (strcmp(op, "i64.trunc_s:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatSFloat64ToInt64); - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } - case 'u': { - switch (op[11]) { - case '/': { - switch (op[13]) { - case '3': - if (strcmp(op, "i64.trunc_u/f32") == 0) return makeUnary(s, UnaryOp::TruncUFloat32ToInt64); - goto parse_error; - case '6': - if (strcmp(op, "i64.trunc_u/f64") == 0) return makeUnary(s, UnaryOp::TruncUFloat64ToInt64); - goto parse_error; - default: goto parse_error; - } - } - case ':': { - switch (op[17]) { - case '3': - if (strcmp(op, "i64.trunc_u:sat/f32") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat32ToInt64); + case '_': { + switch (op[19]) { + case 's': + if (strcmp(op, "i8x16.sub_saturate_s") == 0) return makeBinary(s, BinaryOp::SubSatSVecI8x16); goto parse_error; - case '6': - if (strcmp(op, "i64.trunc_u:sat/f64") == 0) return makeUnary(s, UnaryOp::TruncSatUFloat64ToInt64); + case 'u': + if (strcmp(op, "i8x16.sub_saturate_u") == 0) return makeBinary(s, BinaryOp::SubSatUVecI8x16); goto parse_error; default: goto parse_error; } @@ -1363,12 +2152,6 @@ switch (op[0]) { default: goto parse_error; } } - case 'w': - if (strcmp(op, "i64.wait") == 0) return makeAtomicWait(s, i64); - goto parse_error; - case 'x': - if (strcmp(op, "i64.xor") == 0) return makeBinary(s, BinaryOp::XorInt64); - goto parse_error; default: goto parse_error; } } @@ -1420,6 +2203,43 @@ switch (op[0]) { case 'u': if (strcmp(op, "unreachable") == 0) return makeUnreachable(); goto parse_error; + case 'v': { + switch (op[1]) { + case '1': { + switch (op[5]) { + case 'a': + if (strcmp(op, "v128.and") == 0) return makeBinary(s, BinaryOp::AndVec128); + goto parse_error; + case 'b': + if (strcmp(op, "v128.bitselect") == 0) return makeSIMDBitselect(s); + goto parse_error; + case 'c': + if (strcmp(op, "v128.const") == 0) return makeConst(s, v128); + goto parse_error; + case 'l': + if (strcmp(op, "v128.load") == 0) return makeLoad(s, v128, /*isAtomic=*/false); + goto parse_error; + case 'n': + if (strcmp(op, "v128.not") == 0) return makeUnary(s, UnaryOp::NotVec128); + goto parse_error; + case 'o': + if (strcmp(op, "v128.or") == 0) return makeBinary(s, BinaryOp::OrVec128); + goto parse_error; + case 's': + if (strcmp(op, "v128.store") == 0) return makeStore(s, v128, /*isAtomic=*/false); + goto parse_error; + case 'x': + if (strcmp(op, "v128.xor") == 0) return makeBinary(s, BinaryOp::XorVec128); + goto parse_error; + default: goto parse_error; + } + } + case '8': + if (strcmp(op, "v8x16.shuffle") == 0) return makeSIMDShuffle(s); + goto parse_error; + default: goto parse_error; + } + } case 'w': if (strcmp(op, "wake") == 0) return makeAtomicWake(s); goto parse_error; diff --git a/src/ir/ExpressionAnalyzer.cpp b/src/ir/ExpressionAnalyzer.cpp index 43f9b2eb7b1..7248691a9cf 100644 --- a/src/ir/ExpressionAnalyzer.cpp +++ b/src/ir/ExpressionAnalyzer.cpp @@ -248,6 +248,37 @@ bool ExpressionAnalyzer::flexibleEqual(Expression* left, Expression* right, Expr PUSH(AtomicWake, wakeCount); break; } + case Expression::Id::SIMDExtractId: { + CHECK(SIMDExtract, op); + CHECK(SIMDExtract, idx); + PUSH(SIMDExtract, vec); + break; + } + case Expression::Id::SIMDReplaceId: { + CHECK(SIMDReplace, op); + CHECK(SIMDReplace, idx); + PUSH(SIMDReplace, vec); + PUSH(SIMDReplace, value); + break; + } + case Expression::Id::SIMDShuffleId: { + CHECK(SIMDShuffle, mask); + PUSH(SIMDShuffle, left); + PUSH(SIMDShuffle, right); + break; + } + case Expression::Id::SIMDBitselectId: { + PUSH(SIMDBitselect, left); + PUSH(SIMDBitselect, right); + PUSH(SIMDBitselect, cond); + break; + } + case Expression::Id::SIMDShiftId: { + CHECK(SIMDShift, op); + PUSH(SIMDShift, vec); + PUSH(SIMDShift, shift); + break; + } case Expression::Id::ConstId: { if (left->cast()->value != right->cast()->value) { return false; @@ -496,6 +527,39 @@ HashType ExpressionAnalyzer::hash(Expression* curr) { PUSH(AtomicWake, wakeCount); break; } + case Expression::Id::SIMDExtractId: { + HASH(SIMDExtract, op); + HASH(SIMDExtract, idx); + PUSH(SIMDExtract, vec); + break; + } + case Expression::Id::SIMDReplaceId: { + HASH(SIMDReplace, op); + HASH(SIMDReplace, idx); + PUSH(SIMDReplace, vec); + PUSH(SIMDReplace, value); + break; + } + case Expression::Id::SIMDShuffleId: { + for (size_t i = 0; i < 16; ++i) { + HASH(SIMDShuffle, mask[i]); + } + PUSH(SIMDShuffle, left); + PUSH(SIMDShuffle, right); + break; + } + case Expression::Id::SIMDBitselectId: { + PUSH(SIMDBitselect, left); + PUSH(SIMDBitselect, right); + PUSH(SIMDBitselect, cond); + break; + } + case Expression::Id::SIMDShiftId: { + HASH(SIMDShift, op); + PUSH(SIMDShift, vec); + PUSH(SIMDShift, shift); + break; + } case Expression::Id::ConstId: { auto* c = curr->cast(); hash(c->type); diff --git a/src/ir/ReFinalize.cpp b/src/ir/ReFinalize.cpp index 31140837f7a..68526678a9a 100644 --- a/src/ir/ReFinalize.cpp +++ b/src/ir/ReFinalize.cpp @@ -137,6 +137,11 @@ void ReFinalize::visitAtomicRMW(AtomicRMW* curr) { curr->finalize(); } void ReFinalize::visitAtomicCmpxchg(AtomicCmpxchg* curr) { curr->finalize(); } void ReFinalize::visitAtomicWait(AtomicWait* curr) { curr->finalize(); } void ReFinalize::visitAtomicWake(AtomicWake* curr) { curr->finalize(); } +void ReFinalize::visitSIMDExtract(SIMDExtract* curr) { curr->finalize(); } +void ReFinalize::visitSIMDReplace(SIMDReplace* curr) { curr->finalize(); } +void ReFinalize::visitSIMDShuffle(SIMDShuffle* curr) { curr->finalize(); } +void ReFinalize::visitSIMDBitselect(SIMDBitselect* curr) { curr->finalize(); } +void ReFinalize::visitSIMDShift(SIMDShift* curr) { curr->finalize(); } void ReFinalize::visitConst(Const* curr) { curr->finalize(); } void ReFinalize::visitUnary(Unary* curr) { curr->finalize(); } void ReFinalize::visitBinary(Binary* curr) { curr->finalize(); } @@ -195,4 +200,3 @@ void ReFinalize::replaceUntaken(Expression* value, Expression* condition) { } } // namespace wasm - diff --git a/src/ir/cost.h b/src/ir/cost.h index e28f535e777..354f663e105 100644 --- a/src/ir/cost.h +++ b/src/ir/cost.h @@ -152,6 +152,39 @@ struct CostAnalyzer : public Visitor { case TruncSatUFloat64ToInt64: ret = 1; break; case SqrtFloat32: case SqrtFloat64: ret = 2; break; + case SplatVecI8x16: + case SplatVecI16x8: + case SplatVecI32x4: + case SplatVecI64x2: + case SplatVecF32x4: + case SplatVecF64x2: + case NotVec128: + case NegVecI8x16: + case AnyTrueVecI8x16: + case AllTrueVecI8x16: + case NegVecI16x8: + case AnyTrueVecI16x8: + case AllTrueVecI16x8: + case NegVecI32x4: + case AnyTrueVecI32x4: + case AllTrueVecI32x4: + case NegVecI64x2: + case AnyTrueVecI64x2: + case AllTrueVecI64x2: + case AbsVecF32x4: + case NegVecF32x4: + case SqrtVecF32x4: + case AbsVecF64x2: + case NegVecF64x2: + case SqrtVecF64x2: + case TruncSatSVecF32x4ToVecI32x4: + case TruncSatUVecF32x4ToVecI32x4: + case TruncSatSVecF64x2ToVecI64x2: + case TruncSatUVecF64x2ToVecI64x2: + case ConvertSVecI32x4ToVecF32x4: + case ConvertUVecI32x4ToVecF32x4: + case ConvertSVecI64x2ToVecF64x2: + case ConvertUVecI64x2ToVecF64x2: assert(false && "v128 not implemented yet"); case InvalidUnary: WASM_UNREACHABLE(); } return ret + visit(curr->value); @@ -235,6 +268,82 @@ struct CostAnalyzer : public Visitor { case NeFloat32: ret = 1; break; case EqFloat64: ret = 1; break; case NeFloat64: ret = 1; break; + case EqVecI8x16: + case NeVecI8x16: + case LtSVecI8x16: + case LtUVecI8x16: + case LeSVecI8x16: + case LeUVecI8x16: + case GtSVecI8x16: + case GtUVecI8x16: + case GeSVecI8x16: + case GeUVecI8x16: + case EqVecI16x8: + case NeVecI16x8: + case LtSVecI16x8: + case LtUVecI16x8: + case LeSVecI16x8: + case LeUVecI16x8: + case GtSVecI16x8: + case GtUVecI16x8: + case GeSVecI16x8: + case GeUVecI16x8: + case EqVecI32x4: + case NeVecI32x4: + case LtSVecI32x4: + case LtUVecI32x4: + case LeSVecI32x4: + case LeUVecI32x4: + case GtSVecI32x4: + case GtUVecI32x4: + case GeSVecI32x4: + case GeUVecI32x4: + case EqVecF32x4: + case NeVecF32x4: + case LtVecF32x4: + case LeVecF32x4: + case GtVecF32x4: + case GeVecF32x4: + case EqVecF64x2: + case NeVecF64x2: + case LtVecF64x2: + case LeVecF64x2: + case GtVecF64x2: + case GeVecF64x2: + case AndVec128: + case OrVec128: + case XorVec128: + case AddVecI8x16: + case AddSatSVecI8x16: + case AddSatUVecI8x16: + case SubVecI8x16: + case SubSatSVecI8x16: + case SubSatUVecI8x16: + case MulVecI8x16: + case AddVecI16x8: + case AddSatSVecI16x8: + case AddSatUVecI16x8: + case SubVecI16x8: + case SubSatSVecI16x8: + case SubSatUVecI16x8: + case MulVecI16x8: + case AddVecI32x4: + case SubVecI32x4: + case MulVecI32x4: + case AddVecI64x2: + case SubVecI64x2: + case AddVecF32x4: + case SubVecF32x4: + case MulVecF32x4: + case DivVecF32x4: + case MinVecF32x4: + case MaxVecF32x4: + case AddVecF64x2: + case SubVecF64x2: + case MulVecF64x2: + case DivVecF64x2: + case MinVecF64x2: + case MaxVecF64x2: assert(false && "v128 not implemented yet"); case InvalidBinary: WASM_UNREACHABLE(); } return ret + visit(curr->left) + visit(curr->right); diff --git a/src/ir/utils.h b/src/ir/utils.h index a4082b6bcf5..afb63b01ca8 100644 --- a/src/ir/utils.h +++ b/src/ir/utils.h @@ -129,6 +129,11 @@ struct ReFinalize : public WalkerPass { void visitAtomicCmpxchg(AtomicCmpxchg* curr) { curr->finalize(); } void visitAtomicWait(AtomicWait* curr) { curr->finalize(); } void visitAtomicWake(AtomicWake* curr) { curr->finalize(); } + void visitSIMDExtract(SIMDExtract* curr) { curr->finalize(); } + void visitSIMDReplace(SIMDReplace* curr) { curr->finalize(); } + void visitSIMDShuffle(SIMDShuffle* curr) { curr->finalize(); } + void visitSIMDBitselect(SIMDBitselect* curr) { curr->finalize(); } + void visitSIMDShift(SIMDShift* curr) { curr->finalize(); } void visitConst(Const* curr) { curr->finalize(); } void visitUnary(Unary* curr) { curr->finalize(); } void visitBinary(Binary* curr) { curr->finalize(); } diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp index 2e62197b5e7..6e70fc55db5 100644 --- a/src/passes/DeadCodeElimination.cpp +++ b/src/passes/DeadCodeElimination.cpp @@ -257,6 +257,11 @@ struct DeadCodeElimination : public WalkerPass> case Expression::Id::AtomicRMWId: DELEGATE(AtomicRMW); case Expression::Id::AtomicWaitId: DELEGATE(AtomicWait); case Expression::Id::AtomicWakeId: DELEGATE(AtomicWake); + case Expression::Id::SIMDExtractId: DELEGATE(SIMDExtract); + case Expression::Id::SIMDReplaceId: DELEGATE(SIMDReplace); + case Expression::Id::SIMDShuffleId: DELEGATE(SIMDShuffle); + case Expression::Id::SIMDBitselectId: DELEGATE(SIMDBitselect); + case Expression::Id::SIMDShiftId: DELEGATE(SIMDShift); case Expression::Id::InvalidId: WASM_UNREACHABLE(); case Expression::Id::NumExpressionIds: WASM_UNREACHABLE(); } diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 51c7e9f97da..d759d1378ed 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -234,6 +234,60 @@ struct PrintExpressionContents : public Visitor { o << " offset=" << curr->offset; } } + void visitSIMDExtract(SIMDExtract* curr) { + prepareColor(o); + switch (curr->op) { + case ExtractLaneSVecI8x16: o << "i8x16.extract_lane_s"; break; + case ExtractLaneUVecI8x16: o << "i8x16.extract_lane_u"; break; + case ExtractLaneSVecI16x8: o << "i16x8.extract_lane_s"; break; + case ExtractLaneUVecI16x8: o << "i16x8.extract_lane_u"; break; + case ExtractLaneVecI32x4: o << "i32x4.extract_lane"; break; + case ExtractLaneVecI64x2: o << "i64x2.extract_lane"; break; + case ExtractLaneVecF32x4: o << "i32x4.extract_lane"; break; + case ExtractLaneVecF64x2: o << "f64x2.extract_lane"; break; + } + o << " " << int(curr->idx); + } + void visitSIMDReplace(SIMDReplace* curr) { + prepareColor(o); + switch (curr->op) { + case ReplaceLaneVecI8x16: o << "i8x16.replace_lane"; break; + case ReplaceLaneVecI16x8: o << "i16x8.replace_lane"; break; + case ReplaceLaneVecI32x4: o << "i32x4.replace_lane"; break; + case ReplaceLaneVecI64x2: o << "i64x2.replace_lane"; break; + case ReplaceLaneVecF32x4: o << "i32x4.replace_lane"; break; + case ReplaceLaneVecF64x2: o << "f64x2.replace_lane"; break; + } + o << " " << int(curr->idx); + } + void visitSIMDShuffle(SIMDShuffle* curr) { + prepareColor(o); + o << "v8x16.shuffle"; + for (uint8_t mask_index : curr->mask) { + o << " " << std::to_string(mask_index); + } + } + void visitSIMDBitselect(SIMDBitselect* curr) { + prepareColor(o); + o << "v128.bitselect"; + } + void visitSIMDShift(SIMDShift* curr) { + prepareColor(o); + switch (curr->op) { + case ShlVecI8x16: o << "i8x16.shl"; break; + case ShrSVecI8x16: o << "i8x16.shr_s"; break; + case ShrUVecI8x16: o << "i8x16.shr_u"; break; + case ShlVecI16x8: o << "i16x8.shl"; break; + case ShrSVecI16x8: o << "i16x8.shr_s"; break; + case ShrUVecI16x8: o << "i16x8.shr_u"; break; + case ShlVecI32x4: o << "i32x4.shl"; break; + case ShrSVecI32x4: o << "i32x4.shr_s"; break; + case ShrUVecI32x4: o << "i32x4.shr_u"; break; + case ShlVecI64x2: o << "i64x2.shl"; break; + case ShrSVecI64x2: o << "i64x2.shr_s"; break; + case ShrUVecI64x2: o << "i64x2.shr_u"; break; + } + } void visitConst(Const* curr) { o << curr->value; } @@ -262,36 +316,36 @@ struct PrintExpressionContents : public Visitor { case TruncFloat64: o << "f64.trunc"; break; case NearestFloat64: o << "f64.nearest"; break; case SqrtFloat64: o << "f64.sqrt"; break; - case ExtendSInt32: o << "i64.extend_s/i32"; break; - case ExtendUInt32: o << "i64.extend_u/i32"; break; - case WrapInt64: o << "i32.wrap/i64"; break; - case TruncSFloat32ToInt32: o << "i32.trunc_s/f32"; break; - case TruncSFloat32ToInt64: o << "i64.trunc_s/f32"; break; - case TruncUFloat32ToInt32: o << "i32.trunc_u/f32"; break; - case TruncUFloat32ToInt64: o << "i64.trunc_u/f32"; break; - case TruncSFloat64ToInt32: o << "i32.trunc_s/f64"; break; - case TruncSFloat64ToInt64: o << "i64.trunc_s/f64"; break; - case TruncUFloat64ToInt32: o << "i32.trunc_u/f64"; break; - case TruncUFloat64ToInt64: o << "i64.trunc_u/f64"; break; + case ExtendSInt32: o << "i64.extend_s/i32"; break; + case ExtendUInt32: o << "i64.extend_u/i32"; break; + case WrapInt64: o << "i32.wrap/i64"; break; + case TruncSFloat32ToInt32: o << "i32.trunc_s/f32"; break; + case TruncSFloat32ToInt64: o << "i64.trunc_s/f32"; break; + case TruncUFloat32ToInt32: o << "i32.trunc_u/f32"; break; + case TruncUFloat32ToInt64: o << "i64.trunc_u/f32"; break; + case TruncSFloat64ToInt32: o << "i32.trunc_s/f64"; break; + case TruncSFloat64ToInt64: o << "i64.trunc_s/f64"; break; + case TruncUFloat64ToInt32: o << "i32.trunc_u/f64"; break; + case TruncUFloat64ToInt64: o << "i64.trunc_u/f64"; break; case ReinterpretFloat32: o << "i32.reinterpret/f32"; break; case ReinterpretFloat64: o << "i64.reinterpret/f64"; break; - case ConvertUInt32ToFloat32: o << "f32.convert_u/i32"; break; - case ConvertUInt32ToFloat64: o << "f64.convert_u/i32"; break; - case ConvertSInt32ToFloat32: o << "f32.convert_s/i32"; break; - case ConvertSInt32ToFloat64: o << "f64.convert_s/i32"; break; - case ConvertUInt64ToFloat32: o << "f32.convert_u/i64"; break; - case ConvertUInt64ToFloat64: o << "f64.convert_u/i64"; break; - case ConvertSInt64ToFloat32: o << "f32.convert_s/i64"; break; - case ConvertSInt64ToFloat64: o << "f64.convert_s/i64"; break; - case PromoteFloat32: o << "f64.promote/f32"; break; - case DemoteFloat64: o << "f32.demote/f64"; break; + case ConvertUInt32ToFloat32: o << "f32.convert_u/i32"; break; + case ConvertUInt32ToFloat64: o << "f64.convert_u/i32"; break; + case ConvertSInt32ToFloat32: o << "f32.convert_s/i32"; break; + case ConvertSInt32ToFloat64: o << "f64.convert_s/i32"; break; + case ConvertUInt64ToFloat32: o << "f32.convert_u/i64"; break; + case ConvertUInt64ToFloat64: o << "f64.convert_u/i64"; break; + case ConvertSInt64ToFloat32: o << "f32.convert_s/i64"; break; + case ConvertSInt64ToFloat64: o << "f64.convert_s/i64"; break; + case PromoteFloat32: o << "f64.promote/f32"; break; + case DemoteFloat64: o << "f32.demote/f64"; break; case ReinterpretInt32: o << "f32.reinterpret/i32"; break; case ReinterpretInt64: o << "f64.reinterpret/i64"; break; - case ExtendS8Int32: o << "i32.extend8_s"; break; - case ExtendS16Int32: o << "i32.extend16_s"; break; - case ExtendS8Int64: o << "i64.extend8_s"; break; - case ExtendS16Int64: o << "i64.extend16_s"; break; - case ExtendS32Int64: o << "i64.extend32_s"; break; + case ExtendS8Int32: o << "i32.extend8_s"; break; + case ExtendS16Int32: o << "i32.extend16_s"; break; + case ExtendS8Int64: o << "i64.extend8_s"; break; + case ExtendS16Int64: o << "i64.extend16_s"; break; + case ExtendS32Int64: o << "i64.extend32_s"; break; case TruncSatSFloat32ToInt32: o << "i32.trunc_s:sat/f32"; break; case TruncSatUFloat32ToInt32: o << "i32.trunc_u:sat/f32"; break; case TruncSatSFloat64ToInt32: o << "i32.trunc_s:sat/f64"; break; @@ -300,6 +354,39 @@ struct PrintExpressionContents : public Visitor { case TruncSatUFloat32ToInt64: o << "i64.trunc_u:sat/f32"; break; case TruncSatSFloat64ToInt64: o << "i64.trunc_s:sat/f64"; break; case TruncSatUFloat64ToInt64: o << "i64.trunc_u:sat/f64"; break; + case SplatVecI8x16: o << "i8x16.splat"; break; + case SplatVecI16x8: o << "i16x8.splat"; break; + case SplatVecI32x4: o << "i32x4.splat"; break; + case SplatVecI64x2: o << "i63x2.splat"; break; + case SplatVecF32x4: o << "f32x4.splat"; break; + case SplatVecF64x2: o << "f64x2.splat"; break; + case NotVec128: o << "v128.not"; break; + case NegVecI8x16: o << "i8x16.neg"; break; + case AnyTrueVecI8x16: o << "i8x16.any_true"; break; + case AllTrueVecI8x16: o << "i8x16.all_true"; break; + case NegVecI16x8: o << "i16x8.neg"; break; + case AnyTrueVecI16x8: o << "i16x8.any_true"; break; + case AllTrueVecI16x8: o << "i16x8.all_true"; break; + case NegVecI32x4: o << "i32x4.neg"; break; + case AnyTrueVecI32x4: o << "i32x4.any_true"; break; + case AllTrueVecI32x4: o << "i32x4.all_true"; break; + case NegVecI64x2: o << "i64x2.neg"; break; + case AnyTrueVecI64x2: o << "i64x2.any_true"; break; + case AllTrueVecI64x2: o << "i64x2.all_true"; break; + case AbsVecF32x4: o << "f32x4.abs"; break; + case NegVecF32x4: o << "f32x4.neg"; break; + case SqrtVecF32x4: o << "f32x4.sqrt"; break; + case AbsVecF64x2: o << "f64x2.abs"; break; + case NegVecF64x2: o << "f64x2.neg"; break; + case SqrtVecF64x2: o << "f64x2.sqrt"; break; + case TruncSatSVecF32x4ToVecI32x4: o << "i32x4.trunc_s/f32x4:sat"; break; + case TruncSatUVecF32x4ToVecI32x4: o << "i32x4.trunc_u/f32x4:sat"; break; + case TruncSatSVecF64x2ToVecI64x2: o << "i64x2.trunc_s/f64x2:sat"; break; + case TruncSatUVecF64x2ToVecI64x2: o << "i64x2.trunc_u/f64x2:sat"; break; + case ConvertSVecI32x4ToVecF32x4: o << "f32x4.convert_s/i32x4"; break; + case ConvertUVecI32x4ToVecF32x4: o << "f32x4.convert_u/i32x4"; break; + case ConvertSVecI64x2ToVecF64x2: o << "f64x2.convert_s/i64x2"; break; + case ConvertUVecI64x2ToVecF64x2: o << "f64x2.convert_u/i64x2"; break; case InvalidUnary: WASM_UNREACHABLE(); } } @@ -386,6 +473,86 @@ struct PrintExpressionContents : public Visitor { case GtFloat64: o << "f64.gt"; break; case GeFloat64: o << "f64.ge"; break; + case EqVecI8x16: o << "i8x16.eq"; break; + case NeVecI8x16: o << "i8x16.ne"; break; + case LtSVecI8x16: o << "i8x16.lt_s"; break; + case LtUVecI8x16: o << "i8x16.lt_u"; break; + case GtSVecI8x16: o << "i8x16.gt_s"; break; + case GtUVecI8x16: o << "i8x16.gt_u"; break; + case LeSVecI8x16: o << "i8x16.le_s"; break; + case LeUVecI8x16: o << "i8x16.le_u"; break; + case GeSVecI8x16: o << "i8x16.ge_s"; break; + case GeUVecI8x16: o << "i8x16.ge_u"; break; + case EqVecI16x8: o << "i16x8.eq"; break; + case NeVecI16x8: o << "i16x8.ne"; break; + case LtSVecI16x8: o << "i16x8.lt_s"; break; + case LtUVecI16x8: o << "i16x8.lt_u"; break; + case GtSVecI16x8: o << "i16x8.gt_s"; break; + case GtUVecI16x8: o << "i16x8.gt_u"; break; + case LeSVecI16x8: o << "i16x8.le_s"; break; + case LeUVecI16x8: o << "i16x8.le_u"; break; + case GeSVecI16x8: o << "i16x8.ge_s"; break; + case GeUVecI16x8: o << "i16x8.ge_u"; break; + case EqVecI32x4: o << "i32x4.eq"; break; + case NeVecI32x4: o << "i32x4.ne"; break; + case LtSVecI32x4: o << "i32x4.lt_s"; break; + case LtUVecI32x4: o << "i32x4.lt_u"; break; + case GtSVecI32x4: o << "i32x4.gt_s"; break; + case GtUVecI32x4: o << "i32x4.gt_u"; break; + case LeSVecI32x4: o << "i32x4.le_s"; break; + case LeUVecI32x4: o << "i32x4.le_u"; break; + case GeSVecI32x4: o << "i32x4.ge_s"; break; + case GeUVecI32x4: o << "i32x4.ge_u"; break; + case EqVecF32x4: o << "f32x4.eq"; break; + case NeVecF32x4: o << "f32x4.ne"; break; + case LtVecF32x4: o << "f32x4.lt"; break; + case GtVecF32x4: o << "f32x4.gt"; break; + case LeVecF32x4: o << "f32x4.le"; break; + case GeVecF32x4: o << "f32x4.ge"; break; + case EqVecF64x2: o << "f64x2.eq"; break; + case NeVecF64x2: o << "f64x2.ne"; break; + case LtVecF64x2: o << "f64x2.lt"; break; + case GtVecF64x2: o << "f64x2.gt"; break; + case LeVecF64x2: o << "f64x2.le"; break; + case GeVecF64x2: o << "f64x2.ge"; break; + + case AndVec128: o << "v128.and"; break; + case OrVec128: o << "v128.or"; break; + case XorVec128: o << "v128.xor"; break; + + case AddVecI8x16: o << "i8x16.add"; break; + case AddSatSVecI8x16: o << "i8x16.add_saturate_s"; break; + case AddSatUVecI8x16: o << "i8x16.add_saturate_u"; break; + case SubVecI8x16: o << "i8x16.sub"; break; + case SubSatSVecI8x16: o << "i8x16.sub_saturate_s"; break; + case SubSatUVecI8x16: o << "i8x16.sub_saturate_u"; break; + case MulVecI8x16: o << "i8x16.mul"; break; + case AddVecI16x8: o << "i16x8.add"; break; + case AddSatSVecI16x8: o << "i16x8.add_saturate_s"; break; + case AddSatUVecI16x8: o << "i16x8.add_saturate_u"; break; + case SubVecI16x8: o << "i16x8.sub"; break; + case SubSatSVecI16x8: o << "i16x8.sub_saturate_s"; break; + case SubSatUVecI16x8: o << "i16x8.sub_saturate_u"; break; + case MulVecI16x8: o << "i16x8.mul"; break; + case AddVecI32x4: o << "i32x4.add"; break; + case SubVecI32x4: o << "i32x4.sub"; break; + case MulVecI32x4: o << "i32x4.mul"; break; + case AddVecI64x2: o << "i64x2.add"; break; + case SubVecI64x2: o << "i64x2.sub"; break; + + case AddVecF32x4: o << "f32x4.add"; break; + case SubVecF32x4: o << "f32x4.sub"; break; + case MulVecF32x4: o << "f32x4.mul"; break; + case DivVecF32x4: o << "f32x4.div"; break; + case MinVecF32x4: o << "f32x4.min"; break; + case MaxVecF32x4: o << "f32x4.max"; break; + case AddVecF64x2: o << "f64x2.add"; break; + case SubVecF64x2: o << "f64x2.sub"; break; + case MulVecF64x2: o << "f64x2.mul"; break; + case DivVecF64x2: o << "f64x2.div"; break; + case MinVecF64x2: o << "f64x2.min"; break; + case MaxVecF64x2: o << "f64x2.max"; break; + case InvalidBinary: WASM_UNREACHABLE(); } restoreNormalColor(o); @@ -724,6 +891,46 @@ struct PrintSExpression : public Visitor { printFullLine(curr->wakeCount); decIndent(); } + void visitSIMDExtract(SIMDExtract* curr) { + o << '('; + PrintExpressionContents(currFunction, o).visit(curr); + incIndent(); + printFullLine(curr->vec); + decIndent(); + } + void visitSIMDReplace(SIMDReplace* curr) { + o << '('; + PrintExpressionContents(currFunction, o).visit(curr); + incIndent(); + printFullLine(curr->vec); + printFullLine(curr->value); + decIndent(); + } + void visitSIMDShuffle(SIMDShuffle* curr) { + o << '('; + PrintExpressionContents(currFunction, o).visit(curr); + incIndent(); + printFullLine(curr->left); + printFullLine(curr->right); + decIndent(); + } + void visitSIMDBitselect(SIMDBitselect* curr) { + o << '('; + PrintExpressionContents(currFunction, o).visit(curr); + incIndent(); + printFullLine(curr->left); + printFullLine(curr->right); + printFullLine(curr->cond); + decIndent(); + } + void visitSIMDShift(SIMDShift* curr) { + o << '('; + PrintExpressionContents(currFunction, o).visit(curr); + incIndent(); + printFullLine(curr->vec); + printFullLine(curr->shift); + decIndent(); + } void visitConst(Const* curr) { o << '('; PrintExpressionContents(currFunction, o).visit(curr); diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 45052bcb259..36c9f21162b 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -330,6 +330,7 @@ enum EncodedType { i64 = -0x2, // 0x7e f32 = -0x3, // 0x7d f64 = -0x4, // 0x7c + v128 = -0x5, // 0x7b // elem_type AnyFunc = -0x10, // 0x70 // func_type form @@ -549,6 +550,7 @@ enum ASTNodes { I64ExtendS32 = 0xc4, TruncSatPrefix = 0xfc, + SIMDPrefix = 0xfd, AtomicPrefix = 0xfe }; @@ -639,6 +641,149 @@ enum TruncSatOpcodes { I64UTruncSatF64 = 0x07, }; +enum SIMDOpcodes { + V128Load = 0x00, + V128Store = 0x01, + V128Const = 0x02, + V8x16Shuffle = 0x03, + I8x16Splat = 0x04, + I8x16ExtractLaneS = 0x05, + I8x16ExtractLaneU = 0x06, + I8x16ReplaceLane = 0x07, + I16x8Splat = 0x08, + I16x8ExtractLaneS = 0x09, + I16x8ExtractLaneU = 0x0a, + I16x8ReplaceLane = 0x0b, + I32x4Splat = 0x0c, + I32x4ExtractLane = 0x0d, + I32x4ReplaceLane = 0x0e, + I64x2Splat = 0x0f, + I64x2ExtractLane = 0x10, + I64x2ReplaceLane = 0x11, + F32x4Splat = 0x12, + F32x4ExtractLane = 0x13, + F32x4ReplaceLane = 0x14, + F64x2Splat = 0x15, + F64x2ExtractLane = 0x16, + F64x2ReplaceLane = 0x17, + I8x16Eq = 0x18, + I8x16Ne = 0x19, + I8x16LtS = 0x1a, + I8x16LtU = 0x1b, + I8x16GtS = 0x1c, + I8x16GtU = 0x1d, + I8x16LeS = 0x1e, + I8x16LeU = 0x1f, + I8x16GeS = 0x20, + I8x16GeU = 0x21, + I16x8Eq = 0x22, + I16x8Ne = 0x23, + I16x8LtS = 0x24, + I16x8LtU = 0x25, + I16x8GtS = 0x26, + I16x8GtU = 0x27, + I16x8LeS = 0x28, + I16x8LeU = 0x29, + I16x8GeS = 0x2a, + I16x8GeU = 0x2b, + I32x4Eq = 0x2c, + I32x4Ne = 0x2d, + I32x4LtS = 0x2e, + I32x4LtU = 0x2f, + I32x4GtS = 0x30, + I32x4GtU = 0x31, + I32x4LeS = 0x32, + I32x4LeU = 0x33, + I32x4GeS = 0x34, + I32x4GeU = 0x35, + F32x4Eq = 0x40, + F32x4Ne = 0x41, + F32x4Lt = 0x42, + F32x4Gt = 0x43, + F32x4Le = 0x44, + F32x4Ge = 0x45, + F64x2Eq = 0x46, + F64x2Ne = 0x47, + F64x2Lt = 0x48, + F64x2Gt = 0x49, + F64x2Le = 0x4a, + F64x2Ge = 0x4b, + V128Not = 0x4c, + V128And = 0x4d, + V128Or = 0x4e, + V128Xor = 0x4f, + V128Bitselect = 0x50, + I8x16Neg = 0x51, + I8x16AnyTrue = 0x52, + I8x16AllTrue = 0x53, + I8x16Shl = 0x54, + I8x16ShrS = 0x55, + I8x16ShrU = 0x56, + I8x16Add = 0x57, + I8x16AddSatS = 0x58, + I8x16AddSatU = 0x59, + I8x16Sub = 0x5a, + I8x16SubSatS = 0x5b, + I8x16SubSatU = 0x5c, + I8x16Mul = 0x5d, + I16x8Neg = 0x62, + I16x8AnyTrue = 0x63, + I16x8AllTrue = 0x64, + I16x8Shl = 0x65, + I16x8ShrS = 0x66, + I16x8ShrU = 0x67, + I16x8Add = 0x68, + I16x8AddSatS = 0x69, + I16x8AddSatU = 0x6a, + I16x8Sub = 0x6b, + I16x8SubSatS = 0x6c, + I16x8SubSatU = 0x6d, + I16x8Mul = 0x6e, + I32x4Neg = 0x73, + I32x4AnyTrue = 0x74, + I32x4AllTrue = 0x75, + I32x4Shl = 0x76, + I32x4ShrS = 0x77, + I32x4ShrU = 0x78, + I32x4Add = 0x79, + I32x4Sub = 0x7c, + I32x4Mul = 0x7f, + I64x2Neg = 0x84, + I64x2AnyTrue = 0x85, + I64x2AllTrue = 0x86, + I64x2Shl = 0x87, + I64x2ShrS = 0x88, + I64x2ShrU = 0x89, + I64x2Add = 0x8a, + I64x2Sub = 0x8d, + F32x4Abs = 0x95, + F32x4Neg = 0x96, + F32x4Sqrt = 0x97, + F32x4Add = 0x9a, + F32x4Sub = 0x9b, + F32x4Mul = 0x9c, + F32x4Div = 0x9d, + F32x4Min = 0x9e, + F32x4Max = 0x9f, + F64x2Abs = 0xa0, + F64x2Neg = 0xa1, + F64x2Sqrt = 0xa2, + F64x2Add = 0xa5, + F64x2Sub = 0xa6, + F64x2Mul = 0xa7, + F64x2Div = 0xa8, + F64x2Min = 0xa9, + F64x2Max = 0xaa, + I32x4TruncSatSF32x4 = 0xab, + I32x4TruncSatUF32x4 = 0xac, + I64x2TruncSatSF64x2 = 0xad, + I64x2TruncSatUF64x2 = 0xae, + F32x4ConvertSI32x4 = 0xaf, + F32x4ConvertUI32x4 = 0xb0, + F64x2ConvertSI64x2 = 0xb1, + F64x2ConvertUI64x2 = 0xb2 +}; + enum MemoryAccess { Offset = 0x10, // bit 4 Alignment = 0x80, // bit 7 @@ -662,7 +807,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 v128: ret = BinaryConsts::EncodedType::v128; break; case unreachable: WASM_UNREACHABLE(); } return S32LEB(ret); @@ -814,9 +959,11 @@ class WasmBinaryBuilder { uint16_t getInt16(); uint32_t getInt32(); uint64_t getInt64(); + uint8_t getLaneIdx(size_t lanes); // it is unsafe to return a float directly, due to ABI issues with the signalling bit Literal getFloat32Literal(); Literal getFloat64Literal(); + Literal getVec128Literal(); uint32_t getU32LEB(); uint64_t getU64LEB(); int32_t getS32LEB(); @@ -948,6 +1095,7 @@ class WasmBinaryBuilder { void readMemoryAccess(Address& alignment, Address& offset); bool maybeVisitLoad(Expression*& out, uint8_t code, bool isAtomic); bool maybeVisitStore(Expression*& out, uint8_t code, bool isAtomic); + bool maybeVisitNontrappingTrunc(Expression*& out, uint32_t code); bool maybeVisitAtomicRMW(Expression*& out, uint8_t code); bool maybeVisitAtomicCmpxchg(Expression*& out, uint8_t code); bool maybeVisitAtomicWait(Expression*& out, uint8_t code); @@ -956,6 +1104,16 @@ class WasmBinaryBuilder { bool maybeVisitUnary(Expression*& out, uint8_t code); bool maybeVisitBinary(Expression*& out, uint8_t code); bool maybeVisitTruncSat(Expression*& out, uint32_t code); + bool maybeVisitSIMDBinary(Expression*& out, uint32_t code); + bool maybeVisitSIMDUnary(Expression*& out, uint32_t code); + bool maybeVisitSIMDConst(Expression*& out, uint32_t code); + bool maybeVisitSIMDLoad(Expression*& out, uint32_t code); + bool maybeVisitSIMDStore(Expression*& out, uint32_t code); + bool maybeVisitSIMDExtract(Expression*& out, uint32_t code); + bool maybeVisitSIMDReplace(Expression*& out, uint32_t code); + bool maybeVisitSIMDShuffle(Expression*& out, uint32_t code); + bool maybeVisitSIMDBitselect(Expression*& out, uint32_t code); + bool maybeVisitSIMDShift(Expression*& out, uint32_t code); void visitSelect(Select* curr); void visitReturn(Return* curr); bool maybeVisitHost(Expression*& out, uint8_t code); diff --git a/src/wasm-builder.h b/src/wasm-builder.h index f36ec7a88e7..8e6e39feb6d 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -474,7 +474,12 @@ class Builder { 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 v128: { + std::array bytes; + bytes.fill(0); + value = Literal(bytes.data()); + break; + } case none: return ExpressionManipulator::nop(curr); case unreachable: return ExpressionManipulator::convert(curr); } diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 8554dadedf6..8e962d3a3f2 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -303,7 +303,39 @@ class ExpressionRunner : public Visitor { case PromoteFloat32: return value.extendToF64(); case ReinterpretFloat64: return value.castToI64(); case DemoteFloat64: return value.demote(); - + case SplatVecI8x16: return value.splatI8x16(); + case SplatVecI16x8: return value.splatI16x8(); + case SplatVecI32x4: return value.splatI32x4(); + case SplatVecI64x2: return value.splatI64x2(); + case SplatVecF32x4: return value.splatF32x4(); + case SplatVecF64x2: return value.splatF64x2(); + case NotVec128: return value.notV128(); + case NegVecI8x16: return value.negI8x16(); + case AnyTrueVecI8x16: return value.anyTrueI8x16(); + case AllTrueVecI8x16: return value.allTrueI8x16(); + case NegVecI16x8: return value.negI16x8(); + case AnyTrueVecI16x8: return value.anyTrueI16x8(); + case AllTrueVecI16x8: return value.allTrueI16x8(); + case NegVecI32x4: return value.negI32x4(); + case AnyTrueVecI32x4: return value.anyTrueI32x4(); + case AllTrueVecI32x4: return value.allTrueI32x4(); + case NegVecI64x2: return value.negI64x2(); + case AnyTrueVecI64x2: return value.anyTrueI64x2(); + case AllTrueVecI64x2: return value.allTrueI64x2(); + case AbsVecF32x4: return value.absF32x4(); + case NegVecF32x4: return value.negF32x4(); + case SqrtVecF32x4: return value.sqrtF32x4(); + case AbsVecF64x2: return value.absF64x2(); + case NegVecF64x2: return value.negF64x2(); + case SqrtVecF64x2: return value.sqrtF64x2(); + case TruncSatSVecF32x4ToVecI32x4: return value.truncSatToSI32x4(); + case TruncSatUVecF32x4ToVecI32x4: return value.truncSatToUI32x4(); + case TruncSatSVecF64x2ToVecI64x2: return value.truncSatToSI64x2(); + case TruncSatUVecF64x2ToVecI64x2: return value.truncSatToUI64x2(); + case ConvertSVecI32x4ToVecF32x4: return value.convertSToF32x4(); + case ConvertUVecI32x4ToVecF32x4: return value.convertUToF32x4(); + case ConvertSVecI64x2ToVecF64x2: return value.convertSToF64x2(); + case ConvertUVecI64x2ToVecF64x2: return value.convertUToF64x2(); case InvalidUnary: WASM_UNREACHABLE(); } WASM_UNREACHABLE(); @@ -427,10 +459,172 @@ class ExpressionRunner : public Visitor { case MaxFloat32: case MaxFloat64: return left.max(right); + case EqVecI8x16: return left.eqI8x16(right); + case NeVecI8x16: return left.neI8x16(right); + case LtSVecI8x16: return left.ltSI8x16(right); + case LtUVecI8x16: return left.ltUI8x16(right); + case GtSVecI8x16: return left.gtSI8x16(right); + case GtUVecI8x16: return left.gtUI8x16(right); + case LeSVecI8x16: return left.leSI8x16(right); + case LeUVecI8x16: return left.leUI8x16(right); + case GeSVecI8x16: return left.geSI8x16(right); + case GeUVecI8x16: return left.geUI8x16(right); + case EqVecI16x8: return left.eqI16x8(right); + case NeVecI16x8: return left.neI16x8(right); + case LtSVecI16x8: return left.ltSI16x8(right); + case LtUVecI16x8: return left.ltUI16x8(right); + case GtSVecI16x8: return left.gtSI16x8(right); + case GtUVecI16x8: return left.gtUI16x8(right); + case LeSVecI16x8: return left.leSI16x8(right); + case LeUVecI16x8: return left.leUI16x8(right); + case GeSVecI16x8: return left.geSI16x8(right); + case GeUVecI16x8: return left.geUI16x8(right); + case EqVecI32x4: return left.eqI32x4(right); + case NeVecI32x4: return left.neI32x4(right); + case LtSVecI32x4: return left.ltSI32x4(right); + case LtUVecI32x4: return left.ltUI32x4(right); + case GtSVecI32x4: return left.gtSI32x4(right); + case GtUVecI32x4: return left.gtUI32x4(right); + case LeSVecI32x4: return left.leSI32x4(right); + case LeUVecI32x4: return left.leUI32x4(right); + case GeSVecI32x4: return left.geSI32x4(right); + case GeUVecI32x4: return left.geUI32x4(right); + case EqVecF32x4: return left.eqF32x4(right); + case NeVecF32x4: return left.neF32x4(right); + case LtVecF32x4: return left.ltF32x4(right); + case GtVecF32x4: return left.gtF32x4(right); + case LeVecF32x4: return left.leF32x4(right); + case GeVecF32x4: return left.geF32x4(right); + case EqVecF64x2: return left.eqF64x2(right); + case NeVecF64x2: return left.neF64x2(right); + case LtVecF64x2: return left.ltF64x2(right); + case GtVecF64x2: return left.gtF64x2(right); + case LeVecF64x2: return left.leF64x2(right); + case GeVecF64x2: return left.geF64x2(right); + + case AndVec128: return left.andV128(right); + case OrVec128: return left.orV128(right); + case XorVec128: return left.xorV128(right); + + case AddVecI8x16: return left.addI8x16(right); + case AddSatSVecI8x16: return left.addSaturateSI8x16(right); + case AddSatUVecI8x16: return left.addSaturateUI8x16(right); + case SubVecI8x16: return left.subI8x16(right); + case SubSatSVecI8x16: return left.subSaturateSI8x16(right); + case SubSatUVecI8x16: return left.subSaturateUI8x16(right); + case MulVecI8x16: return left.mulI8x16(right); + case AddVecI16x8: return left.addI16x8(right); + case AddSatSVecI16x8: return left.addSaturateSI16x8(right); + case AddSatUVecI16x8: return left.addSaturateUI16x8(right); + case SubVecI16x8: return left.subI16x8(right); + case SubSatSVecI16x8: return left.subSaturateSI16x8(right); + case SubSatUVecI16x8: return left.subSaturateUI16x8(right); + case MulVecI16x8: return left.mulI16x8(right); + case AddVecI32x4: return left.addI32x4(right); + case SubVecI32x4: return left.subI32x4(right); + case MulVecI32x4: return left.mulI32x4(right); + case AddVecI64x2: return left.addI64x2(right); + case SubVecI64x2: return left.subI64x2(right); + + case AddVecF32x4: return left.addF32x4(right); + case SubVecF32x4: return left.subF32x4(right); + case MulVecF32x4: return left.mulF32x4(right); + case DivVecF32x4: return left.divF32x4(right); + case MinVecF32x4: return left.minF32x4(right); + case MaxVecF32x4: return left.maxF32x4(right); + case AddVecF64x2: return left.addF64x2(right); + case SubVecF64x2: return left.subF64x2(right); + case MulVecF64x2: return left.mulF64x2(right); + case DivVecF64x2: return left.divF64x2(right); + case MinVecF64x2: return left.minF64x2(right); + case MaxVecF64x2: return left.maxF64x2(right); + case InvalidBinary: WASM_UNREACHABLE(); } WASM_UNREACHABLE(); } + Flow visitSIMDExtract(SIMDExtract *curr) { + NOTE_ENTER("SIMDExtract"); + Flow flow = this->visit(curr->vec); + if (flow.breaking()) return flow; + Literal vec = flow.value; + switch (curr->op) { + case ExtractLaneSVecI8x16: return vec.extractLaneSI8x16(curr->idx); + case ExtractLaneUVecI8x16: return vec.extractLaneUI8x16(curr->idx); + case ExtractLaneSVecI16x8: return vec.extractLaneSI16x8(curr->idx); + case ExtractLaneUVecI16x8: return vec.extractLaneUI16x8(curr->idx); + case ExtractLaneVecI32x4: return vec.extractLaneI32x4(curr->idx); + case ExtractLaneVecI64x2: return vec.extractLaneI64x2(curr->idx); + case ExtractLaneVecF32x4: return vec.extractLaneF32x4(curr->idx); + case ExtractLaneVecF64x2: return vec.extractLaneF64x2(curr->idx); + } + WASM_UNREACHABLE(); + } + Flow visitSIMDReplace(SIMDReplace *curr) { + NOTE_ENTER("SIMDReplace"); + Flow flow = this->visit(curr->vec); + if (flow.breaking()) return flow; + Literal vec = flow.value; + flow = this->visit(curr->value); + if (flow.breaking()) return flow; + Literal value = flow.value; + switch (curr->op) { + case ReplaceLaneVecI8x16: return vec.replaceLaneI8x16(value, curr->idx); + case ReplaceLaneVecI16x8: return vec.replaceLaneI16x8(value, curr->idx); + case ReplaceLaneVecI32x4: return vec.replaceLaneI32x4(value, curr->idx); + case ReplaceLaneVecI64x2: return vec.replaceLaneI64x2(value, curr->idx); + case ReplaceLaneVecF32x4: return vec.replaceLaneF32x4(value, curr->idx); + case ReplaceLaneVecF64x2: return vec.replaceLaneF64x2(value, curr->idx); + } + WASM_UNREACHABLE(); + } + Flow visitSIMDShuffle(SIMDShuffle *curr) { + NOTE_ENTER("SIMDShuffle"); + Flow flow = this->visit(curr->left); + if (flow.breaking()) return flow; + Literal left = flow.value; + flow = this->visit(curr->right); + if (flow.breaking()) return flow; + Literal right = flow.value; + return left.shuffleV8x16(right, curr->mask); + } + Flow visitSIMDBitselect(SIMDBitselect *curr) { + NOTE_ENTER("SIMDShuffle"); + Flow flow = this->visit(curr->left); + if (flow.breaking()) return flow; + Literal left = flow.value; + flow = this->visit(curr->right); + if (flow.breaking()) return flow; + Literal right = flow.value; + flow = this->visit(curr->cond); + if (flow.breaking()) return flow; + Literal cond = flow.value; + return cond.bitselectV128(left, right); + } + Flow visitSIMDShift(SIMDShift *curr) { + NOTE_ENTER("SIMDShift"); + Flow flow = this->visit(curr->vec); + if (flow.breaking()) return flow; + Literal vec = flow.value; + flow = this->visit(curr->shift); + if (flow.breaking()) return flow; + Literal shift = flow.value; + switch (curr->op) { + case ShlVecI8x16: return vec.shlI8x16(shift); + case ShrSVecI8x16: return vec.shrSI8x16(shift); + case ShrUVecI8x16: return vec.shrUI8x16(shift); + case ShlVecI16x8: return vec.shlI16x8(shift); + case ShrSVecI16x8: return vec.shrSI16x8(shift); + case ShrUVecI16x8: return vec.shrUI16x8(shift); + case ShlVecI32x4: return vec.shlI32x4(shift); + case ShrSVecI32x4: return vec.shrSI32x4(shift); + case ShrUVecI32x4: return vec.shrUI32x4(shift); + case ShlVecI64x2: return vec.shlI64x2(shift); + case ShrSVecI64x2: return vec.shrSI64x2(shift); + case ShrUVecI64x2: return vec.shrUI64x2(shift); + } + WASM_UNREACHABLE(); + } Flow visitSelect(Select *curr) { NOTE_ENTER("Select"); Flow ifTrue = visit(curr->ifTrue); diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 517398c5cd8..0845fa70e28 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -190,6 +190,11 @@ class SExpressionWasmBuilder { Expression* makeAtomicCmpxchg(Element& s, Type type, uint8_t bytes, const char* extra); Expression* makeAtomicWait(Element& s, Type type); Expression* makeAtomicWake(Element& s); + Expression* makeSIMDExtract(Element& s, SIMDExtractOp op, size_t lanes); + Expression* makeSIMDReplace(Element& s, SIMDReplaceOp op, size_t lanes); + Expression* makeSIMDShuffle(Element& s); + Expression* makeSIMDBitselect(Element& s); + Expression* makeSIMDShift(Element& s, SIMDShiftOp); Expression* makeIf(Element& s); Expression* makeMaybeBlock(Element& s, size_t i, Type type); Expression* makeLoop(Element& s); diff --git a/src/wasm-stack.h b/src/wasm-stack.h index 6e1150981f4..d092c2d2c36 100644 --- a/src/wasm-stack.h +++ b/src/wasm-stack.h @@ -135,6 +135,11 @@ class StackWriter : public Visitor> { void visitAtomicCmpxchg(AtomicCmpxchg* curr); void visitAtomicWait(AtomicWait* curr); void visitAtomicWake(AtomicWake* curr); + void visitSIMDExtract(SIMDExtract* curr); + void visitSIMDReplace(SIMDReplace* curr); + void visitSIMDShuffle(SIMDShuffle* curr); + void visitSIMDBitselect(SIMDBitselect* curr); + void visitSIMDShift(SIMDShift* curr); void visitConst(Const* curr); void visitUnary(Unary* curr); void visitBinary(Binary* curr); @@ -634,7 +639,7 @@ void StackWriter::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 v128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Load); break; case unreachable: return; // the pointer is unreachable, so we are never reached; just don't emit a load case none: WASM_UNREACHABLE(); } @@ -701,7 +706,7 @@ void StackWriter::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 v128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Store); break; case none: case unreachable: WASM_UNREACHABLE(); } @@ -871,6 +876,84 @@ void StackWriter::visitAtomicWake(AtomicWake* curr) { emitMemoryAccess(4, 4, 0); } +template +void StackWriter::visitSIMDExtract(SIMDExtract* curr) { + visitChild(curr->vec); + if (justAddToStack(curr)) return; + o << int8_t(BinaryConsts::SIMDPrefix); + switch (curr->op) { + case ExtractLaneSVecI8x16: o << U32LEB(BinaryConsts::I8x16ExtractLaneS); break; + case ExtractLaneUVecI8x16: o << U32LEB(BinaryConsts::I8x16ExtractLaneU); break; + case ExtractLaneSVecI16x8: o << U32LEB(BinaryConsts::I16x8ExtractLaneS); break; + case ExtractLaneUVecI16x8: o << U32LEB(BinaryConsts::I16x8ExtractLaneU); break; + case ExtractLaneVecI32x4: o << U32LEB(BinaryConsts::I32x4ExtractLane); break; + case ExtractLaneVecI64x2: o << U32LEB(BinaryConsts::I64x2ExtractLane); break; + case ExtractLaneVecF32x4: o << U32LEB(BinaryConsts::F32x4ExtractLane); break; + case ExtractLaneVecF64x2: o << U32LEB(BinaryConsts::F64x2ExtractLane); break; + } + o << uint8_t(curr->idx); +} + +template +void StackWriter::visitSIMDReplace(SIMDReplace* curr) { + visitChild(curr->vec); + visitChild(curr->value); + if (justAddToStack(curr)) return; + o << int8_t(BinaryConsts::SIMDPrefix); + switch (curr->op) { + case ReplaceLaneVecI8x16: o << U32LEB(BinaryConsts::I8x16ReplaceLane); break; + case ReplaceLaneVecI16x8: o << U32LEB(BinaryConsts::I16x8ReplaceLane); break; + case ReplaceLaneVecI32x4: o << U32LEB(BinaryConsts::I32x4ReplaceLane); break; + case ReplaceLaneVecI64x2: o << U32LEB(BinaryConsts::I64x2ReplaceLane); break; + case ReplaceLaneVecF32x4: o << U32LEB(BinaryConsts::F32x4ReplaceLane); break; + case ReplaceLaneVecF64x2: o << U32LEB(BinaryConsts::F64x2ReplaceLane); break; + } + assert(curr->idx < 16); + o << uint8_t(curr->idx); +} + +template +void StackWriter::visitSIMDShuffle(SIMDShuffle* curr) { + visitChild(curr->left); + visitChild(curr->right); + if (justAddToStack(curr)) return; + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V8x16Shuffle); + for (uint8_t m : curr->mask) { + o << m; + } +} + +template +void StackWriter::visitSIMDBitselect(SIMDBitselect* curr) { + visitChild(curr->left); + visitChild(curr->right); + visitChild(curr->cond); + if (justAddToStack(curr)) return; + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Bitselect); +} + +template +void StackWriter::visitSIMDShift(SIMDShift* curr) { + visitChild(curr->vec); + visitChild(curr->shift); + if (justAddToStack(curr)) return; + o << int8_t(BinaryConsts::SIMDPrefix); + switch (curr->op) { + case ShlVecI8x16: o << U32LEB(BinaryConsts::I8x16Shl); break; + case ShrSVecI8x16: o << U32LEB(BinaryConsts::I8x16ShrS); break; + case ShrUVecI8x16: o << U32LEB(BinaryConsts::I8x16ShrU); break; + case ShlVecI16x8: o << U32LEB(BinaryConsts::I16x8Shl); break; + case ShrSVecI16x8: o << U32LEB(BinaryConsts::I16x8ShrS); break; + case ShrUVecI16x8: o << U32LEB(BinaryConsts::I16x8ShrU); break; + case ShlVecI32x4: o << U32LEB(BinaryConsts::I32x4Shl); break; + case ShrSVecI32x4: o << U32LEB(BinaryConsts::I32x4ShrS); break; + case ShrUVecI32x4: o << U32LEB(BinaryConsts::I32x4ShrU); break; + case ShlVecI64x2: o << U32LEB(BinaryConsts::I64x2Shl); break; + case ShrSVecI64x2: o << U32LEB(BinaryConsts::I64x2ShrS); break; + case ShrUVecI64x2: o << U32LEB(BinaryConsts::I64x2ShrU); break; + } +} + template void StackWriter::visitConst(Const* curr) { if (debug) std::cerr << "zz node: Const" << curr << " : " << curr->type << std::endl; @@ -892,9 +975,17 @@ void StackWriter::visitConst(Const* curr) { o << int8_t(BinaryConsts::F64Const) << curr->value.reinterpreti64(); break; } - case v128: assert(false && "v128 not implemented yet"); + case v128: { + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Const); + std::array v = curr->value.getv128(); + for (size_t i = 0; i < 16; ++i) { + o << uint8_t(v[i]); + } + break; + } case none: - case unreachable: WASM_UNREACHABLE(); + case unreachable: + WASM_UNREACHABLE(); } if (debug) std::cerr << "zz const node done.\n"; } @@ -969,6 +1060,39 @@ void StackWriter::visitUnary(Unary* curr) { case TruncSatUFloat32ToInt64: o << int8_t(BinaryConsts::TruncSatPrefix) << U32LEB(BinaryConsts::I64UTruncSatF32); break; case TruncSatSFloat64ToInt64: o << int8_t(BinaryConsts::TruncSatPrefix) << U32LEB(BinaryConsts::I64STruncSatF64); break; case TruncSatUFloat64ToInt64: o << int8_t(BinaryConsts::TruncSatPrefix) << U32LEB(BinaryConsts::I64UTruncSatF64); break; + case SplatVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Splat); break; + case SplatVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Splat); break; + case SplatVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Splat); break; + case SplatVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2Splat); break; + case SplatVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Splat); break; + case SplatVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Splat); break; + case NotVec128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Not); break; + case NegVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Neg); break; + case AnyTrueVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16AnyTrue); break; + case AllTrueVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16AllTrue); break; + case NegVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Neg); break; + case AnyTrueVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8AnyTrue); break; + case AllTrueVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8AllTrue); break; + case NegVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Neg); break; + case AnyTrueVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4AnyTrue); break; + case AllTrueVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4AllTrue); break; + case NegVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2Neg); break; + case AnyTrueVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2AnyTrue); break; + case AllTrueVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2AllTrue); break; + case AbsVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Abs); break; + case NegVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Neg); break; + case SqrtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Sqrt); break; + case AbsVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Abs); break; + case NegVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Neg); break; + case SqrtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Sqrt); break; + case TruncSatSVecF32x4ToVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4TruncSatSF32x4); break; + case TruncSatUVecF32x4ToVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4TruncSatUF32x4); break; + case TruncSatSVecF64x2ToVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2TruncSatSF64x2); break; + case TruncSatUVecF64x2ToVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2TruncSatUF64x2); break; + case ConvertSVecI32x4ToVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4ConvertSI32x4); break; + case ConvertUVecI32x4ToVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4ConvertUI32x4); break; + case ConvertSVecI64x2ToVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2ConvertSI64x2); break; + case ConvertUVecI64x2ToVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2ConvertUI64x2); break; case InvalidUnary: WASM_UNREACHABLE(); } } @@ -1063,6 +1187,85 @@ void StackWriter::visitBinary(Binary* curr) { case LeFloat64: o << int8_t(BinaryConsts::F64Le); break; case GtFloat64: o << int8_t(BinaryConsts::F64Gt); break; case GeFloat64: o << int8_t(BinaryConsts::F64Ge); break; + + case EqVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Eq); break; + case NeVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Ne); break; + case LtSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LtS); break; + case LtUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LtU); break; + case LeSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GtS); break; + case LeUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GtU); break; + case GtSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LeS); break; + case GtUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LeU); break; + case GeSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GeS); break; + case GeUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GeU); break; + case EqVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Eq); break; + case NeVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Ne); break; + case LtSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LtS); break; + case LtUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LtU); break; + case LeSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GtS); break; + case LeUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GtU); break; + case GtSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LeS); break; + case GtUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LeU); break; + case GeSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GeS); break; + case GeUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GeU); break; + case EqVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Eq); break; + case NeVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Ne); break; + case LtSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LtS); break; + case LtUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LtU); break; + case LeSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GtS); break; + case LeUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GtU); break; + case GtSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LeS); break; + case GtUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LeU); break; + case GeSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GeS); break; + case GeUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GeU); break; + case EqVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Eq); break; + case NeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Ne); break; + case LtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Lt); break; + case LeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Gt); break; + case GtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Le); break; + case GeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Ge); break; + case EqVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Eq); break; + case NeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Ne); break; + case LtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Lt); break; + case LeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Gt); break; + case GtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Le); break; + case GeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Ge); break; + case AndVec128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128And); break; + case OrVec128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Or); break; + case XorVec128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Xor); break; + + case AddVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Add); break; + case AddSatSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16AddSatS); break; + case AddSatUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16AddSatU); break; + case SubVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Sub); break; + case SubSatSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16SubSatS); break; + case SubSatUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16SubSatU); break; + case MulVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Mul); break; + case AddVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Add); break; + case AddSatSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8AddSatS); break; + case AddSatUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8AddSatU); break; + case SubVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Sub); break; + case SubSatSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8SubSatS); break; + case SubSatUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8SubSatU); break; + case MulVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Mul); break; + case AddVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Add); break; + case SubVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Sub); break; + case MulVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Mul); break; + case AddVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2Add); break; + case SubVecI64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2Sub); break; + + case AddVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Add); break; + case SubVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Sub); break; + case MulVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Mul); break; + case DivVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Div); break; + case MinVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Min); break; + case MaxVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Max); break; + case AddVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Add); break; + case SubVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Sub); break; + case MulVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Mul); break; + case DivVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Div); break; + case MinVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Min); break; + case MaxVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Max); break; case InvalidBinary: WASM_UNREACHABLE(); } } diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h index 9ea1124d008..200a67cb6ec 100644 --- a/src/wasm-traversal.h +++ b/src/wasm-traversal.h @@ -54,6 +54,11 @@ struct Visitor { ReturnType visitAtomicCmpxchg(AtomicCmpxchg* curr) { return ReturnType(); } ReturnType visitAtomicWait(AtomicWait* curr) { return ReturnType(); } ReturnType visitAtomicWake(AtomicWake* curr) { return ReturnType(); } + ReturnType visitSIMDExtract(SIMDExtract* curr) { return ReturnType(); } + ReturnType visitSIMDReplace(SIMDReplace* curr) { return ReturnType(); } + ReturnType visitSIMDShuffle(SIMDShuffle* curr) { return ReturnType(); } + ReturnType visitSIMDBitselect(SIMDBitselect* curr) { return ReturnType(); } + ReturnType visitSIMDShift(SIMDShift* curr) { return ReturnType(); } ReturnType visitConst(Const* curr) { return ReturnType(); } ReturnType visitUnary(Unary* curr) { return ReturnType(); } ReturnType visitBinary(Binary* curr) { return ReturnType(); } @@ -97,6 +102,11 @@ struct Visitor { case Expression::Id::AtomicCmpxchgId: DELEGATE(AtomicCmpxchg); case Expression::Id::AtomicWaitId: DELEGATE(AtomicWait); case Expression::Id::AtomicWakeId: DELEGATE(AtomicWake); + case Expression::Id::SIMDExtractId: DELEGATE(SIMDExtract); + case Expression::Id::SIMDReplaceId: DELEGATE(SIMDReplace); + case Expression::Id::SIMDShuffleId: DELEGATE(SIMDShuffle); + case Expression::Id::SIMDBitselectId: DELEGATE(SIMDBitselect); + case Expression::Id::SIMDShiftId: DELEGATE(SIMDShift); case Expression::Id::ConstId: DELEGATE(Const); case Expression::Id::UnaryId: DELEGATE(Unary); case Expression::Id::BinaryId: DELEGATE(Binary); @@ -142,6 +152,11 @@ struct OverriddenVisitor { UNIMPLEMENTED(AtomicCmpxchg); UNIMPLEMENTED(AtomicWait); UNIMPLEMENTED(AtomicWake); + UNIMPLEMENTED(SIMDExtract); + UNIMPLEMENTED(SIMDReplace); + UNIMPLEMENTED(SIMDShuffle); + UNIMPLEMENTED(SIMDBitselect); + UNIMPLEMENTED(SIMDShift); UNIMPLEMENTED(Const); UNIMPLEMENTED(Unary); UNIMPLEMENTED(Binary); @@ -186,6 +201,11 @@ struct OverriddenVisitor { case Expression::Id::AtomicCmpxchgId: DELEGATE(AtomicCmpxchg); case Expression::Id::AtomicWaitId: DELEGATE(AtomicWait); case Expression::Id::AtomicWakeId: DELEGATE(AtomicWake); + case Expression::Id::SIMDExtractId: DELEGATE(SIMDExtract); + case Expression::Id::SIMDReplaceId: DELEGATE(SIMDReplace); + case Expression::Id::SIMDShuffleId: DELEGATE(SIMDShuffle); + case Expression::Id::SIMDBitselectId: DELEGATE(SIMDBitselect); + case Expression::Id::SIMDShiftId: DELEGATE(SIMDShift); case Expression::Id::ConstId: DELEGATE(Const); case Expression::Id::UnaryId: DELEGATE(Unary); case Expression::Id::BinaryId: DELEGATE(Binary); @@ -229,6 +249,11 @@ struct UnifiedExpressionVisitor : public Visitor { ReturnType visitAtomicCmpxchg(AtomicCmpxchg* curr) { return static_cast(this)->visitExpression(curr); } ReturnType visitAtomicWait(AtomicWait* curr) { return static_cast(this)->visitExpression(curr); } ReturnType visitAtomicWake(AtomicWake* curr) { return static_cast(this)->visitExpression(curr); } + ReturnType visitSIMDExtract(SIMDExtract* curr) { return static_cast(this)->visitExpression(curr); } + ReturnType visitSIMDReplace(SIMDReplace* curr) { return static_cast(this)->visitExpression(curr); } + ReturnType visitSIMDShuffle(SIMDShuffle* curr) { return static_cast(this)->visitExpression(curr); } + ReturnType visitSIMDBitselect(SIMDBitselect* curr) { return static_cast(this)->visitExpression(curr); } + ReturnType visitSIMDShift(SIMDShift* curr) { return static_cast(this)->visitExpression(curr); } ReturnType visitConst(Const* curr) { return static_cast(this)->visitExpression(curr); } ReturnType visitUnary(Unary* curr) { return static_cast(this)->visitExpression(curr); } ReturnType visitBinary(Binary* curr) { return static_cast(this)->visitExpression(curr); } @@ -414,6 +439,11 @@ struct Walker : public VisitorType { static void doVisitAtomicCmpxchg(SubType* self, Expression** currp){ self->visitAtomicCmpxchg((*currp)->cast()); } static void doVisitAtomicWait(SubType* self, Expression** currp) { self->visitAtomicWait((*currp)->cast()); } static void doVisitAtomicWake(SubType* self, Expression** currp) { self->visitAtomicWake((*currp)->cast()); } + static void doVisitSIMDExtract(SubType* self, Expression** currp) { self->visitSIMDExtract((*currp)->cast()); } + static void doVisitSIMDReplace(SubType* self, Expression** currp) { self->visitSIMDReplace((*currp)->cast()); } + static void doVisitSIMDShuffle(SubType* self, Expression** currp) { self->visitSIMDShuffle((*currp)->cast()); } + static void doVisitSIMDBitselect(SubType* self, Expression** currp) { self->visitSIMDBitselect((*currp)->cast()); } + static void doVisitSIMDShift(SubType* self, Expression** currp) { self->visitSIMDShift((*currp)->cast()); } static void doVisitConst(SubType* self, Expression** currp) { self->visitConst((*currp)->cast()); } static void doVisitUnary(SubType* self, Expression** currp) { self->visitUnary((*currp)->cast()); } static void doVisitBinary(SubType* self, Expression** currp) { self->visitBinary((*currp)->cast()); } @@ -554,6 +584,36 @@ struct PostWalker : public Walker { self->pushTask(SubType::scan, &curr->cast()->ptr); break; } + case Expression::Id::SIMDExtractId: { + self->pushTask(SubType::doVisitSIMDExtract, currp); + self->pushTask(SubType::scan, &curr->cast()->vec); + break; + } + case Expression::Id::SIMDReplaceId: { + self->pushTask(SubType::doVisitSIMDReplace, currp); + self->pushTask(SubType::scan, &curr->cast()->vec); + self->pushTask(SubType::scan, &curr->cast()->value); + break; + } + case Expression::Id::SIMDShuffleId: { + self->pushTask(SubType::doVisitSIMDShuffle, currp); + self->pushTask(SubType::scan, &curr->cast()->left); + self->pushTask(SubType::scan, &curr->cast()->right); + break; + } + case Expression::Id::SIMDBitselectId: { + self->pushTask(SubType::doVisitSIMDBitselect, currp); + self->pushTask(SubType::scan, &curr->cast()->left); + self->pushTask(SubType::scan, &curr->cast()->right); + self->pushTask(SubType::scan, &curr->cast()->cond); + break; + } + case Expression::Id::SIMDShiftId: { + self->pushTask(SubType::doVisitSIMDShift, currp); + self->pushTask(SubType::scan, &curr->cast()->vec); + self->pushTask(SubType::scan, &curr->cast()->shift); + break; + } case Expression::Id::ConstId: { self->pushTask(SubType::doVisitConst, currp); break; diff --git a/src/wasm.h b/src/wasm.h index b7b835ebe4b..14ec00aceb2 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -43,7 +43,8 @@ struct FeatureSet { Atomics = 1 << 0, MutableGlobals = 1 << 1, TruncSat = 1 << 2, - All = Atomics | MutableGlobals | TruncSat + SIMD = 1 << 3, + All = Atomics | MutableGlobals | TruncSat | SIMD }; FeatureSet() : features(MVP) {} @@ -53,7 +54,8 @@ struct FeatureSet { bool hasAtomics() const { return features & Atomics; } bool hasMutableGlobals() const { return features & MutableGlobals; } bool hasTruncSat() const { return features & TruncSat; } - bool hasAll() const { return features & (Atomics | MutableGlobals | TruncSat); } + bool hasSIMD() const { return features & SIMD; } + bool hasAll() const { return features & All; } void makeMVP() { features = MVP; } void setAtomics(bool v = true) { @@ -65,6 +67,9 @@ struct FeatureSet { void setTruncSat(bool v = true) { features = v ? (features | TruncSat) : (features & ~TruncSat); } + void setSIMD(bool v = true) { + features = v ? (features | SIMD) : (features & ~SIMD); + } void setAll(bool v = true) { features = v ? All : MVP; } @@ -122,6 +127,15 @@ enum UnaryOp { // Saturating float-to-int TruncSatSFloat32ToInt32, TruncSatUFloat32ToInt32, TruncSatSFloat64ToInt32, TruncSatUFloat64ToInt32, TruncSatSFloat32ToInt64, TruncSatUFloat32ToInt64, TruncSatSFloat64ToInt64, TruncSatUFloat64ToInt64, + // SIMD splats + SplatVecI8x16, SplatVecI16x8, SplatVecI32x4, SplatVecI64x2, SplatVecF32x4, SplatVecF64x2, + // SIMD arithmetic + NotVec128, + NegVecI8x16, AnyTrueVecI8x16, AllTrueVecI8x16, NegVecI16x8, AnyTrueVecI16x8, AllTrueVecI16x8, + NegVecI32x4, AnyTrueVecI32x4, AllTrueVecI32x4, NegVecI64x2, AnyTrueVecI64x2, AllTrueVecI64x2, + AbsVecF32x4, NegVecF32x4, SqrtVecF32x4, AbsVecF64x2, NegVecF64x2, SqrtVecF64x2, + TruncSatSVecF32x4ToVecI32x4, TruncSatUVecF32x4ToVecI32x4, TruncSatSVecF64x2ToVecI64x2, TruncSatUVecF64x2ToVecI64x2, + ConvertSVecI32x4ToVecF32x4, ConvertUVecI32x4ToVecF32x4, ConvertSVecI64x2ToVecF64x2, ConvertUVecI64x2ToVecF64x2, InvalidUnary }; @@ -150,6 +164,19 @@ enum BinaryOp { // relational ops EqFloat64, NeFloat64, // int or float LtFloat64, LeFloat64, GtFloat64, GeFloat64, // float + // SIMD relational ops (return vectors) + EqVecI8x16, NeVecI8x16, LtSVecI8x16, LtUVecI8x16, LeSVecI8x16, LeUVecI8x16, GtSVecI8x16, GtUVecI8x16, GeSVecI8x16, GeUVecI8x16, + EqVecI16x8, NeVecI16x8, LtSVecI16x8, LtUVecI16x8, LeSVecI16x8, LeUVecI16x8, GtSVecI16x8, GtUVecI16x8, GeSVecI16x8, GeUVecI16x8, + EqVecI32x4, NeVecI32x4, LtSVecI32x4, LtUVecI32x4, LeSVecI32x4, LeUVecI32x4, GtSVecI32x4, GtUVecI32x4, GeSVecI32x4, GeUVecI32x4, + EqVecF32x4, NeVecF32x4, LtVecF32x4, LeVecF32x4, GtVecF32x4, GeVecF32x4, + EqVecF64x2, NeVecF64x2, LtVecF64x2, LeVecF64x2, GtVecF64x2, GeVecF64x2, + // SIMD arithmetic + AndVec128, OrVec128, XorVec128, + AddVecI8x16, AddSatSVecI8x16, AddSatUVecI8x16, SubVecI8x16, SubSatSVecI8x16, SubSatUVecI8x16, MulVecI8x16, + AddVecI16x8, AddSatSVecI16x8, AddSatUVecI16x8, SubVecI16x8, SubSatSVecI16x8, SubSatUVecI16x8, MulVecI16x8, + AddVecI32x4, SubVecI32x4, MulVecI32x4, AddVecI64x2, SubVecI64x2, + AddVecF32x4, SubVecF32x4, MulVecF32x4, DivVecF32x4, MinVecF32x4, MaxVecF32x4, + AddVecF64x2, SubVecF64x2, MulVecF64x2, DivVecF64x2, MinVecF64x2, MaxVecF64x2, InvalidBinary }; @@ -162,6 +189,20 @@ enum AtomicRMWOp { Add, Sub, And, Or, Xor, Xchg }; +enum SIMDExtractOp { + ExtractLaneSVecI8x16, ExtractLaneUVecI8x16, ExtractLaneSVecI16x8, ExtractLaneUVecI16x8, + ExtractLaneVecI32x4, ExtractLaneVecI64x2, ExtractLaneVecF32x4, ExtractLaneVecF64x2 +}; + +enum SIMDReplaceOp { + ReplaceLaneVecI8x16, ReplaceLaneVecI16x8, ReplaceLaneVecI32x4, ReplaceLaneVecI64x2, ReplaceLaneVecF32x4, ReplaceLaneVecF64x2 +}; + +enum SIMDShiftOp { + ShlVecI8x16, ShrSVecI8x16, ShrUVecI8x16, ShlVecI16x8, ShrSVecI16x8, ShrUVecI16x8, + ShlVecI32x4, ShrSVecI32x4, ShrUVecI32x4, ShlVecI64x2, ShrSVecI64x2, ShrUVecI64x2 +}; + // // Expressions // @@ -212,6 +253,11 @@ class Expression { AtomicCmpxchgId, AtomicWaitId, AtomicWakeId, + SIMDExtractId, + SIMDReplaceId, + SIMDShuffleId, + SIMDBitselectId, + SIMDShiftId, NumExpressionIds }; Id _id; @@ -508,6 +554,67 @@ class AtomicWake : public SpecificExpression { void finalize(); }; +class SIMDExtract : public SpecificExpression { + public: + SIMDExtract() = default; + SIMDExtract(MixedArena& allocator) : SIMDExtract() {} + + SIMDExtractOp op; + Expression* vec; + uint8_t idx; + + void finalize(); +}; + +class SIMDReplace : public SpecificExpression { + public: + SIMDReplace() = default; + SIMDReplace(MixedArena& allocator) : SIMDReplace() {} + + SIMDReplaceOp op; + Expression* vec; + uint8_t idx; + Expression* value; + + void finalize(); +}; + +class SIMDShuffle : public SpecificExpression { + public: + SIMDShuffle() = default; + SIMDShuffle(MixedArena& allocator) : SIMDShuffle() {} + + Expression* left; + Expression* right; + std::array mask; + + void finalize(); +}; + +class SIMDBitselect : public SpecificExpression { + public: + SIMDBitselect() = default; + SIMDBitselect(MixedArena& allocator) : SIMDBitselect() {} + + Expression* left; + Expression* right; + Expression* cond; + + void finalize(); +}; + +class SIMDShift : public SpecificExpression { + public: + SIMDShift() = default; + SIMDShift(MixedArena& allocator) : SIMDShift() {} + + SIMDShiftOp op; + Expression* vec; + Expression* shift; + + void finalize(); +}; + class Const : public SpecificExpression { public: Const() {} diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index c1cb0237556..a9a8b2b024e 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -757,6 +757,14 @@ uint64_t WasmBinaryBuilder::getInt64() { return ret; } +uint8_t WasmBinaryBuilder::getLaneIdx(size_t lanes) { + if (debug) std::cerr << "<==" << std::endl; + auto ret = getInt8(); + if (ret >= lanes) throwError("Illegal lane index"); + if (debug) std::cerr << "getLaneIdx(" << lanes << "): " << ret << " ==>" << std::endl; + return ret; +} + Literal WasmBinaryBuilder::getFloat32Literal() { if (debug) std::cerr << "<==" << std::endl; auto ret = Literal(getInt32()); @@ -773,6 +781,17 @@ Literal WasmBinaryBuilder::getFloat64Literal() { return ret; } +Literal WasmBinaryBuilder::getVec128Literal() { + if (debug) std::cerr << "<==" << std::endl; + std::array bytes; + for (auto i = 0; i < 16; ++i) { + bytes[i] = getInt8(); + } + auto ret = Literal(bytes.data()); + if (debug) std::cerr << "getVec128: " << ret << " ==>" << std::endl; + return ret; +} + uint32_t WasmBinaryBuilder::getU32LEB() { if (debug) std::cerr << "<==" << std::endl; U32LEB ret; @@ -822,6 +841,7 @@ Type WasmBinaryBuilder::getType() { case BinaryConsts::EncodedType::i64: return i64; case BinaryConsts::EncodedType::f32: return f32; case BinaryConsts::EncodedType::f64: return f64; + case BinaryConsts::EncodedType::v128: return v128; case BinaryConsts::EncodedType::AnyFunc: case BinaryConsts::EncodedType::Func: throwError("invalid wasm type: " + std::to_string(type)); @@ -1685,7 +1705,7 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) { case BinaryConsts::End: case BinaryConsts::Else: curr = nullptr; break; case BinaryConsts::AtomicPrefix: { - code = getInt8(); + code = static_cast(getU32LEB()); if (maybeVisitLoad(curr, code, /*isAtomic=*/true)) break; if (maybeVisitStore(curr, code, /*isAtomic=*/true)) break; if (maybeVisitAtomicRMW(curr, code)) break; @@ -1701,6 +1721,21 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) { throwError("invalid code after nontrapping float-to-int prefix: " + std::to_string(code)); break; } + case BinaryConsts::SIMDPrefix: { + uint32_t opcode = getU32LEB(); + if (maybeVisitSIMDBinary(curr, opcode)) break; + if (maybeVisitSIMDUnary(curr, opcode)) break; + if (maybeVisitSIMDConst(curr, opcode)) break; + if (maybeVisitSIMDLoad(curr, opcode)) break; + if (maybeVisitSIMDStore(curr, opcode)) break; + if (maybeVisitSIMDExtract(curr, opcode)) break; + if (maybeVisitSIMDReplace(curr, opcode)) break; + if (maybeVisitSIMDShuffle(curr, opcode)) break; + if (maybeVisitSIMDBitselect(curr, opcode)) break; + if (maybeVisitSIMDShift(curr, opcode)) break; + throwError("invalid code after SIMD prefix: " + std::to_string(opcode)); + break; + } default: { // otherwise, the code is a subcode TODO: optimize if (maybeVisitBinary(curr, code)) break; @@ -2085,7 +2120,6 @@ bool WasmBinaryBuilder::maybeVisitStore(Expression*& out, uint8_t code, bool isA return true; } - bool WasmBinaryBuilder::maybeVisitAtomicRMW(Expression*& out, uint8_t code) { if (code < BinaryConsts::AtomicRMWOps_Begin || code > BinaryConsts::AtomicRMWOps_End) return false; auto* curr = allocator.alloc(); @@ -2367,6 +2401,267 @@ bool WasmBinaryBuilder::maybeVisitBinary(Expression*& out, uint8_t code) { #undef FLOAT_TYPED_CODE } +bool WasmBinaryBuilder::maybeVisitSIMDBinary(Expression*& out, uint32_t code) { + Binary* curr; + switch (code) { + case BinaryConsts::I8x16Eq: curr = allocator.alloc(); curr->op = EqVecI8x16; break; + case BinaryConsts::I8x16Ne: curr = allocator.alloc(); curr->op = NeVecI8x16; break; + case BinaryConsts::I8x16LtS: curr = allocator.alloc(); curr->op = LtSVecI8x16; break; + case BinaryConsts::I8x16LtU: curr = allocator.alloc(); curr->op = LtUVecI8x16; break; + case BinaryConsts::I8x16GtS: curr = allocator.alloc(); curr->op = GtSVecI8x16; break; + case BinaryConsts::I8x16GtU: curr = allocator.alloc(); curr->op = GtUVecI8x16; break; + case BinaryConsts::I8x16LeS: curr = allocator.alloc(); curr->op = LeSVecI8x16; break; + case BinaryConsts::I8x16LeU: curr = allocator.alloc(); curr->op = LeUVecI8x16; break; + case BinaryConsts::I8x16GeS: curr = allocator.alloc(); curr->op = GeSVecI8x16; break; + case BinaryConsts::I8x16GeU: curr = allocator.alloc(); curr->op = GeUVecI8x16; break; + case BinaryConsts::I16x8Eq: curr = allocator.alloc(); curr->op = EqVecI16x8; break; + case BinaryConsts::I16x8Ne: curr = allocator.alloc(); curr->op = NeVecI16x8; break; + case BinaryConsts::I16x8LtS: curr = allocator.alloc(); curr->op = LtSVecI16x8; break; + case BinaryConsts::I16x8LtU: curr = allocator.alloc(); curr->op = LtUVecI16x8; break; + case BinaryConsts::I16x8GtS: curr = allocator.alloc(); curr->op = GtSVecI16x8; break; + case BinaryConsts::I16x8GtU: curr = allocator.alloc(); curr->op = GtUVecI16x8; break; + case BinaryConsts::I16x8LeS: curr = allocator.alloc(); curr->op = LeSVecI16x8; break; + case BinaryConsts::I16x8LeU: curr = allocator.alloc(); curr->op = LeUVecI16x8; break; + case BinaryConsts::I16x8GeS: curr = allocator.alloc(); curr->op = GeSVecI16x8; break; + case BinaryConsts::I16x8GeU: curr = allocator.alloc(); curr->op = GeUVecI16x8; break; + case BinaryConsts::I32x4Eq: curr = allocator.alloc(); curr->op = EqVecI32x4; break; + case BinaryConsts::I32x4Ne: curr = allocator.alloc(); curr->op = NeVecI32x4; break; + case BinaryConsts::I32x4LtS: curr = allocator.alloc(); curr->op = LtSVecI32x4; break; + case BinaryConsts::I32x4LtU: curr = allocator.alloc(); curr->op = LtUVecI32x4; break; + case BinaryConsts::I32x4GtS: curr = allocator.alloc(); curr->op = GtSVecI32x4; break; + case BinaryConsts::I32x4GtU: curr = allocator.alloc(); curr->op = GtUVecI32x4; break; + case BinaryConsts::I32x4LeS: curr = allocator.alloc(); curr->op = LeSVecI32x4; break; + case BinaryConsts::I32x4LeU: curr = allocator.alloc(); curr->op = LeUVecI32x4; break; + case BinaryConsts::I32x4GeS: curr = allocator.alloc(); curr->op = GeSVecI32x4; break; + case BinaryConsts::I32x4GeU: curr = allocator.alloc(); curr->op = GeUVecI32x4; break; + case BinaryConsts::F32x4Eq: curr = allocator.alloc(); curr->op = EqVecF32x4; break; + case BinaryConsts::F32x4Ne: curr = allocator.alloc(); curr->op = NeVecF32x4; break; + case BinaryConsts::F32x4Lt: curr = allocator.alloc(); curr->op = LtVecF32x4; break; + case BinaryConsts::F32x4Gt: curr = allocator.alloc(); curr->op = GtVecF32x4; break; + case BinaryConsts::F32x4Le: curr = allocator.alloc(); curr->op = LeVecF32x4; break; + case BinaryConsts::F32x4Ge: curr = allocator.alloc(); curr->op = GeVecF32x4; break; + case BinaryConsts::F64x2Eq: curr = allocator.alloc(); curr->op = EqVecF64x2; break; + case BinaryConsts::F64x2Ne: curr = allocator.alloc(); curr->op = NeVecF64x2; break; + case BinaryConsts::F64x2Lt: curr = allocator.alloc(); curr->op = LtVecF64x2; break; + case BinaryConsts::F64x2Gt: curr = allocator.alloc(); curr->op = GtVecF64x2; break; + case BinaryConsts::F64x2Le: curr = allocator.alloc(); curr->op = LeVecF64x2; break; + case BinaryConsts::F64x2Ge: curr = allocator.alloc(); curr->op = GeVecF64x2; break; + case BinaryConsts::V128And: curr = allocator.alloc(); curr->op = AndVec128; break; + case BinaryConsts::V128Or: curr = allocator.alloc(); curr->op = OrVec128; break; + case BinaryConsts::V128Xor: curr = allocator.alloc(); curr->op = XorVec128; break; + case BinaryConsts::I8x16Add: curr = allocator.alloc(); curr->op = AddVecI8x16; break; + case BinaryConsts::I8x16AddSatS: curr = allocator.alloc(); curr->op = AddSatSVecI8x16; break; + case BinaryConsts::I8x16AddSatU: curr = allocator.alloc(); curr->op = AddSatUVecI8x16; break; + case BinaryConsts::I8x16Sub: curr = allocator.alloc(); curr->op = SubVecI8x16; break; + case BinaryConsts::I8x16SubSatS: curr = allocator.alloc(); curr->op = SubSatSVecI8x16; break; + case BinaryConsts::I8x16SubSatU: curr = allocator.alloc(); curr->op = SubSatUVecI8x16; break; + case BinaryConsts::I8x16Mul: curr = allocator.alloc(); curr->op = MulVecI8x16; break; + case BinaryConsts::I16x8Add: curr = allocator.alloc(); curr->op = AddVecI16x8; break; + case BinaryConsts::I16x8AddSatS: curr = allocator.alloc(); curr->op = AddSatSVecI16x8; break; + case BinaryConsts::I16x8AddSatU: curr = allocator.alloc(); curr->op = AddSatUVecI16x8; break; + case BinaryConsts::I16x8Sub: curr = allocator.alloc(); curr->op = SubVecI16x8; break; + case BinaryConsts::I16x8SubSatS: curr = allocator.alloc(); curr->op = SubSatSVecI16x8; break; + case BinaryConsts::I16x8SubSatU: curr = allocator.alloc(); curr->op = SubSatUVecI16x8; break; + case BinaryConsts::I16x8Mul: curr = allocator.alloc(); curr->op = MulVecI16x8; break; + case BinaryConsts::I32x4Add: curr = allocator.alloc(); curr->op = AddVecI32x4; break; + case BinaryConsts::I32x4Sub: curr = allocator.alloc(); curr->op = SubVecI32x4; break; + case BinaryConsts::I32x4Mul: curr = allocator.alloc(); curr->op = MulVecI32x4; break; + case BinaryConsts::I64x2Add: curr = allocator.alloc(); curr->op = AddVecI64x2; break; + case BinaryConsts::I64x2Sub: curr = allocator.alloc(); curr->op = SubVecI64x2; break; + case BinaryConsts::F32x4Add: curr = allocator.alloc(); curr->op = AddVecF32x4; break; + case BinaryConsts::F32x4Sub: curr = allocator.alloc(); curr->op = SubVecF32x4; break; + case BinaryConsts::F32x4Mul: curr = allocator.alloc(); curr->op = MulVecF32x4; break; + case BinaryConsts::F32x4Div: curr = allocator.alloc(); curr->op = DivVecF32x4; break; + case BinaryConsts::F32x4Min: curr = allocator.alloc(); curr->op = MinVecF32x4; break; + case BinaryConsts::F32x4Max: curr = allocator.alloc(); curr->op = MaxVecF32x4; break; + case BinaryConsts::F64x2Add: curr = allocator.alloc(); curr->op = AddVecF64x2; break; + case BinaryConsts::F64x2Sub: curr = allocator.alloc(); curr->op = SubVecF64x2; break; + case BinaryConsts::F64x2Mul: curr = allocator.alloc(); curr->op = MulVecF64x2; break; + case BinaryConsts::F64x2Div: curr = allocator.alloc(); curr->op = DivVecF64x2; break; + case BinaryConsts::F64x2Min: curr = allocator.alloc(); curr->op = MinVecF64x2; break; + case BinaryConsts::F64x2Max: curr = allocator.alloc(); curr->op = MaxVecF64x2; break; + default: return false; + } + if (debug) std::cerr << "zz node: Binary" << std::endl; + curr->right = popNonVoidExpression(); + curr->left = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} +bool WasmBinaryBuilder::maybeVisitSIMDUnary(Expression*& out, uint32_t code) { + Unary* curr; + switch (code) { + case BinaryConsts::I8x16Splat: curr = allocator.alloc(); curr->op = SplatVecI8x16; break; + case BinaryConsts::I16x8Splat: curr = allocator.alloc(); curr->op = SplatVecI16x8; break; + case BinaryConsts::I32x4Splat: curr = allocator.alloc(); curr->op = SplatVecI32x4; break; + case BinaryConsts::I64x2Splat: curr = allocator.alloc(); curr->op = SplatVecI64x2; break; + case BinaryConsts::F32x4Splat: curr = allocator.alloc(); curr->op = SplatVecF32x4; break; + case BinaryConsts::F64x2Splat: curr = allocator.alloc(); curr->op = SplatVecF64x2; break; + case BinaryConsts::V128Not: curr = allocator.alloc(); curr->op = NotVec128; break; + case BinaryConsts::I8x16Neg: curr = allocator.alloc(); curr->op = NegVecI8x16; break; + case BinaryConsts::I8x16AnyTrue: curr = allocator.alloc(); curr->op = AnyTrueVecI8x16; break; + case BinaryConsts::I8x16AllTrue: curr = allocator.alloc(); curr->op = AllTrueVecI8x16; break; + case BinaryConsts::I16x8Neg: curr = allocator.alloc(); curr->op = NegVecI16x8; break; + case BinaryConsts::I16x8AnyTrue: curr = allocator.alloc(); curr->op = AnyTrueVecI16x8; break; + case BinaryConsts::I16x8AllTrue: curr = allocator.alloc(); curr->op = AllTrueVecI16x8; break; + case BinaryConsts::I32x4Neg: curr = allocator.alloc(); curr->op = NegVecI32x4; break; + case BinaryConsts::I32x4AnyTrue: curr = allocator.alloc(); curr->op = AnyTrueVecI32x4; break; + case BinaryConsts::I32x4AllTrue: curr = allocator.alloc(); curr->op = AllTrueVecI32x4; break; + case BinaryConsts::I64x2Neg: curr = allocator.alloc(); curr->op = NegVecI64x2; break; + case BinaryConsts::I64x2AnyTrue: curr = allocator.alloc(); curr->op = AnyTrueVecI64x2; break; + case BinaryConsts::I64x2AllTrue: curr = allocator.alloc(); curr->op = AllTrueVecI64x2; break; + case BinaryConsts::F32x4Abs: curr = allocator.alloc(); curr->op = AbsVecF32x4; break; + case BinaryConsts::F32x4Neg: curr = allocator.alloc(); curr->op = NegVecF32x4; break; + case BinaryConsts::F32x4Sqrt: curr = allocator.alloc(); curr->op = SqrtVecF32x4; break; + case BinaryConsts::F64x2Abs: curr = allocator.alloc(); curr->op = AbsVecF64x2; break; + case BinaryConsts::F64x2Neg: curr = allocator.alloc(); curr->op = NegVecF64x2; break; + case BinaryConsts::F64x2Sqrt: curr = allocator.alloc(); curr->op = SqrtVecF64x2; break; + case BinaryConsts::I32x4TruncSatSF32x4: curr = allocator.alloc(); curr->op = TruncSatSVecF32x4ToVecI32x4; break; + case BinaryConsts::I32x4TruncSatUF32x4: curr = allocator.alloc(); curr->op = TruncSatUVecF32x4ToVecI32x4; break; + case BinaryConsts::I64x2TruncSatSF64x2: curr = allocator.alloc(); curr->op = TruncSatSVecF64x2ToVecI64x2; break; + case BinaryConsts::I64x2TruncSatUF64x2: curr = allocator.alloc(); curr->op = TruncSatUVecF64x2ToVecI64x2; break; + case BinaryConsts::F32x4ConvertSI32x4: curr = allocator.alloc(); curr->op = ConvertSVecI32x4ToVecF32x4; break; + case BinaryConsts::F32x4ConvertUI32x4: curr = allocator.alloc(); curr->op = ConvertUVecI32x4ToVecF32x4; break; + case BinaryConsts::F64x2ConvertSI64x2: curr = allocator.alloc(); curr->op = ConvertSVecI64x2ToVecF64x2; break; + case BinaryConsts::F64x2ConvertUI64x2: curr = allocator.alloc(); curr->op = ConvertUVecI64x2ToVecF64x2; break; + default: return false; + } + curr->value = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDConst(Expression*& out, uint32_t code) { + if (code != BinaryConsts::V128Const) { + return false; + } + auto* curr = allocator.alloc(); + curr->value = getVec128Literal(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDLoad(Expression*& out, uint32_t code) { + if (code != BinaryConsts::V128Load) { + return false; + } + auto* curr = allocator.alloc(); + curr->type = v128; + curr->bytes = 16; + readMemoryAccess(curr->align, curr->offset); + curr->ptr = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDStore(Expression*& out, uint32_t code) { + if (code != BinaryConsts::V128Store) { + return false; + } + auto* curr = allocator.alloc(); + curr->bytes = 16; + curr->valueType = v128; + readMemoryAccess(curr->align, curr->offset); + curr->value = popNonVoidExpression(); + curr->ptr = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDExtract(Expression*& out, uint32_t code) { + SIMDExtract* curr; + switch (code) { + case BinaryConsts::I8x16ExtractLaneS: curr = allocator.alloc(); curr->op = ExtractLaneSVecI8x16; curr->idx = getLaneIdx(16); break; + case BinaryConsts::I8x16ExtractLaneU: curr = allocator.alloc(); curr->op = ExtractLaneUVecI8x16; curr->idx = getLaneIdx(16); break; + case BinaryConsts::I16x8ExtractLaneS: curr = allocator.alloc(); curr->op = ExtractLaneSVecI16x8; curr->idx = getLaneIdx(8); break; + case BinaryConsts::I16x8ExtractLaneU: curr = allocator.alloc(); curr->op = ExtractLaneUVecI16x8; curr->idx = getLaneIdx(8); break; + case BinaryConsts::I32x4ExtractLane: curr = allocator.alloc(); curr->op = ExtractLaneVecI32x4; curr->idx = getLaneIdx(4); break; + case BinaryConsts::I64x2ExtractLane: curr = allocator.alloc(); curr->op = ExtractLaneVecI64x2; curr->idx = getLaneIdx(2); break; + case BinaryConsts::F32x4ExtractLane: curr = allocator.alloc(); curr->op = ExtractLaneVecF32x4; curr->idx = getLaneIdx(4); break; + case BinaryConsts::F64x2ExtractLane: curr = allocator.alloc(); curr->op = ExtractLaneVecF64x2; curr->idx = getLaneIdx(2); break; + default: return false; + } + curr->vec = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDReplace(Expression*& out, uint32_t code) { + SIMDReplace* curr; + switch (code) { + case BinaryConsts::I8x16ReplaceLane: curr = allocator.alloc(); curr->op = ReplaceLaneVecI8x16; curr->idx = getLaneIdx(16); break; + case BinaryConsts::I16x8ReplaceLane: curr = allocator.alloc(); curr->op = ReplaceLaneVecI16x8; curr->idx = getLaneIdx(8); break; + case BinaryConsts::I32x4ReplaceLane: curr = allocator.alloc(); curr->op = ReplaceLaneVecI32x4; curr->idx = getLaneIdx(4); break; + case BinaryConsts::I64x2ReplaceLane: curr = allocator.alloc(); curr->op = ReplaceLaneVecI64x2; curr->idx = getLaneIdx(2); break; + case BinaryConsts::F32x4ReplaceLane: curr = allocator.alloc(); curr->op = ReplaceLaneVecF32x4; curr->idx = getLaneIdx(4); break; + case BinaryConsts::F64x2ReplaceLane: curr = allocator.alloc(); curr->op = ReplaceLaneVecF64x2; curr->idx = getLaneIdx(2); break; + default: return false; + } + curr->value = popNonVoidExpression(); + curr->vec = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDShuffle(Expression*& out, uint32_t code) { + if (code != BinaryConsts::V8x16Shuffle) { + return false; + } + auto* curr = allocator.alloc(); + for (auto i = 0; i < 16; ++i) { + curr->mask[i] = getLaneIdx(32); + } + curr->right = popNonVoidExpression(); + curr->left = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDBitselect(Expression*& out, uint32_t code) { + if (code != BinaryConsts::V128Bitselect) { + return false; + } + auto* curr = allocator.alloc(); + curr->cond = popNonVoidExpression(); + curr->right = popNonVoidExpression(); + curr->left = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + +bool WasmBinaryBuilder::maybeVisitSIMDShift(Expression*& out, uint32_t code) { + SIMDShift* curr; + switch (code) { + case BinaryConsts::I8x16Shl: curr = allocator.alloc(); curr->op = ShlVecI8x16; break; + case BinaryConsts::I8x16ShrS: curr = allocator.alloc(); curr->op = ShrSVecI8x16; break; + case BinaryConsts::I8x16ShrU: curr = allocator.alloc(); curr->op = ShrUVecI8x16; break; + case BinaryConsts::I16x8Shl: curr = allocator.alloc(); curr->op = ShlVecI16x8; break; + case BinaryConsts::I16x8ShrS: curr = allocator.alloc(); curr->op = ShrSVecI16x8; break; + case BinaryConsts::I16x8ShrU: curr = allocator.alloc(); curr->op = ShrUVecI16x8; break; + case BinaryConsts::I32x4Shl: curr = allocator.alloc(); curr->op = ShlVecI32x4; break; + case BinaryConsts::I32x4ShrS: curr = allocator.alloc(); curr->op = ShrSVecI32x4; break; + case BinaryConsts::I32x4ShrU: curr = allocator.alloc(); curr->op = ShrUVecI32x4; break; + case BinaryConsts::I64x2Shl: curr = allocator.alloc(); curr->op = ShlVecI64x2; break; + case BinaryConsts::I64x2ShrS: curr = allocator.alloc(); curr->op = ShrSVecI64x2; break; + case BinaryConsts::I64x2ShrU: curr = allocator.alloc(); curr->op = ShrUVecI64x2; break; + default: return false; + } + curr->vec = popNonVoidExpression(); + curr->shift = popNonVoidExpression(); + curr->finalize(); + out = curr; + return true; +} + void WasmBinaryBuilder::visitSelect(Select* curr) { if (debug) std::cerr << "zz node: Select" << std::endl; curr->condition = popNonVoidExpression(); diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index de1e4f2e94b..84f73102a1d 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -632,6 +632,11 @@ Type SExpressionWasmBuilder::stringToType(const char* str, bool allowError, bool if (str[1] == '3' && str[2] == '2' && (prefix || str[3] == 0)) return f32; if (str[1] == '6' && str[2] == '4' && (prefix || str[3] == 0)) return f64; } + if (str[0] == 'v') { + if (str[1] == '1' && str[2] == '2' && str[3] == '8' && (prefix || str[4] == 0)) { + return v128; + } + } if (allowError) return none; throw ParseException("invalid wasm type"); } @@ -1011,6 +1016,63 @@ Expression* SExpressionWasmBuilder::makeAtomicWake(Element& s) { return ret; } +static uint8_t parseLaneIdx(const Element* s, size_t lanes) { + const char *str = s->c_str(); + char *end; + auto n = static_cast(strtoll(str, &end, 10)); + if (end == str || *end != '\0') throw ParseException("Expected lane index"); + if (n > lanes) throw ParseException("lane index must be less than " + std::to_string(lanes)); + return uint8_t(n); +} + +Expression* SExpressionWasmBuilder::makeSIMDExtract(Element& s, SIMDExtractOp op, size_t lanes) { + auto ret = allocator.alloc(); + ret->op = op; + ret->idx = parseLaneIdx(s[1], lanes); + ret->vec = parseExpression(s[2]); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeSIMDReplace(Element& s, SIMDReplaceOp op, size_t lanes) { + auto ret = allocator.alloc(); + ret->op = op; + ret->idx = parseLaneIdx(s[1], lanes); + ret->vec = parseExpression(s[2]); + ret->value = parseExpression(s[3]); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeSIMDShuffle(Element& s) { + auto ret = allocator.alloc(); + for (size_t i = 0; i < 16; ++i) { + ret->mask[i] = parseLaneIdx(s[i+1], 32); + } + ret->left = parseExpression(s[17]); + ret->right = parseExpression(s[18]); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeSIMDBitselect(Element& s) { + auto ret = allocator.alloc(); + ret->left = parseExpression(s[1]); + ret->right = parseExpression(s[2]); + ret->cond = parseExpression(s[3]); + ret->finalize(); + return ret; +} + +Expression* SExpressionWasmBuilder::makeSIMDShift(Element& s, SIMDShiftOp op) { + auto ret = allocator.alloc(); + ret->op = op; + ret->vec = parseExpression(s[1]); + ret->shift = parseExpression(s[2]); + ret->finalize(); + return ret; +} + Expression* SExpressionWasmBuilder::makeIf(Element& s) { auto ret = allocator.alloc(); Index i = 1; diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 3f65c9f7a22..f05d2ea0377 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -245,6 +245,11 @@ struct FunctionValidator : public WalkerPass> { void visitAtomicCmpxchg(AtomicCmpxchg* curr); void visitAtomicWait(AtomicWait* curr); void visitAtomicWake(AtomicWake* curr); + void visitSIMDExtract(SIMDExtract* curr); + void visitSIMDReplace(SIMDReplace* curr); + void visitSIMDShuffle(SIMDShuffle* curr); + void visitSIMDBitselect(SIMDBitselect* curr); + void visitSIMDShift(SIMDShift* curr); void visitBinary(Binary* curr); void visitUnary(Unary* curr); void visitSelect(Select* curr); @@ -498,6 +503,7 @@ void FunctionValidator::visitSetGlobal(SetGlobal* curr) { void FunctionValidator::visitLoad(Load* curr) { if (curr->isAtomic) shouldBeTrue(info.features.hasAtomics(), curr, "Atomic operation (atomics are disabled)"); + if (curr->type == v128) shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); shouldBeFalse(curr->isAtomic && !getModule()->memory.shared, curr, "Atomic operation with non-shared memory"); validateMemBytes(curr->bytes, curr->type, curr); validateAlignment(curr->align, curr->type, curr->bytes, curr->isAtomic, curr); @@ -510,9 +516,10 @@ void FunctionValidator::visitLoad(Load* curr) { void FunctionValidator::visitStore(Store* curr) { if (curr->isAtomic) shouldBeTrue(info.features.hasAtomics(), curr, "Atomic operation (atomics are disabled)"); + if (curr->valueType == v128) shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); shouldBeFalse(curr->isAtomic && !getModule()->memory.shared, curr, "Atomic operation with non-shared memory"); validateMemBytes(curr->bytes, curr->valueType, curr); - validateAlignment(curr->align, curr->type, curr->bytes, curr->isAtomic, curr); + validateAlignment(curr->align, curr->valueType, curr->bytes, curr->isAtomic, curr); shouldBeEqualOrFirstIsUnreachable(curr->ptr->type, i32, curr, "store pointer type must be i32"); shouldBeUnequal(curr->value->type, none, curr, "store value type must not be none"); shouldBeEqualOrFirstIsUnreachable(curr->value->type, curr->valueType, curr, "store value type must match"); @@ -561,20 +568,77 @@ void FunctionValidator::visitAtomicWake(AtomicWake* curr) { shouldBeEqualOrFirstIsUnreachable(curr->wakeCount->type, i32, curr, "AtomicWake wakeCount type must be i32"); } +void FunctionValidator::visitSIMDExtract(SIMDExtract* curr) { + shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); + shouldBeEqualOrFirstIsUnreachable(curr->vec->type, v128, curr, "extract_lane must operate on a v128"); + Type lane_t; + size_t lanes; + switch (curr->op) { + case ExtractLaneSVecI8x16: + case ExtractLaneUVecI8x16: lane_t = i32; lanes = 16; break; + case ExtractLaneSVecI16x8: + case ExtractLaneUVecI16x8: lane_t = i32; lanes = 8; break; + case ExtractLaneVecI32x4: lane_t = i32; lanes = 4; break; + case ExtractLaneVecI64x2: lane_t = i64; lanes = 2; break; + case ExtractLaneVecF32x4: lane_t = f32; lanes = 4; break; + case ExtractLaneVecF64x2: lane_t = f64; lanes = 2; break; + } + shouldBeEqualOrFirstIsUnreachable(curr->type, lane_t, curr, "extract_lane must have same type as vector lane"); + shouldBeTrue(curr->idx < lanes, curr, "invalid lane index"); +} + +void FunctionValidator::visitSIMDReplace(SIMDReplace* curr) { + shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); + shouldBeEqualOrFirstIsUnreachable(curr->type, v128, curr, "replace_lane must have type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->vec->type, v128, curr, "replace_lane must operate on a v128"); + Type lane_t; + size_t lanes; + switch (curr->op) { + case ReplaceLaneVecI8x16: lane_t = i32; lanes = 16; break; + case ReplaceLaneVecI16x8: lane_t = i32; lanes = 8; break; + case ReplaceLaneVecI32x4: lane_t = i32; lanes = 4; break; + case ReplaceLaneVecI64x2: lane_t = i64; lanes = 2; break; + case ReplaceLaneVecF32x4: lane_t = f32; lanes = 4; break; + case ReplaceLaneVecF64x2: lane_t = f64; lanes = 2; break; + } + shouldBeEqualOrFirstIsUnreachable(curr->value->type, lane_t, curr, "unexpected value type"); + shouldBeTrue(curr->idx < lanes, curr, "invalid lane index"); +} + +void FunctionValidator::visitSIMDShuffle(SIMDShuffle* curr) { + shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); + shouldBeEqualOrFirstIsUnreachable(curr->type, v128, curr, "v128.shuffle must have type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->left->type, v128, curr, "expected operand of type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->right->type, v128, curr, "expected operand of type v128"); + for (uint8_t idx : curr->mask) { + shouldBeTrue(idx < 32, curr, "Invalid lane index in mask"); + } +} + +void FunctionValidator::visitSIMDBitselect(SIMDBitselect* curr) { + shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); + shouldBeEqualOrFirstIsUnreachable(curr->type, v128, curr, "v128.bitselect must have type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->left->type, v128, curr, "expected operand of type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->right->type, v128, curr, "expected operand of type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->cond->type, v128, curr, "expected operand of type v128"); +} + +void FunctionValidator::visitSIMDShift(SIMDShift* curr) { + shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); + shouldBeEqualOrFirstIsUnreachable(curr->type, v128, curr, "vector shift must have type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->vec->type, v128, curr, "expected operand of type v128"); + shouldBeEqualOrFirstIsUnreachable(curr->shift->type, i32, curr, "expected shift amount to have type i32"); +} + void FunctionValidator::validateMemBytes(uint8_t bytes, Type type, Expression* curr) { - switch (bytes) { - case 1: - case 2: - case 4: break; - case 8: { - // if we have a concrete type for the load, then we know the size of the mem operation and - // can validate it - if (type != unreachable) { - shouldBeEqual(getTypeSize(type), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types"); - } - break; - } - default: info.fail("Memory operations must be 1,2,4, or 8 bytes", curr, getFunction()); + switch (type) { + case i32: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4, curr, "expected i32 operation to touch 1, 2, or 4 bytes"); break; + case i64: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4 || bytes == 8, curr, "expected i64 operation to touch 1, 2, 4, or 8 bytes"); break; + case f32: shouldBeEqual(bytes, uint8_t(4), curr, "expected f32 operation to touch 4 bytes"); break; + case f64: shouldBeEqual(bytes, uint8_t(8), curr, "expected f64 operation to touch 8 bytes"); break; + case v128: shouldBeEqual(bytes, uint8_t(16), curr, "expected v128 operation to touch 16 bytes"); break; + case none: WASM_UNREACHABLE(); + case unreachable: break; } } @@ -671,6 +735,86 @@ void FunctionValidator::visitBinary(Binary* curr) { shouldBeEqualOrFirstIsUnreachable(curr->left->type, f64, curr, "f64 op"); break; } + case EqVecI8x16: + case NeVecI8x16: + case LtSVecI8x16: + case LtUVecI8x16: + case LeSVecI8x16: + case LeUVecI8x16: + case GtSVecI8x16: + case GtUVecI8x16: + case GeSVecI8x16: + case GeUVecI8x16: + case EqVecI16x8: + case NeVecI16x8: + case LtSVecI16x8: + case LtUVecI16x8: + case LeSVecI16x8: + case LeUVecI16x8: + case GtSVecI16x8: + case GtUVecI16x8: + case GeSVecI16x8: + case GeUVecI16x8: + case EqVecI32x4: + case NeVecI32x4: + case LtSVecI32x4: + case LtUVecI32x4: + case LeSVecI32x4: + case LeUVecI32x4: + case GtSVecI32x4: + case GtUVecI32x4: + case GeSVecI32x4: + case GeUVecI32x4: + case EqVecF32x4: + case NeVecF32x4: + case LtVecF32x4: + case LeVecF32x4: + case GtVecF32x4: + case GeVecF32x4: + case EqVecF64x2: + case NeVecF64x2: + case LtVecF64x2: + case LeVecF64x2: + case GtVecF64x2: + case GeVecF64x2: + case AndVec128: + case OrVec128: + case XorVec128: + case AddVecI8x16: + case AddSatSVecI8x16: + case AddSatUVecI8x16: + case SubVecI8x16: + case SubSatSVecI8x16: + case SubSatUVecI8x16: + case MulVecI8x16: + case AddVecI16x8: + case AddSatSVecI16x8: + case AddSatUVecI16x8: + case SubVecI16x8: + case SubSatSVecI16x8: + case SubSatUVecI16x8: + case MulVecI16x8: + case AddVecI32x4: + case SubVecI32x4: + case MulVecI32x4: + case AddVecI64x2: + case SubVecI64x2: + case AddVecF32x4: + case SubVecF32x4: + case MulVecF32x4: + case DivVecF32x4: + case MinVecF32x4: + case MaxVecF32x4: + case AddVecF64x2: + case SubVecF64x2: + case MulVecF64x2: + case DivVecF64x2: + case MinVecF64x2: + case MaxVecF64x2: { + shouldBeEqualOrFirstIsUnreachable(curr->left->type, v128, curr, "v128 op"); + shouldBeEqualOrFirstIsUnreachable(curr->right->type, v128, curr, "v128 op"); + break; + } case InvalidBinary: WASM_UNREACHABLE(); } } @@ -804,6 +948,57 @@ void FunctionValidator::visitUnary(Unary* curr) { shouldBeEqual(curr->value->type, i64, curr, "reinterpret/i64 type must be correct"); break; } + case SplatVecI8x16: + case SplatVecI16x8: + case SplatVecI32x4: + shouldBeEqual(curr->type, v128, curr, "expected splat to have v128 type"); + shouldBeEqual(curr->value->type, i32, curr, "expected i32 splat value"); + break; + case SplatVecI64x2: + shouldBeEqual(curr->type, v128, curr, "expected splat to have v128 type"); + shouldBeEqual(curr->value->type, i64, curr, "expected i64 splat value"); + break; + case SplatVecF32x4: + shouldBeEqual(curr->type, v128, curr, "expected splat to have v128 type"); + shouldBeEqual(curr->value->type, f32, curr, "expected f32 splat value"); + break; + case SplatVecF64x2: + shouldBeEqual(curr->type, v128, curr, "expected splat to have v128 type"); + shouldBeEqual(curr->value->type, f64, curr, "expected i64 splat value"); + break; + case NotVec128: + case NegVecI8x16: + case NegVecI16x8: + case NegVecI32x4: + case NegVecI64x2: + case AbsVecF32x4: + case NegVecF32x4: + case SqrtVecF32x4: + case AbsVecF64x2: + case NegVecF64x2: + case SqrtVecF64x2: + case TruncSatSVecF32x4ToVecI32x4: + case TruncSatUVecF32x4ToVecI32x4: + case TruncSatSVecF64x2ToVecI64x2: + case TruncSatUVecF64x2ToVecI64x2: + case ConvertSVecI32x4ToVecF32x4: + case ConvertUVecI32x4ToVecF32x4: + case ConvertSVecI64x2ToVecF64x2: + case ConvertUVecI64x2ToVecF64x2: + shouldBeEqual(curr->type, v128, curr, "expected v128 type"); + shouldBeEqual(curr->value->type, v128, curr, "expected v128 operand"); + break; + case AnyTrueVecI8x16: + case AllTrueVecI8x16: + case AnyTrueVecI16x8: + case AllTrueVecI16x8: + case AnyTrueVecI32x4: + case AllTrueVecI32x4: + case AnyTrueVecI64x2: + case AllTrueVecI64x2: + shouldBeEqual(curr->type, i32, curr, "expected boolean reduction to have i32 type"); + shouldBeEqual(curr->value->type, v128, curr, "expected v128 operand"); + break; case InvalidUnary: WASM_UNREACHABLE(); } } @@ -895,7 +1090,8 @@ void FunctionValidator::validateAlignment(size_t align, Type type, Index bytes, case 1: case 2: case 4: - case 8: break; + case 8: + case 16: break; default:{ info.fail("bad alignment: " + std::to_string(align), curr, getFunction()); break; @@ -913,9 +1109,9 @@ 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: {} + case v128: + case unreachable: break; + case none: WASM_UNREACHABLE(); } } diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index fe7927870a6..87278d3cd51 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -104,6 +104,11 @@ const char* getExpressionName(Expression* curr) { case Expression::Id::AtomicRMWId: return "atomic_rmw"; case Expression::Id::AtomicWaitId: return "atomic_wait"; case Expression::Id::AtomicWakeId: return "atomic_wake"; + case Expression::Id::SIMDExtractId: return "simd_extract"; + case Expression::Id::SIMDReplaceId: return "simd_replace"; + case Expression::Id::SIMDShuffleId: return "simd_shuffle"; + case Expression::Id::SIMDBitselectId: return "simd_bitselect"; + case Expression::Id::SIMDShiftId: return "simd_shift"; case Expression::Id::NumExpressionIds: WASM_UNREACHABLE(); } WASM_UNREACHABLE(); @@ -416,6 +421,56 @@ void AtomicWake::finalize() { } } +void SIMDExtract::finalize() { + assert(vec); + switch (op) { + case ExtractLaneSVecI8x16: + case ExtractLaneUVecI8x16: + case ExtractLaneSVecI16x8: + case ExtractLaneUVecI16x8: + case ExtractLaneVecI32x4: type = i32; break; + case ExtractLaneVecI64x2: type = i64; break; + case ExtractLaneVecF32x4: type = f32; break; + case ExtractLaneVecF64x2: type = f64; break; + default: WASM_UNREACHABLE(); + } + if (vec->type == unreachable) { + type = unreachable; + } +} + +void SIMDReplace::finalize() { + assert(vec && value); + type = v128; + if (vec->type == unreachable || value->type == unreachable) { + type = unreachable; + } +} + +void SIMDShuffle::finalize() { + assert(left && right); + type = v128; + if (left->type == unreachable || right->type == unreachable) { + type = unreachable; + } +} + +void SIMDBitselect::finalize() { + assert(left && right && cond); + type = v128; + if (left->type == unreachable || right->type == unreachable || cond->type == unreachable) { + type = unreachable; + } +} + +void SIMDShift::finalize() { + assert(vec && shift); + type = v128; + if (vec->type == unreachable || shift->type == unreachable) { + type = unreachable; + } +} + Const* Const::set(Literal value_) { value = value_; type = value.type; @@ -491,6 +546,39 @@ void Unary::finalize() { case ConvertUInt32ToFloat64: case ConvertSInt64ToFloat64: case ConvertUInt64ToFloat64: type = f64; break; + case SplatVecI8x16: + case SplatVecI16x8: + case SplatVecI32x4: + case SplatVecI64x2: + case SplatVecF32x4: + case SplatVecF64x2: + case NotVec128: + case NegVecI8x16: + case NegVecI16x8: + case NegVecI32x4: + case NegVecI64x2: + case AbsVecF32x4: + case NegVecF32x4: + case SqrtVecF32x4: + case AbsVecF64x2: + case NegVecF64x2: + case SqrtVecF64x2: + case TruncSatSVecF32x4ToVecI32x4: + case TruncSatUVecF32x4ToVecI32x4: + case TruncSatSVecF64x2ToVecI64x2: + case TruncSatUVecF64x2ToVecI64x2: + case ConvertSVecI32x4ToVecF32x4: + case ConvertUVecI32x4ToVecF32x4: + case ConvertSVecI64x2ToVecF64x2: + case ConvertUVecI64x2ToVecF64x2: type = v128; break; + case AnyTrueVecI8x16: + case AllTrueVecI8x16: + case AnyTrueVecI16x8: + case AllTrueVecI16x8: + case AnyTrueVecI32x4: + case AllTrueVecI32x4: + case AnyTrueVecI64x2: + case AllTrueVecI64x2: type = i32; break; case InvalidUnary: WASM_UNREACHABLE(); } } From fa2e5a51477900e5ec393391a4e639c4cb5bfe0d Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 3 Dec 2018 22:26:01 -0800 Subject: [PATCH 05/36] Add SIMD Expression IDs to API --- build-js.sh | 5 +++++ src/binaryen-c.cpp | 5 +++++ src/binaryen-c.h | 5 +++++ src/js/binaryen.js-post.js | 5 +++++ test/binaryen.js/kitchen-sink.js | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/build-js.sh b/build-js.sh index 808329386c7..201970c0a7b 100755 --- a/build-js.sh +++ b/build-js.sh @@ -214,6 +214,11 @@ export_function "_BinaryenAtomicCmpxchgId" export_function "_BinaryenAtomicRMWId" export_function "_BinaryenAtomicWaitId" export_function "_BinaryenAtomicWakeId" +export_function "_BinaryenSIMDExtractId" +export_function "_BinaryenSIMDReplaceId" +export_function "_BinaryenSIMDShuffleId" +export_function "_BinaryenSIMDBitselectId" +export_function "_BinaryenSIMDShiftId" # External kinds export_function "_BinaryenExternalFunction" diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 7c6b0f07fda..1b3a30103c5 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -230,6 +230,11 @@ BinaryenExpressionId BinaryenAtomicCmpxchgId(void) { return Expression::Id::Atom BinaryenExpressionId BinaryenAtomicRMWId(void) { return Expression::Id::AtomicRMWId; } BinaryenExpressionId BinaryenAtomicWaitId(void) { return Expression::Id::AtomicWaitId; } BinaryenExpressionId BinaryenAtomicWakeId(void) { return Expression::Id::AtomicWakeId; } +BinaryenExpressionId BinaryenSIMDExtractId(void) { return Expression::Id::SIMDExtractId; } +BinaryenExpressionId BinaryenSIMDReplaceId(void) { return Expression::Id::SIMDReplaceId; } +BinaryenExpressionId BinaryenSIMDShuffleId(void) { return Expression::Id::SIMDShuffleId; } +BinaryenExpressionId BinaryenSIMDBitselectId(void) { return Expression::Id::SIMDBitselectId; } +BinaryenExpressionId BinaryenSIMDShiftId(void) { return Expression::Id::SIMDShiftId; } // External kinds diff --git a/src/binaryen-c.h b/src/binaryen-c.h index f92c783cd5d..d4497be92e3 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -117,6 +117,11 @@ BinaryenExpressionId BinaryenAtomicCmpxchgId(void); BinaryenExpressionId BinaryenAtomicRMWId(void); BinaryenExpressionId BinaryenAtomicWaitId(void); BinaryenExpressionId BinaryenAtomicWakeId(void); +BinaryenExpressionId BinaryenSIMDExtractId(void); +BinaryenExpressionId BinaryenSIMDReplaceId(void); +BinaryenExpressionId BinaryenSIMDShuffleId(void); +BinaryenExpressionId BinaryenSIMDBitselectId(void); +BinaryenExpressionId BinaryenSIMDShiftId(void); // External kinds (call to get the value of each; you can cache them) diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index b63427935e1..f421ce455e8 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -60,6 +60,11 @@ Module['AtomicCmpxchgId'] = Module['_BinaryenAtomicCmpxchgId'](); Module['AtomicRMWId'] = Module['_BinaryenAtomicRMWId'](); Module['AtomicWaitId'] = Module['_BinaryenAtomicWaitId'](); Module['AtomicWakeId'] = Module['_BinaryenAtomicWakeId'](); +Module['SIMDExtractId'] = Module['_BinaryenSIMDExtractId'](); +Module['SIMDReplaceId'] = Module['_BinaryenSIMDReplaceId'](); +Module['SIMDShuffleId'] = Module['_BinaryenSIMDShuffleId'](); +Module['SIMDBitselectId'] = Module['_BinaryenSIMDBitselectId'](); +Module['SIMDShift'] = Module['_BinarySIMDShiftId'](); // External kinds Module['ExternalFunction'] = Module['_BinaryenExternalFunction'](); diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 9fdaa0ad252..6f2b79e83f3 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -83,6 +83,11 @@ function test_ids() { console.log("BinaryenAtomicRMWId: " + Binaryen.AtomicRMWId); console.log("BinaryenAtomicWaitId: " + Binaryen.AtomicWaitId); console.log("BinaryenAtomicWakeId: " + Binaryen.AtomicWakeId); + console.log("BinaryenSIMDExtractId: " + Binaryen.SIMDExtractId); + console.log("BinaryenSIMDReplaceId: " + Binaryen.SIMDReplaceId); + console.log("BinaryenSIMDShuffleId: " + Binaryen.SIMDShuffleId); + console.log("BinaryenSIMDBitselectId: " + Binaryen.SIMDBitselectId); + console.log("BinaryenSIMDShiftId: " + Binaryen.SIMDShiftId); } function test_core() { From 9bbe9e069dc70ef064395d11b25bfd0976be472c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 3 Dec 2018 22:42:49 -0800 Subject: [PATCH 06/36] REVERT ME: allow all sizes of float loads (what's going on with safe-heap.txt?) --- src/wasm/wasm-validator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index f05d2ea0377..bb42bd9b233 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -634,8 +634,8 @@ void FunctionValidator::validateMemBytes(uint8_t bytes, Type type, Expression* c switch (type) { case i32: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4, curr, "expected i32 operation to touch 1, 2, or 4 bytes"); break; case i64: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4 || bytes == 8, curr, "expected i64 operation to touch 1, 2, 4, or 8 bytes"); break; - case f32: shouldBeEqual(bytes, uint8_t(4), curr, "expected f32 operation to touch 4 bytes"); break; - case f64: shouldBeEqual(bytes, uint8_t(8), curr, "expected f64 operation to touch 8 bytes"); break; + case f32: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4, curr, "expected f32 operation to touch 1, 2, or 4 bytes"); break; + case f64: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4 || bytes == 8, curr, "expected f64 operation to touch 1, 2, 4, or 8 bytes"); break; case v128: shouldBeEqual(bytes, uint8_t(16), curr, "expected v128 operation to touch 16 bytes"); break; case none: WASM_UNREACHABLE(); case unreachable: break; From 4fdb5bae764b411ae2b0229b22e802ab7b917a8e Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 12:49:01 -0800 Subject: [PATCH 07/36] Revert "REVERT ME: allow all sizes of float loads (what's going on with safe-heap.txt?)" This reverts commit d6447fa8c806e2d3c32ee3a47f59fc893b22d72f. --- src/wasm/wasm-validator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index bb42bd9b233..f05d2ea0377 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -634,8 +634,8 @@ void FunctionValidator::validateMemBytes(uint8_t bytes, Type type, Expression* c switch (type) { case i32: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4, curr, "expected i32 operation to touch 1, 2, or 4 bytes"); break; case i64: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4 || bytes == 8, curr, "expected i64 operation to touch 1, 2, 4, or 8 bytes"); break; - case f32: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4, curr, "expected f32 operation to touch 1, 2, or 4 bytes"); break; - case f64: shouldBeTrue(bytes == 1 || bytes == 2 || bytes == 4 || bytes == 8, curr, "expected f64 operation to touch 1, 2, 4, or 8 bytes"); break; + case f32: shouldBeEqual(bytes, uint8_t(4), curr, "expected f32 operation to touch 4 bytes"); break; + case f64: shouldBeEqual(bytes, uint8_t(8), curr, "expected f64 operation to touch 8 bytes"); break; case v128: shouldBeEqual(bytes, uint8_t(16), curr, "expected v128 operation to touch 16 bytes"); break; case none: WASM_UNREACHABLE(); case unreachable: break; From 24aa1cdf4e53522e30538974e575bd7694b6f59c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 12:56:13 -0800 Subject: [PATCH 08/36] V128 literal parsing --- src/wasm/literal.cpp | 2 +- src/wasm/wasm-s-parser.cpp | 65 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index c98b4ad9dcf..62856e96254 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -226,7 +226,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: literal.printVec128(o, literal.getv128()); break; + case Type::v128: o << "i32 "; literal.printVec128(o, literal.getv128()); break; case Type::unreachable: WASM_UNREACHABLE(); } restoreNormalColor(o); diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 84f73102a1d..683711b8f87 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -864,8 +864,69 @@ Expression* SExpressionWasmBuilder::makeThenOrElse(Element& s) { } Expression* SExpressionWasmBuilder::makeConst(Element& s, Type type) { - auto ret = parseConst(s[1]->str(), type, allocator); - if (!ret) throw ParseException("bad const"); + if (type != v128) { + auto ret = parseConst(s[1]->str(), type, allocator); + if (!ret) throw ParseException("bad const"); + return ret; + } + + auto ret = allocator.alloc(); + auto getLiteral = [](Expression* expr) { + if (expr == nullptr) { + throw ParseException("Could not parse v128 lane"); + } + return expr->cast()->value; + }; + Type lane_t = stringToType(s[1]->str()); + size_t lanes = s.size() - 2; + switch (lanes) { + case 2: { + if (lane_t != i64 && lane_t != f64) { + throw ParseException("Unexpected v128 literal lane type"); + } + std::array lanes; + for (size_t i = 0; i < 2; ++i) { + lanes[i] = getLiteral(parseConst(s[i+2]->str(), lane_t, allocator)); + } + ret->value = Literal(lanes); + break; + } + case 4: { + if (lane_t != i32 && lane_t != f32) { + throw ParseException("Unexpected v128 literal lane type"); + } + std::array lanes; + for (size_t i = 0; i < 4; ++i) { + lanes[i] = getLiteral(parseConst(s[i+2]->str(), lane_t, allocator)); + } + ret->value = Literal(lanes); + break; + } + case 8: { + if (lane_t != i32) { + throw ParseException("Unexpected v128 literal lane type"); + } + std::array lanes; + for (size_t i = 0; i < 8; ++i) { + lanes[i] = getLiteral(parseConst(s[i+2]->str(), lane_t, allocator)); + } + ret->value = Literal(lanes); + break; + } + case 16: { + if (lane_t != i32) { + throw ParseException("Unexpected v128 literal lane type"); + } + std::array lanes; + for (size_t i = 0; i < 16; ++i) { + lanes[i] = getLiteral(parseConst(s[i+2]->str(), lane_t, allocator)); + } + ret->value = Literal(lanes); + break; + } + default: throw ParseException("Unexpected number of lanes in v128 literal"); + } + ret->finalize(); return ret; } From f1f6b12c54d1bacecb0c635d6b37363f61629fb4 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 13:03:22 -0800 Subject: [PATCH 09/36] Fix SafeHeap bug and add v128 support --- src/passes/SafeHeap.cpp | 22 +- test/passes/safe-heap.txt | 1377 ++++++++++++++++-------------------- test/passes/safe-heap.wast | 3 +- 3 files changed, 611 insertions(+), 791 deletions(-) diff --git a/src/passes/SafeHeap.cpp b/src/passes/SafeHeap.cpp index ce1adff1589..f42f4c3c045 100644 --- a/src/passes/SafeHeap.cpp +++ b/src/passes/SafeHeap.cpp @@ -159,15 +159,18 @@ struct SafeHeap : public Pass { void addGlobals(Module* module) { // load funcs Load load; - for (auto type : { i32, i64, f32, f64 }) { + for (auto type : { i32, i64, f32, f64, v128 }) { load.type = type; - for (Index bytes : { 1, 2, 4, 8 }) { + for (Index bytes : { 1, 2, 4, 8, 16 }) { load.bytes = bytes; - if (bytes > getTypeSize(type)) continue; + if (bytes > getTypeSize(type) || + (type == f32 && bytes != 4) || + (type == f64 && bytes != 8) || + (type == v128 && bytes != 16)) continue; for (auto signed_ : { true, false }) { load.signed_ = signed_; if (isFloatType(type) && signed_) continue; - for (Index align : { 1, 2, 4, 8 }) { + for (Index align : { 1, 2, 4, 8, 16 }) { load.align = align; if (align > bytes) continue; for (auto isAtomic : { true, false }) { @@ -184,13 +187,16 @@ struct SafeHeap : public Pass { } // store funcs Store store; - for (auto valueType : { i32, i64, f32, f64 }) { + for (auto valueType : { i32, i64, f32, f64, v128 }) { store.valueType = valueType; store.type = none; - for (Index bytes : { 1, 2, 4, 8 }) { + for (Index bytes : { 1, 2, 4, 8, 16 }) { store.bytes = bytes; - if (bytes > getTypeSize(valueType)) continue; - for (Index align : { 1, 2, 4, 8 }) { + if (bytes > getTypeSize(valueType) || + (valueType == f32 && bytes != 4) || + (valueType == f64 && bytes != 8) || + (valueType == v128 && bytes != 16)) continue; + for (Index align : { 1, 2, 4, 8, 16 }) { store.align = align; if (align > bytes) continue; for (auto isAtomic : { true, false }) { diff --git a/test/passes/safe-heap.txt b/test/passes/safe-heap.txt index f2513d5027c..ed94f85ed43 100644 --- a/test/passes/safe-heap.txt +++ b/test/passes/safe-heap.txt @@ -90,6 +90,12 @@ (i32.const 0) ) ) + (drop + (call $SAFE_HEAP_LOAD_v128_16_U_16 + (i32.const 14) + (i32.const 0) + ) + ) ) (func $stores (; 3 ;) (type $0) (call $SAFE_HEAP_STORE_i32_4_4 @@ -162,6 +168,11 @@ (i32.const 0) (f64.const 1300) ) + (call $SAFE_HEAP_STORE_v128_16_16 + (i32.const 14) + (i32.const 0) + (v128.const i32 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0) + ) ) (func $SAFE_HEAP_LOAD_i32_1_A (; 4 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -1769,7 +1780,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_1_1 (; 50 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_1 (; 50 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -1786,7 +1797,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 1) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1795,11 +1806,11 @@ ) (call $segfault) ) - (f32.load8_u + (f32.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_2_1 (; 51 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_2 (; 51 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -1816,7 +1827,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1825,11 +1836,18 @@ ) (call $segfault) ) - (f32.load16_u align=1 + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_2_2 (; 52 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_4 (; 52 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -1846,7 +1864,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1858,15 +1876,15 @@ (if (i32.and (get_local $2) - (i32.const 1) + (i32.const 3) ) (call $alignfault) ) - (f32.load16_u + (f32.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_1 (; 53 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_1 (; 53 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -1883,7 +1901,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1892,11 +1910,11 @@ ) (call $segfault) ) - (f32.load align=1 + (f64.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_2 (; 54 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_2 (; 54 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -1913,7 +1931,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1929,11 +1947,11 @@ ) (call $alignfault) ) - (f32.load align=2 + (f64.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_4 (; 55 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_4 (; 55 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -1950,7 +1968,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1966,11 +1984,11 @@ ) (call $alignfault) ) - (f32.load + (f64.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_1_1 (; 56 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_f64_8_8 (; 56 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -1987,7 +2005,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 1) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -1996,11 +2014,18 @@ ) (call $segfault) ) - (f64.load8_u + (if + (i32.and + (get_local $2) + (i32.const 7) + ) + (call $alignfault) + ) + (f64.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_2_1 (; 57 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_1 (; 57 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2017,7 +2042,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2026,11 +2051,11 @@ ) (call $segfault) ) - (f64.load16_u align=1 + (v128.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_2_2 (; 58 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_2 (; 58 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2047,7 +2072,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2063,11 +2088,11 @@ ) (call $alignfault) ) - (f64.load16_u + (v128.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_1 (; 59 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_4 (; 59 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2084,7 +2109,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2093,11 +2118,18 @@ ) (call $segfault) ) - (f64.load align=1 + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (v128.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_2 (; 60 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_8 (; 60 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2114,7 +2146,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2126,15 +2158,15 @@ (if (i32.and (get_local $2) - (i32.const 1) + (i32.const 7) ) (call $alignfault) ) - (f64.load align=2 + (v128.load align=8 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_4 (; 61 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_16 (; 61 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2151,7 +2183,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2163,15 +2195,15 @@ (if (i32.and (get_local $2) - (i32.const 3) + (i32.const 15) ) (call $alignfault) ) - (f64.load + (v128.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_1 (; 62 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_1 (; 62 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2188,7 +2220,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2197,11 +2229,11 @@ ) (call $segfault) ) - (f64.load align=1 + (v128.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_2 (; 63 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_2 (; 63 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2218,7 +2250,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2234,11 +2266,11 @@ ) (call $alignfault) ) - (f64.load align=2 + (v128.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_4 (; 64 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_4 (; 64 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2255,7 +2287,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2271,11 +2303,11 @@ ) (call $alignfault) ) - (f64.load align=4 + (v128.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_8 (; 65 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_8 (; 65 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -2292,7 +2324,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -2308,11 +2340,48 @@ ) (call $alignfault) ) - (f64.load + (v128.load align=8 (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_1_A (; 66 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_LOAD_v128_16_U_16 (; 66 ;) (param $0 i32) (param $1 i32) (result v128) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 16) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 15) + ) + (call $alignfault) + ) + (v128.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_1_A (; 67 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2343,7 +2412,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_1_1 (; 67 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_1_1 (; 68 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2374,7 +2443,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_1 (; 68 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_1 (; 69 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2405,7 +2474,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_A (; 69 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_A (; 70 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2443,7 +2512,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_2 (; 70 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_2 (; 71 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2481,7 +2550,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_1 (; 71 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_1 (; 72 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2512,7 +2581,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_2 (; 72 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_2 (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2550,7 +2619,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_A (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_A (; 74 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2588,7 +2657,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_4 (; 74 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_4 (; 75 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -2626,7 +2695,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_1_A (; 75 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_1_A (; 76 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2657,7 +2726,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_1_1 (; 76 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_1_1 (; 77 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2688,7 +2757,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_1 (; 77 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_1 (; 78 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2719,7 +2788,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_A (; 78 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_A (; 79 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2757,7 +2826,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_2 (; 79 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_2 (; 80 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2795,7 +2864,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_1 (; 80 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_1 (; 81 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2826,7 +2895,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_2 (; 81 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_2 (; 82 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2864,7 +2933,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_A (; 82 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_A (; 83 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2902,7 +2971,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_4 (; 83 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_4 (; 84 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2940,7 +3009,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_1 (; 84 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_1 (; 85 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -2971,7 +3040,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_2 (; 85 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_2 (; 86 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -3009,7 +3078,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_4 (; 86 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_4 (; 87 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -3047,7 +3116,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_A (; 87 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_A (; 88 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -3085,7 +3154,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_8 (; 88 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_8 (; 89 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -3123,7 +3192,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_1_1 (; 89 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_1 (; 90 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -3140,7 +3209,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 1) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3149,12 +3218,12 @@ ) (call $segfault) ) - (f32.store8 + (f32.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_2_1 (; 90 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_2 (; 91 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -3171,7 +3240,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3180,12 +3249,19 @@ ) (call $segfault) ) - (f32.store16 align=1 + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_2_2 (; 91 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_4 (; 92 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -3202,7 +3278,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3214,16 +3290,16 @@ (if (i32.and (get_local $3) - (i32.const 1) + (i32.const 3) ) (call $alignfault) ) - (f32.store16 + (f32.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_1 (; 92 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_1 (; 93 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -3240,7 +3316,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3249,12 +3325,12 @@ ) (call $segfault) ) - (f32.store align=1 + (f64.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_2 (; 93 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_2 (; 94 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -3271,7 +3347,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3287,12 +3363,12 @@ ) (call $alignfault) ) - (f32.store align=2 + (f64.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_4 (; 94 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_4 (; 95 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -3309,7 +3385,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3325,12 +3401,12 @@ ) (call $alignfault) ) - (f32.store + (f64.store align=4 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_1_1 (; 95 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_f64_8_8 (; 96 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -3347,7 +3423,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 1) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3356,12 +3432,19 @@ ) (call $segfault) ) - (f64.store8 + (if + (i32.and + (get_local $3) + (i32.const 7) + ) + (call $alignfault) + ) + (f64.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_2_1 (; 96 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_1 (; 97 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -3378,7 +3461,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3387,12 +3470,12 @@ ) (call $segfault) ) - (f64.store16 align=1 + (v128.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_2_2 (; 97 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_2 (; 98 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -3409,7 +3492,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3425,12 +3508,12 @@ ) (call $alignfault) ) - (f64.store16 + (v128.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_1 (; 98 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_4 (; 99 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -3447,7 +3530,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3456,12 +3539,19 @@ ) (call $segfault) ) - (f64.store align=1 + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (v128.store align=4 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_2 (; 99 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_8 (; 100 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -3478,7 +3568,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3490,16 +3580,16 @@ (if (i32.and (get_local $3) - (i32.const 1) + (i32.const 7) ) (call $alignfault) ) - (f64.store align=2 + (v128.store align=8 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_4 (; 100 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_16 (; 101 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -3516,7 +3606,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3528,18 +3618,34 @@ (if (i32.and (get_local $3) - (i32.const 3) + (i32.const 15) ) (call $alignfault) ) - (f64.store + (v128.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_1 (; 101 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 +) +(module + (type $0 (func)) + (type $FUNCSIG$v (func)) + (import "env" "DYNAMICTOP_PTR" (global $DYNAMICTOP_PTR i32)) + (import "env" "segfault" (func $segfault)) + (import "env" "alignfault" (func $alignfault)) + (memory $0 100 100) + (func $loads (; 2 ;) (type $0) + (drop + (call $SAFE_HEAP_LOAD_i32_4_U_4 + (i32.const 1) + (i32.const 0) + ) + ) + ) + (func $SAFE_HEAP_LOAD_i32_1_1 (; 3 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 (i32.add (get_local $0) (get_local $1) @@ -3548,13 +3654,13 @@ (if (i32.or (i32.eq - (get_local $3) + (get_local $2) (i32.const 0) ) (i32.gt_u (i32.add - (get_local $3) - (i32.const 8) + (get_local $2) + (i32.const 1) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3563,14 +3669,13 @@ ) (call $segfault) ) - (f64.store align=1 - (get_local $3) + (i32.load8_s (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_2 (; 102 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 + (func $SAFE_HEAP_LOAD_i32_1_U_1 (; 4 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 (i32.add (get_local $0) (get_local $1) @@ -3579,13 +3684,13 @@ (if (i32.or (i32.eq - (get_local $3) + (get_local $2) (i32.const 0) ) (i32.gt_u (i32.add - (get_local $3) - (i32.const 8) + (get_local $2) + (i32.const 1) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3594,21 +3699,13 @@ ) (call $segfault) ) - (if - (i32.and - (get_local $3) - (i32.const 1) - ) - (call $alignfault) - ) - (f64.store align=2 - (get_local $3) + (i32.load8_u (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_4 (; 103 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 + (func $SAFE_HEAP_LOAD_i32_2_1 (; 5 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 (i32.add (get_local $0) (get_local $1) @@ -3617,13 +3714,13 @@ (if (i32.or (i32.eq - (get_local $3) + (get_local $2) (i32.const 0) ) (i32.gt_u (i32.add - (get_local $3) - (i32.const 8) + (get_local $2) + (i32.const 2) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -3632,160 +3729,8 @@ ) (call $segfault) ) - (if - (i32.and - (get_local $3) - (i32.const 3) - ) - (call $alignfault) - ) - (f64.store align=4 - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_8_8 (; 104 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 8) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (if - (i32.and - (get_local $3) - (i32.const 7) - ) - (call $alignfault) - ) - (f64.store - (get_local $3) - (get_local $2) - ) - ) -) -(module - (type $0 (func)) - (type $FUNCSIG$v (func)) - (import "env" "DYNAMICTOP_PTR" (global $DYNAMICTOP_PTR i32)) - (import "env" "segfault" (func $segfault)) - (import "env" "alignfault" (func $alignfault)) - (memory $0 100 100) - (func $loads (; 2 ;) (type $0) - (drop - (call $SAFE_HEAP_LOAD_i32_4_U_4 - (i32.const 1) - (i32.const 0) - ) - ) - ) - (func $SAFE_HEAP_LOAD_i32_1_1 (; 3 ;) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (set_local $2 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $2) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $2) - (i32.const 1) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (i32.load8_s - (get_local $2) - ) - ) - (func $SAFE_HEAP_LOAD_i32_1_U_1 (; 4 ;) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (set_local $2 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $2) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $2) - (i32.const 1) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (i32.load8_u - (get_local $2) - ) - ) - (func $SAFE_HEAP_LOAD_i32_2_1 (; 5 ;) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (set_local $2 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $2) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $2) - (i32.const 2) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (i32.load16_s align=1 - (get_local $2) + (i32.load16_s align=1 + (get_local $2) ) ) (func $SAFE_HEAP_LOAD_i32_2_2 (; 6 ;) (param $0 i32) (param $1 i32) (result i32) @@ -4784,7 +4729,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_1_1 (; 35 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_1 (; 35 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -4801,7 +4746,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 1) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -4810,11 +4755,11 @@ ) (call $segfault) ) - (f32.load8_u + (f32.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_2_1 (; 36 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_2 (; 36 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -4831,7 +4776,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -4840,11 +4785,18 @@ ) (call $segfault) ) - (f32.load16_u align=1 + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_2_2 (; 37 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_4 (; 37 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -4861,7 +4813,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -4873,15 +4825,15 @@ (if (i32.and (get_local $2) - (i32.const 1) + (i32.const 3) ) (call $alignfault) ) - (f32.load16_u + (f32.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_1 (; 38 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_1 (; 38 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -4898,7 +4850,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -4907,11 +4859,11 @@ ) (call $segfault) ) - (f32.load align=1 + (f64.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_2 (; 39 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_2 (; 39 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -4928,7 +4880,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -4944,11 +4896,11 @@ ) (call $alignfault) ) - (f32.load align=2 + (f64.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_4 (; 40 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_4 (; 40 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -4965,7 +4917,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -4981,11 +4933,11 @@ ) (call $alignfault) ) - (f32.load + (f64.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_1_1 (; 41 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_f64_8_8 (; 41 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -5002,7 +4954,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 1) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5011,11 +4963,18 @@ ) (call $segfault) ) - (f64.load8_u + (if + (i32.and + (get_local $2) + (i32.const 7) + ) + (call $alignfault) + ) + (f64.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_2_1 (; 42 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_1 (; 42 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5032,7 +4991,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5041,11 +5000,11 @@ ) (call $segfault) ) - (f64.load16_u align=1 + (v128.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_2_2 (; 43 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_2 (; 43 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5062,7 +5021,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5078,11 +5037,11 @@ ) (call $alignfault) ) - (f64.load16_u + (v128.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_1 (; 44 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_4 (; 44 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5099,7 +5058,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5108,11 +5067,18 @@ ) (call $segfault) ) - (f64.load align=1 + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (v128.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_2 (; 45 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_8 (; 45 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5129,7 +5095,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5141,15 +5107,15 @@ (if (i32.and (get_local $2) - (i32.const 1) + (i32.const 7) ) (call $alignfault) ) - (f64.load align=2 + (v128.load align=8 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_4 (; 46 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_16 (; 46 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5166,7 +5132,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5178,15 +5144,15 @@ (if (i32.and (get_local $2) - (i32.const 3) + (i32.const 15) ) (call $alignfault) ) - (f64.load + (v128.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_1 (; 47 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_1 (; 47 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5203,7 +5169,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5212,11 +5178,11 @@ ) (call $segfault) ) - (f64.load align=1 + (v128.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_2 (; 48 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_2 (; 48 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5233,7 +5199,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5249,11 +5215,11 @@ ) (call $alignfault) ) - (f64.load align=2 + (v128.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_4 (; 49 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_4 (; 49 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5270,7 +5236,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5286,11 +5252,11 @@ ) (call $alignfault) ) - (f64.load align=4 + (v128.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_8 (; 50 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_8 (; 50 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -5307,7 +5273,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5323,11 +5289,48 @@ ) (call $alignfault) ) - (f64.load + (v128.load align=8 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_v128_16_U_16 (; 51 ;) (param $0 i32) (param $1 i32) (result v128) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 16) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 15) + ) + (call $alignfault) + ) + (v128.load (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_1_1 (; 51 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_1_1 (; 52 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -5358,7 +5361,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_1 (; 52 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_1 (; 53 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -5389,7 +5392,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_2 (; 53 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_2 (; 54 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -5427,7 +5430,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_1 (; 54 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_1 (; 55 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -5458,7 +5461,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_2 (; 55 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_2 (; 56 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -5496,7 +5499,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_4 (; 56 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_4 (; 57 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -5534,7 +5537,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_1_1 (; 57 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_1_1 (; 58 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5565,7 +5568,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_1 (; 58 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_1 (; 59 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5596,7 +5599,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_2 (; 59 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_2 (; 60 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5634,7 +5637,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_1 (; 60 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_1 (; 61 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5665,7 +5668,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_2 (; 61 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_2 (; 62 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5703,7 +5706,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_4 (; 62 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_4 (; 63 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5741,7 +5744,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_1 (; 63 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_1 (; 64 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5772,7 +5775,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_2 (; 64 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_2 (; 65 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5810,7 +5813,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_4 (; 65 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_4 (; 66 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5848,7 +5851,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_8 (; 66 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_8 (; 67 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -5886,7 +5889,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_1_1 (; 67 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_1 (; 68 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -5903,7 +5906,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 1) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5912,12 +5915,12 @@ ) (call $segfault) ) - (f32.store8 + (f32.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_2_1 (; 68 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_2 (; 69 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -5934,38 +5937,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (f32.store16 align=1 - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f32_2_2 (; 69 ;) (param $0 i32) (param $1 i32) (param $2 f32) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -5981,12 +5953,12 @@ ) (call $alignfault) ) - (f32.store16 + (f32.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_1 (; 70 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_4 (; 70 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -6012,12 +5984,19 @@ ) (call $segfault) ) - (f32.store align=1 + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (f32.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_2 (; 71 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_1 (; 71 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -6034,7 +6013,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6043,19 +6022,12 @@ ) (call $segfault) ) - (if - (i32.and - (get_local $3) - (i32.const 1) - ) - (call $alignfault) - ) - (f32.store align=2 + (f64.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_4 (; 72 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_2 (; 72 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -6072,7 +6044,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6084,16 +6056,16 @@ (if (i32.and (get_local $3) - (i32.const 3) + (i32.const 1) ) (call $alignfault) ) - (f32.store + (f64.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_1_1 (; 73 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_f64_8_4 (; 73 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -6110,7 +6082,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 1) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6119,43 +6091,19 @@ ) (call $segfault) ) - (f64.store8 - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_2_1 (; 74 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 2) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) + (i32.and + (get_local $3) + (i32.const 3) ) - (call $segfault) + (call $alignfault) ) - (f64.store16 align=1 + (f64.store align=4 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_2_2 (; 75 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_f64_8_8 (; 74 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -6172,7 +6120,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6184,16 +6132,16 @@ (if (i32.and (get_local $3) - (i32.const 1) + (i32.const 7) ) (call $alignfault) ) - (f64.store16 + (f64.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_1 (; 76 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_1 (; 75 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -6210,7 +6158,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6219,12 +6167,12 @@ ) (call $segfault) ) - (f64.store align=1 + (v128.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_2 (; 77 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_2 (; 76 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -6241,7 +6189,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6257,12 +6205,12 @@ ) (call $alignfault) ) - (f64.store align=2 + (v128.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_4 (; 78 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_4 (; 77 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -6279,7 +6227,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6295,81 +6243,12 @@ ) (call $alignfault) ) - (f64.store - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_8_1 (; 79 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 8) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (f64.store align=1 - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_8_2 (; 80 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 8) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (if - (i32.and - (get_local $3) - (i32.const 1) - ) - (call $alignfault) - ) - (f64.store align=2 + (v128.store align=4 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_4 (; 81 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_8 (; 78 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -6386,7 +6265,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6398,16 +6277,16 @@ (if (i32.and (get_local $3) - (i32.const 3) + (i32.const 7) ) (call $alignfault) ) - (f64.store align=4 + (v128.store align=8 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_8 (; 82 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_16 (; 79 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -6424,7 +6303,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -6436,11 +6315,11 @@ (if (i32.and (get_local $3) - (i32.const 7) + (i32.const 15) ) (call $alignfault) ) - (f64.store + (v128.store (get_local $3) (get_local $2) ) @@ -8071,7 +7950,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_1_1 (; 49 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_1 (; 49 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -8088,7 +7967,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 1) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8097,11 +7976,11 @@ ) (call $segfault) ) - (f32.load8_u + (f32.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_2_1 (; 50 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_2 (; 50 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -8118,7 +7997,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8127,11 +8006,18 @@ ) (call $segfault) ) - (f32.load16_u align=1 + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_2_2 (; 51 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f32_4_4 (; 51 ;) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.add @@ -8148,7 +8034,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8160,15 +8046,15 @@ (if (i32.and (get_local $2) - (i32.const 1) + (i32.const 3) ) (call $alignfault) ) - (f32.load16_u + (f32.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_1 (; 52 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_1 (; 52 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -8185,7 +8071,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8194,11 +8080,11 @@ ) (call $segfault) ) - (f32.load align=1 + (f64.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_2 (; 53 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_2 (; 53 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -8215,7 +8101,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8231,11 +8117,11 @@ ) (call $alignfault) ) - (f32.load align=2 + (f64.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f32_4_4 (; 54 ;) (param $0 i32) (param $1 i32) (result f32) + (func $SAFE_HEAP_LOAD_f64_8_4 (; 54 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -8252,7 +8138,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8268,11 +8154,11 @@ ) (call $alignfault) ) - (f32.load + (f64.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_1_1 (; 55 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_f64_8_8 (; 55 ;) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.add @@ -8289,7 +8175,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 1) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8298,11 +8184,18 @@ ) (call $segfault) ) - (f64.load8_u + (if + (i32.and + (get_local $2) + (i32.const 7) + ) + (call $alignfault) + ) + (f64.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_2_1 (; 56 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_1 (; 56 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8319,7 +8212,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8328,11 +8221,11 @@ ) (call $segfault) ) - (f64.load16_u align=1 + (v128.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_2_2 (; 57 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_2 (; 57 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8349,7 +8242,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 2) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8365,11 +8258,11 @@ ) (call $alignfault) ) - (f64.load16_u + (v128.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_1 (; 58 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_4 (; 58 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8386,7 +8279,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8395,11 +8288,18 @@ ) (call $segfault) ) - (f64.load align=1 + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (v128.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_2 (; 59 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_8 (; 59 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8416,7 +8316,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8428,15 +8328,15 @@ (if (i32.and (get_local $2) - (i32.const 1) + (i32.const 7) ) (call $alignfault) ) - (f64.load align=2 + (v128.load align=8 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_4_4 (; 60 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_16 (; 60 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8453,7 +8353,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8465,15 +8365,15 @@ (if (i32.and (get_local $2) - (i32.const 3) + (i32.const 15) ) (call $alignfault) ) - (f64.load + (v128.load (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_1 (; 61 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_1 (; 61 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8490,7 +8390,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8499,11 +8399,11 @@ ) (call $segfault) ) - (f64.load align=1 + (v128.load align=1 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_2 (; 62 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_2 (; 62 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8520,7 +8420,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8536,11 +8436,11 @@ ) (call $alignfault) ) - (f64.load align=2 + (v128.load align=2 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_4 (; 63 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_4 (; 63 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8557,7 +8457,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8573,11 +8473,11 @@ ) (call $alignfault) ) - (f64.load align=4 + (v128.load align=4 (get_local $2) ) ) - (func $SAFE_HEAP_LOAD_f64_8_8 (; 64 ;) (param $0 i32) (param $1 i32) (result f64) + (func $SAFE_HEAP_LOAD_v128_16_U_8 (; 64 ;) (param $0 i32) (param $1 i32) (result v128) (local $2 i32) (set_local $2 (i32.add @@ -8594,7 +8494,7 @@ (i32.gt_u (i32.add (get_local $2) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -8610,11 +8510,48 @@ ) (call $alignfault) ) - (f64.load + (v128.load align=8 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_v128_16_U_16 (; 65 ;) (param $0 i32) (param $1 i32) (result v128) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 16) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 15) + ) + (call $alignfault) + ) + (v128.load (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_1_A (; 65 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_1_A (; 66 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8645,7 +8582,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_1_1 (; 66 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_1_1 (; 67 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8676,7 +8613,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_1 (; 67 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_1 (; 68 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8707,7 +8644,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_A (; 68 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_A (; 69 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8745,7 +8682,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_2_2 (; 69 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_2_2 (; 70 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8783,7 +8720,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_1 (; 70 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_1 (; 71 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8814,7 +8751,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_2 (; 71 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_2 (; 72 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8852,7 +8789,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_A (; 72 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_A (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8890,7 +8827,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i32_4_4 (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $SAFE_HEAP_STORE_i32_4_4 (; 74 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (set_local $3 (i32.add @@ -8928,7 +8865,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_1_A (; 74 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_1_A (; 75 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -8959,7 +8896,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_1_1 (; 75 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_1_1 (; 76 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -8990,7 +8927,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_1 (; 76 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_1 (; 77 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9021,7 +8958,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_A (; 77 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_A (; 78 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9059,7 +8996,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_2_2 (; 78 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_2_2 (; 79 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9097,7 +9034,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_1 (; 79 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_1 (; 80 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9128,7 +9065,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_2 (; 80 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_2 (; 81 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9166,7 +9103,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_A (; 81 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_A (; 82 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9204,7 +9141,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_4_4 (; 82 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_4_4 (; 83 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9242,7 +9179,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_1 (; 83 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_1 (; 84 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9273,7 +9210,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_2 (; 84 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_2 (; 85 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9311,7 +9248,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_4 (; 85 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_4 (; 86 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9349,7 +9286,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_A (; 86 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_A (; 87 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9387,7 +9324,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_i64_8_8 (; 87 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $SAFE_HEAP_STORE_i64_8_8 (; 88 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (set_local $3 (i32.add @@ -9425,7 +9362,7 @@ (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_1_1 (; 88 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_1 (; 89 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -9442,7 +9379,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 1) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9451,12 +9388,12 @@ ) (call $segfault) ) - (f32.store8 + (f32.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_2_1 (; 89 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_2 (; 90 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -9473,7 +9410,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9482,12 +9419,19 @@ ) (call $segfault) ) - (f32.store16 align=1 + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_2_2 (; 90 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f32_4_4 (; 91 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (set_local $3 (i32.add @@ -9504,7 +9448,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 4) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9516,16 +9460,16 @@ (if (i32.and (get_local $3) - (i32.const 1) + (i32.const 3) ) (call $alignfault) ) - (f32.store16 + (f32.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_1 (; 91 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_1 (; 92 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -9542,7 +9486,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9551,12 +9495,12 @@ ) (call $segfault) ) - (f32.store align=1 + (f64.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_2 (; 92 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_2 (; 93 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -9573,7 +9517,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9589,12 +9533,12 @@ ) (call $alignfault) ) - (f32.store align=2 + (f64.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f32_4_4 (; 93 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (func $SAFE_HEAP_STORE_f64_8_4 (; 94 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -9611,7 +9555,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9627,74 +9571,12 @@ ) (call $alignfault) ) - (f32.store - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_1_1 (; 94 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 1) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (f64.store8 - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_2_1 (; 95 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 2) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (f64.store16 align=1 + (f64.store align=4 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_2_2 (; 96 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_f64_8_8 (; 95 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (set_local $3 (i32.add @@ -9711,7 +9593,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 2) + (i32.const 8) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9723,16 +9605,16 @@ (if (i32.and (get_local $3) - (i32.const 1) + (i32.const 7) ) (call $alignfault) ) - (f64.store16 + (f64.store (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_1 (; 97 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_1 (; 96 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -9749,7 +9631,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9758,12 +9640,12 @@ ) (call $segfault) ) - (f64.store align=1 + (v128.store align=1 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_2 (; 98 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_2 (; 97 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -9780,7 +9662,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9796,12 +9678,12 @@ ) (call $alignfault) ) - (f64.store align=2 + (v128.store align=2 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_4_4 (; 99 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_4 (; 98 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -9818,7 +9700,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 4) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9834,81 +9716,12 @@ ) (call $alignfault) ) - (f64.store - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_8_1 (; 100 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 8) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (f64.store align=1 - (get_local $3) - (get_local $2) - ) - ) - (func $SAFE_HEAP_STORE_f64_8_2 (; 101 ;) (param $0 i32) (param $1 i32) (param $2 f64) - (local $3 i32) - (set_local $3 - (i32.add - (get_local $0) - (get_local $1) - ) - ) - (if - (i32.or - (i32.eq - (get_local $3) - (i32.const 0) - ) - (i32.gt_u - (i32.add - (get_local $3) - (i32.const 8) - ) - (i32.load - (get_global $DYNAMICTOP_PTR) - ) - ) - ) - (call $segfault) - ) - (if - (i32.and - (get_local $3) - (i32.const 1) - ) - (call $alignfault) - ) - (f64.store align=2 + (v128.store align=4 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_4 (; 102 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_8 (; 99 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -9925,7 +9738,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9937,16 +9750,16 @@ (if (i32.and (get_local $3) - (i32.const 3) + (i32.const 7) ) (call $alignfault) ) - (f64.store align=4 + (v128.store align=8 (get_local $3) (get_local $2) ) ) - (func $SAFE_HEAP_STORE_f64_8_8 (; 103 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (func $SAFE_HEAP_STORE_v128_16_16 (; 100 ;) (param $0 i32) (param $1 i32) (param $2 v128) (local $3 i32) (set_local $3 (i32.add @@ -9963,7 +9776,7 @@ (i32.gt_u (i32.add (get_local $3) - (i32.const 8) + (i32.const 16) ) (i32.load (get_global $DYNAMICTOP_PTR) @@ -9975,11 +9788,11 @@ (if (i32.and (get_local $3) - (i32.const 7) + (i32.const 15) ) (call $alignfault) ) - (f64.store + (v128.store (get_local $3) (get_local $2) ) diff --git a/test/passes/safe-heap.wast b/test/passes/safe-heap.wast index 19aa94a3557..a2754b469d6 100644 --- a/test/passes/safe-heap.wast +++ b/test/passes/safe-heap.wast @@ -15,6 +15,7 @@ (drop (i64.load (i32.const 11))) (drop (f32.load (i32.const 12))) (drop (f64.load (i32.const 13))) + (drop (v128.load (i32.const 14))) ) (func $stores (i32.store (i32.const 1) (i32.const 100)) @@ -31,6 +32,7 @@ (i64.store (i32.const 11) (i64.const 1100)) (f32.store (i32.const 12) (f32.const 1200)) (f64.store (i32.const 13) (f64.const 1300)) + (v128.store (i32.const 14) (v128.const i32 1 2 3 4)) ) ) ;; not shared @@ -52,4 +54,3 @@ (i32.store (i32.const 1) (i32.const 100)) ) ) - From cedacd45f6271fac28e4c6983ccfccdd3f3c5616 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 13:19:58 -0800 Subject: [PATCH 10/36] Add simd test and fix print bug --- src/passes/Print.cpp | 2 +- test/simd.wast | 793 +++++++++++++++++++++++++ test/simd.wast.from-wast | 809 +++++++++++++++++++++++++ test/simd.wast.fromBinary | 810 ++++++++++++++++++++++++++ test/simd.wast.fromBinary.noDebugInfo | 810 ++++++++++++++++++++++++++ 5 files changed, 3223 insertions(+), 1 deletion(-) create mode 100644 test/simd.wast create mode 100644 test/simd.wast.from-wast create mode 100644 test/simd.wast.fromBinary create mode 100644 test/simd.wast.fromBinary.noDebugInfo diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index d759d1378ed..b9fb6cce712 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -255,7 +255,7 @@ struct PrintExpressionContents : public Visitor { case ReplaceLaneVecI16x8: o << "i16x8.replace_lane"; break; case ReplaceLaneVecI32x4: o << "i32x4.replace_lane"; break; case ReplaceLaneVecI64x2: o << "i64x2.replace_lane"; break; - case ReplaceLaneVecF32x4: o << "i32x4.replace_lane"; break; + case ReplaceLaneVecF32x4: o << "f32x4.replace_lane"; break; case ReplaceLaneVecF64x2: o << "f64x2.replace_lane"; break; } o << " " << int(curr->idx); diff --git a/test/simd.wast b/test/simd.wast new file mode 100644 index 00000000000..79ecaeeafd5 --- /dev/null +++ b/test/simd.wast @@ -0,0 +1,793 @@ +(module + (func $v128.load (param $0 i32) (result v128) + (v128.load offset=0 align=16 + (get_local $0) + ) + ) + (func $v128.store (param $0 i32) (param $1 v128) + (v128.store offset=0 align=16 + (get_local $0) + (get_local $1) + ) + ) + (func $v128.const (result v128) + (v128.const i32 1 2 3 4) + ) + (func $v128.shuffle (param $0 v128) (param $1 v128) (result v128) + (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.splat (param $0 i32) (result v128) + (i8x16.splat + (get_local $0) + ) + ) + (func $i8x16.extract_lane_s (param $0 v128) (result i32) + (i8x16.extract_lane_s 0 + (get_local $0) + ) + ) + (func $i8x16.extract_lane_u (param $0 v128) (result i32) + (i8x16.extract_lane_u 0 + (get_local $0) + ) + ) + (func $i8x16.replace_lane (param $0 v128) (param $1 i32) (result v128) + (i8x16.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.splat (param $0 i32) (result v128) + (i16x8.splat + (get_local $0) + ) + ) + (func $i16x8.extract_lane_s (param $0 v128) (result i32) + (i16x8.extract_lane_s 0 + (get_local $0) + ) + ) + (func $i16x8.extract_lane_u (param $0 v128) (result i32) + (i16x8.extract_lane_u 0 + (get_local $0) + ) + ) + (func $i16x8.replace_lane (param $0 v128) (param $1 i32) (result v128) + (i16x8.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.splat (param $0 i32) (result v128) + (i32x4.splat + (get_local $0) + ) + ) + (func $i32x4.extract_lane (param $0 v128) (result i32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $i32x4.replace_lane (param $0 v128) (param $1 i32) (result v128) + (i32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.extract_lane (param $0 v128) (result i64) + (i64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $i64x2.replace_lane (param $0 v128) (param $1 i64) (result v128) + (i64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.splat (param $0 f32) (result v128) + (f32x4.splat + (get_local $0) + ) + ) + (func $f32x4.extract_lane (param $0 v128) (result f32) + (f32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $f32x4.replace_lane (param $0 v128) (param $1 f32) (result v128) + (f32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.splat (param $0 f64) (result v128) + (f64x2.splat + (get_local $0) + ) + ) + (func $f64x2.extract_lane (param $0 v128) (result f64) + (f64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $f64x2.replace_lane (param $0 v128) (param $1 f64) (result v128) + (f64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.eq (param $0 v128) (param $1 v128) (result v128) + (i8x16.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ne (param $0 v128) (param $1 v128) (result v128) + (i8x16.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.lt_s (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.lt_u (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.gt_s (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.gt_u (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.le_s (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.le_u (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ge_s (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ge_u (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.eq (param $0 v128) (param $1 v128) (result v128) + (i16x8.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ne (param $0 v128) (param $1 v128) (result v128) + (i16x8.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.lt_s (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.lt_u (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.gt_s (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.gt_u (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.le_s (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.le_u (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ge_s (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ge_u (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.eq (param $0 v128) (param $1 v128) (result v128) + (i32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ne (param $0 v128) (param $1 v128) (result v128) + (i32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.lt_s (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.lt_u (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.gt_s (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.gt_u (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.le_s (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.le_u (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ge_s (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ge_u (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.eq (param $0 v128) (param $1 v128) (result v128) + (f32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.ne (param $0 v128) (param $1 v128) (result v128) + (f32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.lt (param $0 v128) (param $1 v128) (result v128) + (f32x4.lt + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.gt (param $0 v128) (param $1 v128) (result v128) + (f32x4.gt + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.le (param $0 v128) (param $1 v128) (result v128) + (f32x4.le + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.ge (param $0 v128) (param $1 v128) (result v128) + (f32x4.ge + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.eq (param $0 v128) (param $1 v128) (result v128) + (f64x2.eq + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.ne (param $0 v128) (param $1 v128) (result v128) + (f64x2.ne + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.lt (param $0 v128) (param $1 v128) (result v128) + (f64x2.lt + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.gt (param $0 v128) (param $1 v128) (result v128) + (f64x2.gt + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.le (param $0 v128) (param $1 v128) (result v128) + (f64x2.le + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.ge (param $0 v128) (param $1 v128) (result v128) + (f64x2.ge + (get_local $0) + (get_local $1) + ) + ) + (func $v128.not (param $0 v128) (result v128) + (v128.not + (get_local $0) + ) + ) + (func $v128.and (param $0 v128) (param $1 v128) (result v128) + (v128.and + (get_local $0) + (get_local $1) + ) + ) + (func $v128.or (param $0 v128) (param $1 v128) (result v128) + (v128.or + (get_local $0) + (get_local $1) + ) + ) + (func $v128.xor (param $0 v128) (param $1 v128) (result v128) + (v128.xor + (get_local $0) + (get_local $1) + ) + ) + (func $v128.bitselect (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (v128.bitselect + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $i8x16.neg (param $0 v128) (result v128) + (i8x16.neg + (get_local $0) + ) + ) + (func $i8x16.any_true (param $0 v128) (result i32) + (i8x16.any_true + (get_local $0) + ) + ) + (func $i8x16.all_true (param $0 v128) (result i32) + (i8x16.all_true + (get_local $0) + ) + ) + (func $i8x16.shl (param $0 v128) (param $1 i32) (result v128) + (i8x16.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.shr_s (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.shr_u (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add (param $0 v128) (param $1 v128) (result v128) + (i8x16.add + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add_saturate_s (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add_saturate_u (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub_saturate_s (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub_saturate_u (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.mul (param $0 v128) (param $1 v128) (result v128) + (i8x16.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.neg (param $0 v128) (result v128) + (i16x8.neg + (get_local $0) + ) + ) + (func $i16x8.any_true (param $0 v128) (result i32) + (i16x8.any_true + (get_local $0) + ) + ) + (func $i16x8.all_true (param $0 v128) (result i32) + (i16x8.all_true + (get_local $0) + ) + ) + (func $i16x8.shl (param $0 v128) (param $1 i32) (result v128) + (i16x8.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.shr_s (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.shr_u (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add (param $0 v128) (param $1 v128) (result v128) + (i16x8.add + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add_saturate_s (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add_saturate_u (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub_saturate_s (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub_saturate_u (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.mul (param $0 v128) (param $1 v128) (result v128) + (i16x8.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.neg (param $0 v128) (result v128) + (i32x4.neg + (get_local $0) + ) + ) + (func $i32x4.any_true (param $0 v128) (result i32) + (i32x4.any_true + (get_local $0) + ) + ) + (func $i32x4.all_true (param $0 v128) (result i32) + (i32x4.all_true + (get_local $0) + ) + ) + (func $i32x4.shl (param $0 v128) (param $1 i32) (result v128) + (i32x4.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.shr_s (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.shr_u (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.add (param $0 v128) (param $1 v128) (result v128) + (i32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.sub (param $0 v128) (param $1 v128) (result v128) + (i32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.mul (param $0 v128) (param $1 v128) (result v128) + (i32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.neg (param $0 v128) (result v128) + (i64x2.neg + (get_local $0) + ) + ) + (func $i64x2.any_true (param $0 v128) (result i32) + (i64x2.any_true + (get_local $0) + ) + ) + (func $i64x2.all_true (param $0 v128) (result i32) + (i64x2.all_true + (get_local $0) + ) + ) + (func $i64x2.shl (param $0 v128) (param $1 i32) (result v128) + (i64x2.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.shr_s (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.shr_u (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.add (param $0 v128) (param $1 v128) (result v128) + (i64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.sub (param $0 v128) (param $1 v128) (result v128) + (i64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.add (param $0 v128) (param $1 v128) (result v128) + (f32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.sub (param $0 v128) (param $1 v128) (result v128) + (f32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.mul (param $0 v128) (param $1 v128) (result v128) + (f32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.div (param $0 v128) (param $1 v128) (result v128) + (f32x4.div + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.min (param $0 v128) (param $1 v128) (result v128) + (f32x4.min + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.max (param $0 v128) (param $1 v128) (result v128) + (f32x4.max + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.abs (param $0 v128) (result v128) + (f32x4.abs + (get_local $0) + ) + ) + (func $f32x4.neg (param $0 v128) (result v128) + (f32x4.neg + (get_local $0) + ) + ) + (func $f32x4.sqrt (param $0 v128) (result v128) + (f32x4.sqrt + (get_local $0) + ) + ) + (func $f64x2.add (param $0 v128) (param $1 v128) (result v128) + (f64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.sub (param $0 v128) (param $1 v128) (result v128) + (f64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.mul (param $0 v128) (param $1 v128) (result v128) + (f64x2.mul + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.div (param $0 v128) (param $1 v128) (result v128) + (f64x2.div + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.min (param $0 v128) (param $1 v128) (result v128) + (f64x2.min + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.max (param $0 v128) (param $1 v128) (result v128) + (f64x2.max + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.abs (param $0 v128) (result v128) + (f64x2.abs + (get_local $0) + ) + ) + (func $f64x2.neg (param $0 v128) (result v128) + (f64x2.neg + (get_local $0) + ) + ) + (func $f64x2.sqrt (param $0 v128) (result v128) + (f64x2.sqrt + (get_local $0) + ) + ) + (func $i32x4.trunc_s/f32x4:sat (param $0 v128) (result v128) + (i32x4.trunc_s/f32x4:sat + (get_local $0) + ) + ) + (func $i32x4.trunc_u/f32x4:sat (param $0 v128) (result v128) + (i32x4.trunc_u/f32x4:sat + (get_local $0) + ) + ) + (func $i64x2.trunc_s/f64x2:sat (param $0 v128) (result v128) + (i64x2.trunc_s/f64x2:sat + (get_local $0) + ) + ) + (func $i64x2.trunc_u/f64x2:sat (param $0 v128) (result v128) + (i64x2.trunc_u/f64x2:sat + (get_local $0) + ) + ) + (func $f32x4.convert_s/i32x4 (param $0 v128) (result v128) + (f32x4.convert_s/i32x4 + (get_local $0) + ) + ) + (func $f32x4.convert_u/i32x4 (param $0 v128) (result v128) + (f32x4.convert_u/i32x4 + (get_local $0) + ) + ) + (func $f64x2.convert_s/i64x2 (param $0 v128) (result v128) + (f64x2.convert_s/i64x2 + (get_local $0) + ) + ) + (func $f64x2.convert_u/i64x2 (param $0 v128) (result v128) + (f64x2.convert_u/i64x2 + (get_local $0) + ) + ) +) diff --git a/test/simd.wast.from-wast b/test/simd.wast.from-wast new file mode 100644 index 00000000000..89b35e65bbb --- /dev/null +++ b/test/simd.wast.from-wast @@ -0,0 +1,809 @@ +(module + (type $0 (func (param i32) (result v128))) + (type $1 (func (param i32 v128))) + (type $2 (func (result v128))) + (type $3 (func (param v128 v128) (result v128))) + (type $4 (func (param v128) (result i32))) + (type $5 (func (param v128 i32) (result v128))) + (type $6 (func (param v128) (result i64))) + (type $7 (func (param v128 i64) (result v128))) + (type $8 (func (param f32) (result v128))) + (type $9 (func (param v128) (result f32))) + (type $10 (func (param v128 f32) (result v128))) + (type $11 (func (param f64) (result v128))) + (type $12 (func (param v128) (result f64))) + (type $13 (func (param v128 f64) (result v128))) + (type $14 (func (param v128) (result v128))) + (type $15 (func (param v128 v128 v128) (result v128))) + (func $v128.load (; 0 ;) (type $0) (param $0 i32) (result v128) + (v128.load + (get_local $0) + ) + ) + (func $v128.store (; 1 ;) (type $1) (param $0 i32) (param $1 v128) + (v128.store + (get_local $0) + (get_local $1) + ) + ) + (func $v128.const (; 2 ;) (type $2) (result v128) + (v128.const i32 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0) + ) + (func $v128.shuffle (; 3 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.splat (; 4 ;) (type $0) (param $0 i32) (result v128) + (i8x16.splat + (get_local $0) + ) + ) + (func $i8x16.extract_lane_s (; 5 ;) (type $4) (param $0 v128) (result i32) + (i8x16.extract_lane_s 0 + (get_local $0) + ) + ) + (func $i8x16.extract_lane_u (; 6 ;) (type $4) (param $0 v128) (result i32) + (i8x16.extract_lane_u 0 + (get_local $0) + ) + ) + (func $i8x16.replace_lane (; 7 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.splat (; 8 ;) (type $0) (param $0 i32) (result v128) + (i16x8.splat + (get_local $0) + ) + ) + (func $i16x8.extract_lane_s (; 9 ;) (type $4) (param $0 v128) (result i32) + (i16x8.extract_lane_s 0 + (get_local $0) + ) + ) + (func $i16x8.extract_lane_u (; 10 ;) (type $4) (param $0 v128) (result i32) + (i16x8.extract_lane_u 0 + (get_local $0) + ) + ) + (func $i16x8.replace_lane (; 11 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.splat (; 12 ;) (type $0) (param $0 i32) (result v128) + (i32x4.splat + (get_local $0) + ) + ) + (func $i32x4.extract_lane (; 13 ;) (type $4) (param $0 v128) (result i32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $i32x4.replace_lane (; 14 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.extract_lane (; 15 ;) (type $6) (param $0 v128) (result i64) + (i64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $i64x2.replace_lane (; 16 ;) (type $7) (param $0 v128) (param $1 i64) (result v128) + (i64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.splat (; 17 ;) (type $8) (param $0 f32) (result v128) + (f32x4.splat + (get_local $0) + ) + ) + (func $f32x4.extract_lane (; 18 ;) (type $9) (param $0 v128) (result f32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $f32x4.replace_lane (; 19 ;) (type $10) (param $0 v128) (param $1 f32) (result v128) + (f32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.splat (; 20 ;) (type $11) (param $0 f64) (result v128) + (f64x2.splat + (get_local $0) + ) + ) + (func $f64x2.extract_lane (; 21 ;) (type $12) (param $0 v128) (result f64) + (f64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $f64x2.replace_lane (; 22 ;) (type $13) (param $0 v128) (param $1 f64) (result v128) + (f64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.eq (; 23 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ne (; 24 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.lt_s (; 25 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.lt_u (; 26 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.gt_s (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.gt_u (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.le_s (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.le_u (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ge_s (; 31 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ge_u (; 32 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.eq (; 33 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ne (; 34 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.lt_s (; 35 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.lt_u (; 36 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.gt_s (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.gt_u (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.le_s (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.le_u (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ge_s (; 41 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ge_u (; 42 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.eq (; 43 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ne (; 44 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.lt_s (; 45 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.lt_u (; 46 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.gt_s (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.gt_u (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.le_s (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.le_u (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ge_s (; 51 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ge_u (; 52 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.eq (; 53 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.ne (; 54 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.lt (; 55 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.lt + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.gt (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.le + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.le (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.gt + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.ge (; 58 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.ge + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.eq (; 59 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.eq + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.ne (; 60 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.ne + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.lt (; 61 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.lt + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.gt (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.le + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.le (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.gt + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.ge (; 64 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.ge + (get_local $0) + (get_local $1) + ) + ) + (func $v128.not (; 65 ;) (type $14) (param $0 v128) (result v128) + (v128.not + (get_local $0) + ) + ) + (func $v128.and (; 66 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.and + (get_local $0) + (get_local $1) + ) + ) + (func $v128.or (; 67 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.or + (get_local $0) + (get_local $1) + ) + ) + (func $v128.xor (; 68 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.xor + (get_local $0) + (get_local $1) + ) + ) + (func $v128.bitselect (; 69 ;) (type $15) (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (v128.bitselect + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $i8x16.neg (; 70 ;) (type $14) (param $0 v128) (result v128) + (i8x16.neg + (get_local $0) + ) + ) + (func $i8x16.any_true (; 71 ;) (type $4) (param $0 v128) (result i32) + (i8x16.any_true + (get_local $0) + ) + ) + (func $i8x16.all_true (; 72 ;) (type $4) (param $0 v128) (result i32) + (i8x16.all_true + (get_local $0) + ) + ) + (func $i8x16.shl (; 73 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.shr_s (; 74 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.shr_u (; 75 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add (; 76 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add_saturate_s (; 77 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add_saturate_u (; 78 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub (; 79 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub_saturate_s (; 80 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub_saturate_u (; 81 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.mul (; 82 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.neg (; 83 ;) (type $14) (param $0 v128) (result v128) + (i16x8.neg + (get_local $0) + ) + ) + (func $i16x8.any_true (; 84 ;) (type $4) (param $0 v128) (result i32) + (i16x8.any_true + (get_local $0) + ) + ) + (func $i16x8.all_true (; 85 ;) (type $4) (param $0 v128) (result i32) + (i16x8.all_true + (get_local $0) + ) + ) + (func $i16x8.shl (; 86 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.shr_s (; 87 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.shr_u (; 88 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add (; 89 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add_saturate_s (; 90 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add_saturate_u (; 91 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub (; 92 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub_saturate_s (; 93 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub_saturate_u (; 94 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.mul (; 95 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.neg (; 96 ;) (type $14) (param $0 v128) (result v128) + (i32x4.neg + (get_local $0) + ) + ) + (func $i32x4.any_true (; 97 ;) (type $4) (param $0 v128) (result i32) + (i32x4.any_true + (get_local $0) + ) + ) + (func $i32x4.all_true (; 98 ;) (type $4) (param $0 v128) (result i32) + (i32x4.all_true + (get_local $0) + ) + ) + (func $i32x4.shl (; 99 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.shr_s (; 100 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.shr_u (; 101 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.add (; 102 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.sub (; 103 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.mul (; 104 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.neg (; 105 ;) (type $14) (param $0 v128) (result v128) + (i64x2.neg + (get_local $0) + ) + ) + (func $i64x2.any_true (; 106 ;) (type $4) (param $0 v128) (result i32) + (i64x2.any_true + (get_local $0) + ) + ) + (func $i64x2.all_true (; 107 ;) (type $4) (param $0 v128) (result i32) + (i64x2.all_true + (get_local $0) + ) + ) + (func $i64x2.shl (; 108 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shl + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.shr_s (; 109 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_s + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.shr_u (; 110 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_u + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.add (; 111 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.sub (; 112 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.add (; 113 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.sub (; 114 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.mul (; 115 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.div (; 116 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.div + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.min (; 117 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.min + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.max (; 118 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.max + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.abs (; 119 ;) (type $14) (param $0 v128) (result v128) + (f32x4.abs + (get_local $0) + ) + ) + (func $f32x4.neg (; 120 ;) (type $14) (param $0 v128) (result v128) + (f32x4.neg + (get_local $0) + ) + ) + (func $f32x4.sqrt (; 121 ;) (type $14) (param $0 v128) (result v128) + (f32x4.sqrt + (get_local $0) + ) + ) + (func $f64x2.add (; 122 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.sub (; 123 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.mul (; 124 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.mul + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.div (; 125 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.div + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.min (; 126 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.min + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.max (; 127 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.max + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.abs (; 128 ;) (type $14) (param $0 v128) (result v128) + (f64x2.abs + (get_local $0) + ) + ) + (func $f64x2.neg (; 129 ;) (type $14) (param $0 v128) (result v128) + (f64x2.neg + (get_local $0) + ) + ) + (func $f64x2.sqrt (; 130 ;) (type $14) (param $0 v128) (result v128) + (f64x2.sqrt + (get_local $0) + ) + ) + (func $i32x4.trunc_s/f32x4:sat (; 131 ;) (type $14) (param $0 v128) (result v128) + (i32x4.trunc_s/f32x4:sat + (get_local $0) + ) + ) + (func $i32x4.trunc_u/f32x4:sat (; 132 ;) (type $14) (param $0 v128) (result v128) + (i32x4.trunc_u/f32x4:sat + (get_local $0) + ) + ) + (func $i64x2.trunc_s/f64x2:sat (; 133 ;) (type $14) (param $0 v128) (result v128) + (i64x2.trunc_s/f64x2:sat + (get_local $0) + ) + ) + (func $i64x2.trunc_u/f64x2:sat (; 134 ;) (type $14) (param $0 v128) (result v128) + (i64x2.trunc_u/f64x2:sat + (get_local $0) + ) + ) + (func $f32x4.convert_s/i32x4 (; 135 ;) (type $14) (param $0 v128) (result v128) + (f32x4.convert_s/i32x4 + (get_local $0) + ) + ) + (func $f32x4.convert_u/i32x4 (; 136 ;) (type $14) (param $0 v128) (result v128) + (f32x4.convert_u/i32x4 + (get_local $0) + ) + ) + (func $f64x2.convert_s/i64x2 (; 137 ;) (type $14) (param $0 v128) (result v128) + (f64x2.convert_s/i64x2 + (get_local $0) + ) + ) + (func $f64x2.convert_u/i64x2 (; 138 ;) (type $14) (param $0 v128) (result v128) + (f64x2.convert_u/i64x2 + (get_local $0) + ) + ) +) diff --git a/test/simd.wast.fromBinary b/test/simd.wast.fromBinary new file mode 100644 index 00000000000..4e36bfbb5df --- /dev/null +++ b/test/simd.wast.fromBinary @@ -0,0 +1,810 @@ +(module + (type $0 (func (param i32) (result v128))) + (type $1 (func (param i32 v128))) + (type $2 (func (result v128))) + (type $3 (func (param v128 v128) (result v128))) + (type $4 (func (param v128) (result i32))) + (type $5 (func (param v128 i32) (result v128))) + (type $6 (func (param v128) (result i64))) + (type $7 (func (param v128 i64) (result v128))) + (type $8 (func (param f32) (result v128))) + (type $9 (func (param v128) (result f32))) + (type $10 (func (param v128 f32) (result v128))) + (type $11 (func (param f64) (result v128))) + (type $12 (func (param v128) (result f64))) + (type $13 (func (param v128 f64) (result v128))) + (type $14 (func (param v128) (result v128))) + (type $15 (func (param v128 v128 v128) (result v128))) + (func $v128.load (; 0 ;) (type $0) (param $0 i32) (result v128) + (v128.load + (get_local $0) + ) + ) + (func $v128.store (; 1 ;) (type $1) (param $0 i32) (param $1 v128) + (v128.store + (get_local $0) + (get_local $1) + ) + ) + (func $v128.const (; 2 ;) (type $2) (result v128) + (v128.const i32 20 37 80 7e fd 7f 0 0 60 37 80 7e fd 7f 0 0) + ) + (func $v128.shuffle (; 3 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.splat (; 4 ;) (type $0) (param $0 i32) (result v128) + (i8x16.splat + (get_local $0) + ) + ) + (func $i8x16.extract_lane_s (; 5 ;) (type $4) (param $0 v128) (result i32) + (i8x16.extract_lane_s 0 + (get_local $0) + ) + ) + (func $i8x16.extract_lane_u (; 6 ;) (type $4) (param $0 v128) (result i32) + (i8x16.extract_lane_u 0 + (get_local $0) + ) + ) + (func $i8x16.replace_lane (; 7 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.splat (; 8 ;) (type $0) (param $0 i32) (result v128) + (i16x8.splat + (get_local $0) + ) + ) + (func $i16x8.extract_lane_s (; 9 ;) (type $4) (param $0 v128) (result i32) + (i16x8.extract_lane_s 0 + (get_local $0) + ) + ) + (func $i16x8.extract_lane_u (; 10 ;) (type $4) (param $0 v128) (result i32) + (i16x8.extract_lane_u 0 + (get_local $0) + ) + ) + (func $i16x8.replace_lane (; 11 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.splat (; 12 ;) (type $0) (param $0 i32) (result v128) + (i32x4.splat + (get_local $0) + ) + ) + (func $i32x4.extract_lane (; 13 ;) (type $4) (param $0 v128) (result i32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $i32x4.replace_lane (; 14 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.extract_lane (; 15 ;) (type $6) (param $0 v128) (result i64) + (i64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $i64x2.replace_lane (; 16 ;) (type $7) (param $0 v128) (param $1 i64) (result v128) + (i64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.splat (; 17 ;) (type $8) (param $0 f32) (result v128) + (f32x4.splat + (get_local $0) + ) + ) + (func $f32x4.extract_lane (; 18 ;) (type $9) (param $0 v128) (result f32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $f32x4.replace_lane (; 19 ;) (type $10) (param $0 v128) (param $1 f32) (result v128) + (f32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.splat (; 20 ;) (type $11) (param $0 f64) (result v128) + (f64x2.splat + (get_local $0) + ) + ) + (func $f64x2.extract_lane (; 21 ;) (type $12) (param $0 v128) (result f64) + (f64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $f64x2.replace_lane (; 22 ;) (type $13) (param $0 v128) (param $1 f64) (result v128) + (f64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.eq (; 23 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ne (; 24 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.lt_s (; 25 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.lt_u (; 26 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.gt_s (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.gt_u (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.le_s (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.le_u (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ge_s (; 31 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.ge_u (; 32 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.eq (; 33 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ne (; 34 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.lt_s (; 35 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.lt_u (; 36 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.gt_s (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.gt_u (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.le_s (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.le_u (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ge_s (; 41 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.ge_u (; 42 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.eq (; 43 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ne (; 44 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.lt_s (; 45 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.lt_u (; 46 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.gt_s (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.gt_u (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.le_s (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.le_u (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ge_s (; 51 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.ge_u (; 52 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.eq (; 53 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.ne (; 54 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.lt (; 55 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.lt + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.gt (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.gt + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.le (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.le + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.ge (; 58 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.ge + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.eq (; 59 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.eq + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.ne (; 60 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.ne + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.lt (; 61 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.lt + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.gt (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.gt + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.le (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.le + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.ge (; 64 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.ge + (get_local $0) + (get_local $1) + ) + ) + (func $v128.not (; 65 ;) (type $14) (param $0 v128) (result v128) + (v128.not + (get_local $0) + ) + ) + (func $v128.and (; 66 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.and + (get_local $0) + (get_local $1) + ) + ) + (func $v128.or (; 67 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.or + (get_local $0) + (get_local $1) + ) + ) + (func $v128.xor (; 68 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.xor + (get_local $0) + (get_local $1) + ) + ) + (func $v128.bitselect (; 69 ;) (type $15) (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (v128.bitselect + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $i8x16.neg (; 70 ;) (type $14) (param $0 v128) (result v128) + (i8x16.neg + (get_local $0) + ) + ) + (func $i8x16.any_true (; 71 ;) (type $4) (param $0 v128) (result i32) + (i8x16.any_true + (get_local $0) + ) + ) + (func $i8x16.all_true (; 72 ;) (type $4) (param $0 v128) (result i32) + (i8x16.all_true + (get_local $0) + ) + ) + (func $i8x16.shl (; 73 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shl + (get_local $1) + (get_local $0) + ) + ) + (func $i8x16.shr_s (; 74 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $i8x16.shr_u (; 75 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $i8x16.add (; 76 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add_saturate_s (; 77 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.add_saturate_u (; 78 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub (; 79 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub_saturate_s (; 80 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.sub_saturate_u (; 81 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i8x16.mul (; 82 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.neg (; 83 ;) (type $14) (param $0 v128) (result v128) + (i16x8.neg + (get_local $0) + ) + ) + (func $i16x8.any_true (; 84 ;) (type $4) (param $0 v128) (result i32) + (i16x8.any_true + (get_local $0) + ) + ) + (func $i16x8.all_true (; 85 ;) (type $4) (param $0 v128) (result i32) + (i16x8.all_true + (get_local $0) + ) + ) + (func $i16x8.shl (; 86 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shl + (get_local $1) + (get_local $0) + ) + ) + (func $i16x8.shr_s (; 87 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $i16x8.shr_u (; 88 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $i16x8.add (; 89 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add_saturate_s (; 90 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.add_saturate_u (; 91 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub (; 92 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub_saturate_s (; 93 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.sub_saturate_u (; 94 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $i16x8.mul (; 95 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.neg (; 96 ;) (type $14) (param $0 v128) (result v128) + (i32x4.neg + (get_local $0) + ) + ) + (func $i32x4.any_true (; 97 ;) (type $4) (param $0 v128) (result i32) + (i32x4.any_true + (get_local $0) + ) + ) + (func $i32x4.all_true (; 98 ;) (type $4) (param $0 v128) (result i32) + (i32x4.all_true + (get_local $0) + ) + ) + (func $i32x4.shl (; 99 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shl + (get_local $1) + (get_local $0) + ) + ) + (func $i32x4.shr_s (; 100 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $i32x4.shr_u (; 101 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $i32x4.add (; 102 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.sub (; 103 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $i32x4.mul (; 104 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.neg (; 105 ;) (type $14) (param $0 v128) (result v128) + (i64x2.neg + (get_local $0) + ) + ) + (func $i64x2.any_true (; 106 ;) (type $4) (param $0 v128) (result i32) + (i64x2.any_true + (get_local $0) + ) + ) + (func $i64x2.all_true (; 107 ;) (type $4) (param $0 v128) (result i32) + (i64x2.all_true + (get_local $0) + ) + ) + (func $i64x2.shl (; 108 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shl + (get_local $1) + (get_local $0) + ) + ) + (func $i64x2.shr_s (; 109 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $i64x2.shr_u (; 110 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $i64x2.add (; 111 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $i64x2.sub (; 112 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.add (; 113 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.sub (; 114 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.mul (; 115 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.div (; 116 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.div + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.min (; 117 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.min + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.max (; 118 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.max + (get_local $0) + (get_local $1) + ) + ) + (func $f32x4.abs (; 119 ;) (type $14) (param $0 v128) (result v128) + (f32x4.abs + (get_local $0) + ) + ) + (func $f32x4.neg (; 120 ;) (type $14) (param $0 v128) (result v128) + (f32x4.neg + (get_local $0) + ) + ) + (func $f32x4.sqrt (; 121 ;) (type $14) (param $0 v128) (result v128) + (f32x4.sqrt + (get_local $0) + ) + ) + (func $f64x2.add (; 122 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.sub (; 123 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.mul (; 124 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.mul + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.div (; 125 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.div + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.min (; 126 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.min + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.max (; 127 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.max + (get_local $0) + (get_local $1) + ) + ) + (func $f64x2.abs (; 128 ;) (type $14) (param $0 v128) (result v128) + (f64x2.abs + (get_local $0) + ) + ) + (func $f64x2.neg (; 129 ;) (type $14) (param $0 v128) (result v128) + (f64x2.neg + (get_local $0) + ) + ) + (func $f64x2.sqrt (; 130 ;) (type $14) (param $0 v128) (result v128) + (f64x2.sqrt + (get_local $0) + ) + ) + (func $i32x4.trunc_s/f32x4:sat (; 131 ;) (type $14) (param $0 v128) (result v128) + (i32x4.trunc_s/f32x4:sat + (get_local $0) + ) + ) + (func $i32x4.trunc_u/f32x4:sat (; 132 ;) (type $14) (param $0 v128) (result v128) + (i32x4.trunc_u/f32x4:sat + (get_local $0) + ) + ) + (func $i64x2.trunc_s/f64x2:sat (; 133 ;) (type $14) (param $0 v128) (result v128) + (i64x2.trunc_s/f64x2:sat + (get_local $0) + ) + ) + (func $i64x2.trunc_u/f64x2:sat (; 134 ;) (type $14) (param $0 v128) (result v128) + (i64x2.trunc_u/f64x2:sat + (get_local $0) + ) + ) + (func $f32x4.convert_s/i32x4 (; 135 ;) (type $14) (param $0 v128) (result v128) + (f32x4.convert_s/i32x4 + (get_local $0) + ) + ) + (func $f32x4.convert_u/i32x4 (; 136 ;) (type $14) (param $0 v128) (result v128) + (f32x4.convert_u/i32x4 + (get_local $0) + ) + ) + (func $f64x2.convert_s/i64x2 (; 137 ;) (type $14) (param $0 v128) (result v128) + (f64x2.convert_s/i64x2 + (get_local $0) + ) + ) + (func $f64x2.convert_u/i64x2 (; 138 ;) (type $14) (param $0 v128) (result v128) + (f64x2.convert_u/i64x2 + (get_local $0) + ) + ) +) + diff --git a/test/simd.wast.fromBinary.noDebugInfo b/test/simd.wast.fromBinary.noDebugInfo new file mode 100644 index 00000000000..2ebadb33090 --- /dev/null +++ b/test/simd.wast.fromBinary.noDebugInfo @@ -0,0 +1,810 @@ +(module + (type $0 (func (param i32) (result v128))) + (type $1 (func (param i32 v128))) + (type $2 (func (result v128))) + (type $3 (func (param v128 v128) (result v128))) + (type $4 (func (param v128) (result i32))) + (type $5 (func (param v128 i32) (result v128))) + (type $6 (func (param v128) (result i64))) + (type $7 (func (param v128 i64) (result v128))) + (type $8 (func (param f32) (result v128))) + (type $9 (func (param v128) (result f32))) + (type $10 (func (param v128 f32) (result v128))) + (type $11 (func (param f64) (result v128))) + (type $12 (func (param v128) (result f64))) + (type $13 (func (param v128 f64) (result v128))) + (type $14 (func (param v128) (result v128))) + (type $15 (func (param v128 v128 v128) (result v128))) + (func $0 (; 0 ;) (type $0) (param $0 i32) (result v128) + (v128.load + (get_local $0) + ) + ) + (func $1 (; 1 ;) (type $1) (param $0 i32) (param $1 v128) + (v128.store + (get_local $0) + (get_local $1) + ) + ) + (func $2 (; 2 ;) (type $2) (result v128) + (v128.const i32 30 de 5b ef fd 7f 0 0 70 de 5b ef fd 7f 0 0) + ) + (func $3 (; 3 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 + (get_local $0) + (get_local $1) + ) + ) + (func $4 (; 4 ;) (type $0) (param $0 i32) (result v128) + (i8x16.splat + (get_local $0) + ) + ) + (func $5 (; 5 ;) (type $4) (param $0 v128) (result i32) + (i8x16.extract_lane_s 0 + (get_local $0) + ) + ) + (func $6 (; 6 ;) (type $4) (param $0 v128) (result i32) + (i8x16.extract_lane_u 0 + (get_local $0) + ) + ) + (func $7 (; 7 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $8 (; 8 ;) (type $0) (param $0 i32) (result v128) + (i16x8.splat + (get_local $0) + ) + ) + (func $9 (; 9 ;) (type $4) (param $0 v128) (result i32) + (i16x8.extract_lane_s 0 + (get_local $0) + ) + ) + (func $10 (; 10 ;) (type $4) (param $0 v128) (result i32) + (i16x8.extract_lane_u 0 + (get_local $0) + ) + ) + (func $11 (; 11 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $12 (; 12 ;) (type $0) (param $0 i32) (result v128) + (i32x4.splat + (get_local $0) + ) + ) + (func $13 (; 13 ;) (type $4) (param $0 v128) (result i32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $14 (; 14 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $15 (; 15 ;) (type $6) (param $0 v128) (result i64) + (i64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $16 (; 16 ;) (type $7) (param $0 v128) (param $1 i64) (result v128) + (i64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $17 (; 17 ;) (type $8) (param $0 f32) (result v128) + (f32x4.splat + (get_local $0) + ) + ) + (func $18 (; 18 ;) (type $9) (param $0 v128) (result f32) + (i32x4.extract_lane 0 + (get_local $0) + ) + ) + (func $19 (; 19 ;) (type $10) (param $0 v128) (param $1 f32) (result v128) + (f32x4.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $20 (; 20 ;) (type $11) (param $0 f64) (result v128) + (f64x2.splat + (get_local $0) + ) + ) + (func $21 (; 21 ;) (type $12) (param $0 v128) (result f64) + (f64x2.extract_lane 0 + (get_local $0) + ) + ) + (func $22 (; 22 ;) (type $13) (param $0 v128) (param $1 f64) (result v128) + (f64x2.replace_lane 0 + (get_local $0) + (get_local $1) + ) + ) + (func $23 (; 23 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.eq + (get_local $0) + (get_local $1) + ) + ) + (func $24 (; 24 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ne + (get_local $0) + (get_local $1) + ) + ) + (func $25 (; 25 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $26 (; 26 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $27 (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $28 (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $29 (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $30 (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $31 (; 31 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $32 (; 32 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $33 (; 33 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.eq + (get_local $0) + (get_local $1) + ) + ) + (func $34 (; 34 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ne + (get_local $0) + (get_local $1) + ) + ) + (func $35 (; 35 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $36 (; 36 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $37 (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $38 (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $39 (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $40 (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $41 (; 41 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $42 (; 42 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $43 (; 43 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $44 (; 44 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $45 (; 45 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_s + (get_local $0) + (get_local $1) + ) + ) + (func $46 (; 46 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.lt_u + (get_local $0) + (get_local $1) + ) + ) + (func $47 (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_s + (get_local $0) + (get_local $1) + ) + ) + (func $48 (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.gt_u + (get_local $0) + (get_local $1) + ) + ) + (func $49 (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_s + (get_local $0) + (get_local $1) + ) + ) + (func $50 (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.le_u + (get_local $0) + (get_local $1) + ) + ) + (func $51 (; 51 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_s + (get_local $0) + (get_local $1) + ) + ) + (func $52 (; 52 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.ge_u + (get_local $0) + (get_local $1) + ) + ) + (func $53 (; 53 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.eq + (get_local $0) + (get_local $1) + ) + ) + (func $54 (; 54 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.ne + (get_local $0) + (get_local $1) + ) + ) + (func $55 (; 55 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.lt + (get_local $0) + (get_local $1) + ) + ) + (func $56 (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.gt + (get_local $0) + (get_local $1) + ) + ) + (func $57 (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.le + (get_local $0) + (get_local $1) + ) + ) + (func $58 (; 58 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.ge + (get_local $0) + (get_local $1) + ) + ) + (func $59 (; 59 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.eq + (get_local $0) + (get_local $1) + ) + ) + (func $60 (; 60 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.ne + (get_local $0) + (get_local $1) + ) + ) + (func $61 (; 61 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.lt + (get_local $0) + (get_local $1) + ) + ) + (func $62 (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.gt + (get_local $0) + (get_local $1) + ) + ) + (func $63 (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.le + (get_local $0) + (get_local $1) + ) + ) + (func $64 (; 64 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.ge + (get_local $0) + (get_local $1) + ) + ) + (func $65 (; 65 ;) (type $14) (param $0 v128) (result v128) + (v128.not + (get_local $0) + ) + ) + (func $66 (; 66 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.and + (get_local $0) + (get_local $1) + ) + ) + (func $67 (; 67 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.or + (get_local $0) + (get_local $1) + ) + ) + (func $68 (; 68 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (v128.xor + (get_local $0) + (get_local $1) + ) + ) + (func $69 (; 69 ;) (type $15) (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (v128.bitselect + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $70 (; 70 ;) (type $14) (param $0 v128) (result v128) + (i8x16.neg + (get_local $0) + ) + ) + (func $71 (; 71 ;) (type $4) (param $0 v128) (result i32) + (i8x16.any_true + (get_local $0) + ) + ) + (func $72 (; 72 ;) (type $4) (param $0 v128) (result i32) + (i8x16.all_true + (get_local $0) + ) + ) + (func $73 (; 73 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shl + (get_local $1) + (get_local $0) + ) + ) + (func $74 (; 74 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $75 (; 75 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i8x16.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $76 (; 76 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add + (get_local $0) + (get_local $1) + ) + ) + (func $77 (; 77 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $78 (; 78 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $79 (; 79 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub + (get_local $0) + (get_local $1) + ) + ) + (func $80 (; 80 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $81 (; 81 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $82 (; 82 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i8x16.mul + (get_local $0) + (get_local $1) + ) + ) + (func $83 (; 83 ;) (type $14) (param $0 v128) (result v128) + (i16x8.neg + (get_local $0) + ) + ) + (func $84 (; 84 ;) (type $4) (param $0 v128) (result i32) + (i16x8.any_true + (get_local $0) + ) + ) + (func $85 (; 85 ;) (type $4) (param $0 v128) (result i32) + (i16x8.all_true + (get_local $0) + ) + ) + (func $86 (; 86 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shl + (get_local $1) + (get_local $0) + ) + ) + (func $87 (; 87 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $88 (; 88 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i16x8.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $89 (; 89 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add + (get_local $0) + (get_local $1) + ) + ) + (func $90 (; 90 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $91 (; 91 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.add_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $92 (; 92 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub + (get_local $0) + (get_local $1) + ) + ) + (func $93 (; 93 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_s + (get_local $0) + (get_local $1) + ) + ) + (func $94 (; 94 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.sub_saturate_u + (get_local $0) + (get_local $1) + ) + ) + (func $95 (; 95 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i16x8.mul + (get_local $0) + (get_local $1) + ) + ) + (func $96 (; 96 ;) (type $14) (param $0 v128) (result v128) + (i32x4.neg + (get_local $0) + ) + ) + (func $97 (; 97 ;) (type $4) (param $0 v128) (result i32) + (i32x4.any_true + (get_local $0) + ) + ) + (func $98 (; 98 ;) (type $4) (param $0 v128) (result i32) + (i32x4.all_true + (get_local $0) + ) + ) + (func $99 (; 99 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shl + (get_local $1) + (get_local $0) + ) + ) + (func $100 (; 100 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $101 (; 101 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i32x4.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $102 (; 102 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $103 (; 103 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $104 (; 104 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $105 (; 105 ;) (type $14) (param $0 v128) (result v128) + (i64x2.neg + (get_local $0) + ) + ) + (func $106 (; 106 ;) (type $4) (param $0 v128) (result i32) + (i64x2.any_true + (get_local $0) + ) + ) + (func $107 (; 107 ;) (type $4) (param $0 v128) (result i32) + (i64x2.all_true + (get_local $0) + ) + ) + (func $108 (; 108 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shl + (get_local $1) + (get_local $0) + ) + ) + (func $109 (; 109 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_s + (get_local $1) + (get_local $0) + ) + ) + (func $110 (; 110 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) + (i64x2.shr_u + (get_local $1) + (get_local $0) + ) + ) + (func $111 (; 111 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $112 (; 112 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (i64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $113 (; 113 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.add + (get_local $0) + (get_local $1) + ) + ) + (func $114 (; 114 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.sub + (get_local $0) + (get_local $1) + ) + ) + (func $115 (; 115 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.mul + (get_local $0) + (get_local $1) + ) + ) + (func $116 (; 116 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.div + (get_local $0) + (get_local $1) + ) + ) + (func $117 (; 117 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.min + (get_local $0) + (get_local $1) + ) + ) + (func $118 (; 118 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f32x4.max + (get_local $0) + (get_local $1) + ) + ) + (func $119 (; 119 ;) (type $14) (param $0 v128) (result v128) + (f32x4.abs + (get_local $0) + ) + ) + (func $120 (; 120 ;) (type $14) (param $0 v128) (result v128) + (f32x4.neg + (get_local $0) + ) + ) + (func $121 (; 121 ;) (type $14) (param $0 v128) (result v128) + (f32x4.sqrt + (get_local $0) + ) + ) + (func $122 (; 122 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.add + (get_local $0) + (get_local $1) + ) + ) + (func $123 (; 123 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.sub + (get_local $0) + (get_local $1) + ) + ) + (func $124 (; 124 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.mul + (get_local $0) + (get_local $1) + ) + ) + (func $125 (; 125 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.div + (get_local $0) + (get_local $1) + ) + ) + (func $126 (; 126 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.min + (get_local $0) + (get_local $1) + ) + ) + (func $127 (; 127 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) + (f64x2.max + (get_local $0) + (get_local $1) + ) + ) + (func $128 (; 128 ;) (type $14) (param $0 v128) (result v128) + (f64x2.abs + (get_local $0) + ) + ) + (func $129 (; 129 ;) (type $14) (param $0 v128) (result v128) + (f64x2.neg + (get_local $0) + ) + ) + (func $130 (; 130 ;) (type $14) (param $0 v128) (result v128) + (f64x2.sqrt + (get_local $0) + ) + ) + (func $131 (; 131 ;) (type $14) (param $0 v128) (result v128) + (i32x4.trunc_s/f32x4:sat + (get_local $0) + ) + ) + (func $132 (; 132 ;) (type $14) (param $0 v128) (result v128) + (i32x4.trunc_u/f32x4:sat + (get_local $0) + ) + ) + (func $133 (; 133 ;) (type $14) (param $0 v128) (result v128) + (i64x2.trunc_s/f64x2:sat + (get_local $0) + ) + ) + (func $134 (; 134 ;) (type $14) (param $0 v128) (result v128) + (i64x2.trunc_u/f64x2:sat + (get_local $0) + ) + ) + (func $135 (; 135 ;) (type $14) (param $0 v128) (result v128) + (f32x4.convert_s/i32x4 + (get_local $0) + ) + ) + (func $136 (; 136 ;) (type $14) (param $0 v128) (result v128) + (f32x4.convert_u/i32x4 + (get_local $0) + ) + ) + (func $137 (; 137 ;) (type $14) (param $0 v128) (result v128) + (f64x2.convert_s/i64x2 + (get_local $0) + ) + ) + (func $138 (; 138 ;) (type $14) (param $0 v128) (result v128) + (f64x2.convert_u/i64x2 + (get_local $0) + ) + ) +) + From 20fb55f065e47d91917e30c8c81e9208c0ce9f1e Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 13:52:21 -0800 Subject: [PATCH 11/36] Fix parsing bugs --- src/passes/Print.cpp | 2 +- src/wasm/literal.cpp | 4 ++-- src/wasm/wasm-binary.cpp | 2 +- test/passes/safe-heap.txt | 2 +- test/simd.wast.from-wast | 4 ++-- test/simd.wast.fromBinary | 28 +++++++++++++-------------- test/simd.wast.fromBinary.noDebugInfo | 28 +++++++++++++-------------- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index b9fb6cce712..f5139626bac 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -243,7 +243,7 @@ struct PrintExpressionContents : public Visitor { case ExtractLaneUVecI16x8: o << "i16x8.extract_lane_u"; break; case ExtractLaneVecI32x4: o << "i32x4.extract_lane"; break; case ExtractLaneVecI64x2: o << "i64x2.extract_lane"; break; - case ExtractLaneVecF32x4: o << "i32x4.extract_lane"; break; + case ExtractLaneVecF32x4: o << "f32x4.extract_lane"; break; case ExtractLaneVecF64x2: o << "f64x2.extract_lane"; break; } o << " " << int(curr->idx); diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 62856e96254..992e6da172f 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -32,7 +32,7 @@ template using LaneArray = std::array; Literal::Literal(uint8_t init[16]) : type(Type::v128) { - memcpy(&v128, &init, 16); + memcpy(&v128, init, 16); } template @@ -212,7 +212,7 @@ void Literal::printDouble(std::ostream& o, double d) { void Literal::printVec128(std::ostream& o, const std::array& v) { o << std::hex; for (auto i = 0; i < 16; ++i) { - o << uint32_t(v[i]); + o << "0x" << uint32_t(v[i]); if (i < 15) o << " "; } o << std::dec; diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index a9a8b2b024e..f51a85cc1b8 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2655,8 +2655,8 @@ bool WasmBinaryBuilder::maybeVisitSIMDShift(Expression*& out, uint32_t code) { case BinaryConsts::I64x2ShrU: curr = allocator.alloc(); curr->op = ShrUVecI64x2; break; default: return false; } - curr->vec = popNonVoidExpression(); curr->shift = popNonVoidExpression(); + curr->vec = popNonVoidExpression(); curr->finalize(); out = curr; return true; diff --git a/test/passes/safe-heap.txt b/test/passes/safe-heap.txt index ed94f85ed43..c3a3fcdce3d 100644 --- a/test/passes/safe-heap.txt +++ b/test/passes/safe-heap.txt @@ -171,7 +171,7 @@ (call $SAFE_HEAP_STORE_v128_16_16 (i32.const 14) (i32.const 0) - (v128.const i32 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0) + (v128.const i32 0x1 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x4 0x0 0x0 0x0) ) ) (func $SAFE_HEAP_LOAD_i32_1_A (; 4 ;) (param $0 i32) (param $1 i32) (result i32) diff --git a/test/simd.wast.from-wast b/test/simd.wast.from-wast index 89b35e65bbb..e66bc493e9a 100644 --- a/test/simd.wast.from-wast +++ b/test/simd.wast.from-wast @@ -27,7 +27,7 @@ ) ) (func $v128.const (; 2 ;) (type $2) (result v128) - (v128.const i32 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0) + (v128.const i32 0x1 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x4 0x0 0x0 0x0) ) (func $v128.shuffle (; 3 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 @@ -110,7 +110,7 @@ ) ) (func $f32x4.extract_lane (; 18 ;) (type $9) (param $0 v128) (result f32) - (i32x4.extract_lane 0 + (f32x4.extract_lane 0 (get_local $0) ) ) diff --git a/test/simd.wast.fromBinary b/test/simd.wast.fromBinary index 4e36bfbb5df..e3210a891bf 100644 --- a/test/simd.wast.fromBinary +++ b/test/simd.wast.fromBinary @@ -27,7 +27,7 @@ ) ) (func $v128.const (; 2 ;) (type $2) (result v128) - (v128.const i32 20 37 80 7e fd 7f 0 0 60 37 80 7e fd 7f 0 0) + (v128.const i32 0x1 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x4 0x0 0x0 0x0) ) (func $v128.shuffle (; 3 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 @@ -110,7 +110,7 @@ ) ) (func $f32x4.extract_lane (; 18 ;) (type $9) (param $0 v128) (result f32) - (i32x4.extract_lane 0 + (f32x4.extract_lane 0 (get_local $0) ) ) @@ -435,20 +435,20 @@ ) (func $i8x16.shl (; 73 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i8x16.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i8x16.shr_s (; 74 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i8x16.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i8x16.shr_u (; 75 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i8x16.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i8x16.add (; 76 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) @@ -510,20 +510,20 @@ ) (func $i16x8.shl (; 86 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i16x8.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i16x8.shr_s (; 87 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i16x8.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i16x8.shr_u (; 88 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i16x8.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i16x8.add (; 89 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) @@ -585,20 +585,20 @@ ) (func $i32x4.shl (; 99 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i32x4.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i32x4.shr_s (; 100 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i32x4.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i32x4.shr_u (; 101 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i32x4.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i32x4.add (; 102 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) @@ -636,20 +636,20 @@ ) (func $i64x2.shl (; 108 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i64x2.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i64x2.shr_s (; 109 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i64x2.shr_u (; 110 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $i64x2.add (; 111 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) diff --git a/test/simd.wast.fromBinary.noDebugInfo b/test/simd.wast.fromBinary.noDebugInfo index 2ebadb33090..e2d5c964770 100644 --- a/test/simd.wast.fromBinary.noDebugInfo +++ b/test/simd.wast.fromBinary.noDebugInfo @@ -27,7 +27,7 @@ ) ) (func $2 (; 2 ;) (type $2) (result v128) - (v128.const i32 30 de 5b ef fd 7f 0 0 70 de 5b ef fd 7f 0 0) + (v128.const i32 0x1 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x4 0x0 0x0 0x0) ) (func $3 (; 3 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 @@ -110,7 +110,7 @@ ) ) (func $18 (; 18 ;) (type $9) (param $0 v128) (result f32) - (i32x4.extract_lane 0 + (f32x4.extract_lane 0 (get_local $0) ) ) @@ -435,20 +435,20 @@ ) (func $73 (; 73 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i8x16.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $74 (; 74 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i8x16.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $75 (; 75 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i8x16.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $76 (; 76 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) @@ -510,20 +510,20 @@ ) (func $86 (; 86 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i16x8.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $87 (; 87 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i16x8.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $88 (; 88 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i16x8.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $89 (; 89 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) @@ -585,20 +585,20 @@ ) (func $99 (; 99 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i32x4.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $100 (; 100 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i32x4.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $101 (; 101 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i32x4.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $102 (; 102 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) @@ -636,20 +636,20 @@ ) (func $108 (; 108 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i64x2.shl - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $109 (; 109 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_s - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $110 (; 110 ;) (type $5) (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_u - (get_local $1) (get_local $0) + (get_local $1) ) ) (func $111 (; 111 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) From f15ba6da840720d8a1e6d4cfce9ad09fc7e7eb6d Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 14:26:24 -0800 Subject: [PATCH 12/36] Fix parser error mixing up Le/Gt simd comparisons --- scripts/gen-s-parser.py | 32 +++++++++++++-------------- src/gen-s-parser.inc | 32 +++++++++++++-------------- test/simd.wast.from-wast | 32 +++++++++++++-------------- test/simd.wast.fromBinary | 32 +++++++++++++-------------- test/simd.wast.fromBinary.noDebugInfo | 32 +++++++++++++-------------- 5 files changed, 80 insertions(+), 80 deletions(-) diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index daf3c03a657..ea96f3d49b6 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -297,43 +297,43 @@ ("i8x16.ne", "makeBinary(s, BinaryOp::NeVecI8x16)"), ("i8x16.lt_s", "makeBinary(s, BinaryOp::LtSVecI8x16)"), ("i8x16.lt_u", "makeBinary(s, BinaryOp::LtUVecI8x16)"), - ("i8x16.gt_s", "makeBinary(s, BinaryOp::LeSVecI8x16)"), - ("i8x16.gt_u", "makeBinary(s, BinaryOp::LeUVecI8x16)"), - ("i8x16.le_s", "makeBinary(s, BinaryOp::GtSVecI8x16)"), - ("i8x16.le_u", "makeBinary(s, BinaryOp::GtUVecI8x16)"), + ("i8x16.gt_s", "makeBinary(s, BinaryOp::GtSVecI8x16)"), + ("i8x16.gt_u", "makeBinary(s, BinaryOp::GtUVecI8x16)"), + ("i8x16.le_s", "makeBinary(s, BinaryOp::LeSVecI8x16)"), + ("i8x16.le_u", "makeBinary(s, BinaryOp::LeUVecI8x16)"), ("i8x16.ge_s", "makeBinary(s, BinaryOp::GeSVecI8x16)"), ("i8x16.ge_u", "makeBinary(s, BinaryOp::GeUVecI8x16)"), ("i16x8.eq", "makeBinary(s, BinaryOp::EqVecI16x8)"), ("i16x8.ne", "makeBinary(s, BinaryOp::NeVecI16x8)"), ("i16x8.lt_s", "makeBinary(s, BinaryOp::LtSVecI16x8)"), ("i16x8.lt_u", "makeBinary(s, BinaryOp::LtUVecI16x8)"), - ("i16x8.gt_s", "makeBinary(s, BinaryOp::LeSVecI16x8)"), - ("i16x8.gt_u", "makeBinary(s, BinaryOp::LeUVecI16x8)"), - ("i16x8.le_s", "makeBinary(s, BinaryOp::GtSVecI16x8)"), - ("i16x8.le_u", "makeBinary(s, BinaryOp::GtUVecI16x8)"), + ("i16x8.gt_s", "makeBinary(s, BinaryOp::GtSVecI16x8)"), + ("i16x8.gt_u", "makeBinary(s, BinaryOp::GtUVecI16x8)"), + ("i16x8.le_s", "makeBinary(s, BinaryOp::LeSVecI16x8)"), + ("i16x8.le_u", "makeBinary(s, BinaryOp::LeUVecI16x8)"), ("i16x8.ge_s", "makeBinary(s, BinaryOp::GeSVecI16x8)"), ("i16x8.ge_u", "makeBinary(s, BinaryOp::GeUVecI16x8)"), ("i32x4.eq", "makeBinary(s, BinaryOp::EqVecI32x4)"), ("i32x4.ne", "makeBinary(s, BinaryOp::NeVecI32x4)"), ("i32x4.lt_s", "makeBinary(s, BinaryOp::LtSVecI32x4)"), ("i32x4.lt_u", "makeBinary(s, BinaryOp::LtUVecI32x4)"), - ("i32x4.gt_s", "makeBinary(s, BinaryOp::LeSVecI32x4)"), - ("i32x4.gt_u", "makeBinary(s, BinaryOp::LeUVecI32x4)"), - ("i32x4.le_s", "makeBinary(s, BinaryOp::GtSVecI32x4)"), - ("i32x4.le_u", "makeBinary(s, BinaryOp::GtUVecI32x4)"), + ("i32x4.gt_s", "makeBinary(s, BinaryOp::GtSVecI32x4)"), + ("i32x4.gt_u", "makeBinary(s, BinaryOp::GtUVecI32x4)"), + ("i32x4.le_s", "makeBinary(s, BinaryOp::LeSVecI32x4)"), + ("i32x4.le_u", "makeBinary(s, BinaryOp::LeUVecI32x4)"), ("i32x4.ge_s", "makeBinary(s, BinaryOp::GeSVecI32x4)"), ("i32x4.ge_u", "makeBinary(s, BinaryOp::GeUVecI32x4)"), ("f32x4.eq", "makeBinary(s, BinaryOp::EqVecF32x4)"), ("f32x4.ne", "makeBinary(s, BinaryOp::NeVecF32x4)"), ("f32x4.lt", "makeBinary(s, BinaryOp::LtVecF32x4)"), - ("f32x4.gt", "makeBinary(s, BinaryOp::LeVecF32x4)"), - ("f32x4.le", "makeBinary(s, BinaryOp::GtVecF32x4)"), + ("f32x4.gt", "makeBinary(s, BinaryOp::GtVecF32x4)"), + ("f32x4.le", "makeBinary(s, BinaryOp::LeVecF32x4)"), ("f32x4.ge", "makeBinary(s, BinaryOp::GeVecF32x4)"), ("f64x2.eq", "makeBinary(s, BinaryOp::EqVecF64x2)"), ("f64x2.ne", "makeBinary(s, BinaryOp::NeVecF64x2)"), ("f64x2.lt", "makeBinary(s, BinaryOp::LtVecF64x2)"), - ("f64x2.gt", "makeBinary(s, BinaryOp::LeVecF64x2)"), - ("f64x2.le", "makeBinary(s, BinaryOp::GtVecF64x2)"), + ("f64x2.gt", "makeBinary(s, BinaryOp::GtVecF64x2)"), + ("f64x2.le", "makeBinary(s, BinaryOp::LeVecF64x2)"), ("f64x2.ge", "makeBinary(s, BinaryOp::GeVecF64x2)"), ("v128.not", "makeUnary(s, UnaryOp::NotVec128)"), ("v128.and", "makeBinary(s, BinaryOp::AndVec128)"), diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index daa296d2520..77e505260d1 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -262,7 +262,7 @@ switch (op[0]) { if (strcmp(op, "f32x4.ge") == 0) return makeBinary(s, BinaryOp::GeVecF32x4); goto parse_error; case 't': - if (strcmp(op, "f32x4.gt") == 0) return makeBinary(s, BinaryOp::LeVecF32x4); + if (strcmp(op, "f32x4.gt") == 0) return makeBinary(s, BinaryOp::GtVecF32x4); goto parse_error; default: goto parse_error; } @@ -270,7 +270,7 @@ switch (op[0]) { case 'l': { switch (op[7]) { case 'e': - if (strcmp(op, "f32x4.le") == 0) return makeBinary(s, BinaryOp::GtVecF32x4); + if (strcmp(op, "f32x4.le") == 0) return makeBinary(s, BinaryOp::LeVecF32x4); goto parse_error; case 't': if (strcmp(op, "f32x4.lt") == 0) return makeBinary(s, BinaryOp::LtVecF32x4); @@ -524,7 +524,7 @@ switch (op[0]) { if (strcmp(op, "f64x2.ge") == 0) return makeBinary(s, BinaryOp::GeVecF64x2); goto parse_error; case 't': - if (strcmp(op, "f64x2.gt") == 0) return makeBinary(s, BinaryOp::LeVecF64x2); + if (strcmp(op, "f64x2.gt") == 0) return makeBinary(s, BinaryOp::GtVecF64x2); goto parse_error; default: goto parse_error; } @@ -532,7 +532,7 @@ switch (op[0]) { case 'l': { switch (op[7]) { case 'e': - if (strcmp(op, "f64x2.le") == 0) return makeBinary(s, BinaryOp::GtVecF64x2); + if (strcmp(op, "f64x2.le") == 0) return makeBinary(s, BinaryOp::LeVecF64x2); goto parse_error; case 't': if (strcmp(op, "f64x2.lt") == 0) return makeBinary(s, BinaryOp::LtVecF64x2); @@ -679,10 +679,10 @@ switch (op[0]) { case 't': { switch (op[9]) { case 's': - if (strcmp(op, "i16x8.gt_s") == 0) return makeBinary(s, BinaryOp::LeSVecI16x8); + if (strcmp(op, "i16x8.gt_s") == 0) return makeBinary(s, BinaryOp::GtSVecI16x8); goto parse_error; case 'u': - if (strcmp(op, "i16x8.gt_u") == 0) return makeBinary(s, BinaryOp::LeUVecI16x8); + if (strcmp(op, "i16x8.gt_u") == 0) return makeBinary(s, BinaryOp::GtUVecI16x8); goto parse_error; default: goto parse_error; } @@ -695,10 +695,10 @@ switch (op[0]) { case 'e': { switch (op[9]) { case 's': - if (strcmp(op, "i16x8.le_s") == 0) return makeBinary(s, BinaryOp::GtSVecI16x8); + if (strcmp(op, "i16x8.le_s") == 0) return makeBinary(s, BinaryOp::LeSVecI16x8); goto parse_error; case 'u': - if (strcmp(op, "i16x8.le_u") == 0) return makeBinary(s, BinaryOp::GtUVecI16x8); + if (strcmp(op, "i16x8.le_u") == 0) return makeBinary(s, BinaryOp::LeUVecI16x8); goto parse_error; default: goto parse_error; } @@ -1287,10 +1287,10 @@ switch (op[0]) { case 't': { switch (op[9]) { case 's': - if (strcmp(op, "i32x4.gt_s") == 0) return makeBinary(s, BinaryOp::LeSVecI32x4); + if (strcmp(op, "i32x4.gt_s") == 0) return makeBinary(s, BinaryOp::GtSVecI32x4); goto parse_error; case 'u': - if (strcmp(op, "i32x4.gt_u") == 0) return makeBinary(s, BinaryOp::LeUVecI32x4); + if (strcmp(op, "i32x4.gt_u") == 0) return makeBinary(s, BinaryOp::GtUVecI32x4); goto parse_error; default: goto parse_error; } @@ -1303,10 +1303,10 @@ switch (op[0]) { case 'e': { switch (op[9]) { case 's': - if (strcmp(op, "i32x4.le_s") == 0) return makeBinary(s, BinaryOp::GtSVecI32x4); + if (strcmp(op, "i32x4.le_s") == 0) return makeBinary(s, BinaryOp::LeSVecI32x4); goto parse_error; case 'u': - if (strcmp(op, "i32x4.le_u") == 0) return makeBinary(s, BinaryOp::GtUVecI32x4); + if (strcmp(op, "i32x4.le_u") == 0) return makeBinary(s, BinaryOp::LeUVecI32x4); goto parse_error; default: goto parse_error; } @@ -2051,10 +2051,10 @@ switch (op[0]) { case 't': { switch (op[9]) { case 's': - if (strcmp(op, "i8x16.gt_s") == 0) return makeBinary(s, BinaryOp::LeSVecI8x16); + if (strcmp(op, "i8x16.gt_s") == 0) return makeBinary(s, BinaryOp::GtSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i8x16.gt_u") == 0) return makeBinary(s, BinaryOp::LeUVecI8x16); + if (strcmp(op, "i8x16.gt_u") == 0) return makeBinary(s, BinaryOp::GtUVecI8x16); goto parse_error; default: goto parse_error; } @@ -2067,10 +2067,10 @@ switch (op[0]) { case 'e': { switch (op[9]) { case 's': - if (strcmp(op, "i8x16.le_s") == 0) return makeBinary(s, BinaryOp::GtSVecI8x16); + if (strcmp(op, "i8x16.le_s") == 0) return makeBinary(s, BinaryOp::LeSVecI8x16); goto parse_error; case 'u': - if (strcmp(op, "i8x16.le_u") == 0) return makeBinary(s, BinaryOp::GtUVecI8x16); + if (strcmp(op, "i8x16.le_u") == 0) return makeBinary(s, BinaryOp::LeUVecI8x16); goto parse_error; default: goto parse_error; } diff --git a/test/simd.wast.from-wast b/test/simd.wast.from-wast index e66bc493e9a..76ff5977ee5 100644 --- a/test/simd.wast.from-wast +++ b/test/simd.wast.from-wast @@ -161,25 +161,25 @@ ) ) (func $i8x16.gt_s (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_s + (i8x16.gt_s (get_local $0) (get_local $1) ) ) (func $i8x16.gt_u (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_u + (i8x16.gt_u (get_local $0) (get_local $1) ) ) (func $i8x16.le_s (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_s + (i8x16.le_s (get_local $0) (get_local $1) ) ) (func $i8x16.le_u (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_u + (i8x16.le_u (get_local $0) (get_local $1) ) @@ -221,25 +221,25 @@ ) ) (func $i16x8.gt_s (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_s + (i16x8.gt_s (get_local $0) (get_local $1) ) ) (func $i16x8.gt_u (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_u + (i16x8.gt_u (get_local $0) (get_local $1) ) ) (func $i16x8.le_s (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_s + (i16x8.le_s (get_local $0) (get_local $1) ) ) (func $i16x8.le_u (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_u + (i16x8.le_u (get_local $0) (get_local $1) ) @@ -281,25 +281,25 @@ ) ) (func $i32x4.gt_s (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_s + (i32x4.gt_s (get_local $0) (get_local $1) ) ) (func $i32x4.gt_u (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_u + (i32x4.gt_u (get_local $0) (get_local $1) ) ) (func $i32x4.le_s (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_s + (i32x4.le_s (get_local $0) (get_local $1) ) ) (func $i32x4.le_u (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_u + (i32x4.le_u (get_local $0) (get_local $1) ) @@ -335,13 +335,13 @@ ) ) (func $f32x4.gt (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.le + (f32x4.gt (get_local $0) (get_local $1) ) ) (func $f32x4.le (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.gt + (f32x4.le (get_local $0) (get_local $1) ) @@ -371,13 +371,13 @@ ) ) (func $f64x2.gt (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.le + (f64x2.gt (get_local $0) (get_local $1) ) ) (func $f64x2.le (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.gt + (f64x2.le (get_local $0) (get_local $1) ) diff --git a/test/simd.wast.fromBinary b/test/simd.wast.fromBinary index e3210a891bf..ed376651ec5 100644 --- a/test/simd.wast.fromBinary +++ b/test/simd.wast.fromBinary @@ -161,25 +161,25 @@ ) ) (func $i8x16.gt_s (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_s + (i8x16.le_s (get_local $0) (get_local $1) ) ) (func $i8x16.gt_u (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_u + (i8x16.le_u (get_local $0) (get_local $1) ) ) (func $i8x16.le_s (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_s + (i8x16.gt_s (get_local $0) (get_local $1) ) ) (func $i8x16.le_u (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_u + (i8x16.gt_u (get_local $0) (get_local $1) ) @@ -221,25 +221,25 @@ ) ) (func $i16x8.gt_s (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_s + (i16x8.le_s (get_local $0) (get_local $1) ) ) (func $i16x8.gt_u (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_u + (i16x8.le_u (get_local $0) (get_local $1) ) ) (func $i16x8.le_s (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_s + (i16x8.gt_s (get_local $0) (get_local $1) ) ) (func $i16x8.le_u (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_u + (i16x8.gt_u (get_local $0) (get_local $1) ) @@ -281,25 +281,25 @@ ) ) (func $i32x4.gt_s (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_s + (i32x4.le_s (get_local $0) (get_local $1) ) ) (func $i32x4.gt_u (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_u + (i32x4.le_u (get_local $0) (get_local $1) ) ) (func $i32x4.le_s (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_s + (i32x4.gt_s (get_local $0) (get_local $1) ) ) (func $i32x4.le_u (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_u + (i32x4.gt_u (get_local $0) (get_local $1) ) @@ -335,13 +335,13 @@ ) ) (func $f32x4.gt (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.gt + (f32x4.le (get_local $0) (get_local $1) ) ) (func $f32x4.le (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.le + (f32x4.gt (get_local $0) (get_local $1) ) @@ -371,13 +371,13 @@ ) ) (func $f64x2.gt (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.gt + (f64x2.le (get_local $0) (get_local $1) ) ) (func $f64x2.le (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.le + (f64x2.gt (get_local $0) (get_local $1) ) diff --git a/test/simd.wast.fromBinary.noDebugInfo b/test/simd.wast.fromBinary.noDebugInfo index e2d5c964770..7bad89e98c5 100644 --- a/test/simd.wast.fromBinary.noDebugInfo +++ b/test/simd.wast.fromBinary.noDebugInfo @@ -161,25 +161,25 @@ ) ) (func $27 (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_s + (i8x16.le_s (get_local $0) (get_local $1) ) ) (func $28 (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_u + (i8x16.le_u (get_local $0) (get_local $1) ) ) (func $29 (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_s + (i8x16.gt_s (get_local $0) (get_local $1) ) ) (func $30 (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_u + (i8x16.gt_u (get_local $0) (get_local $1) ) @@ -221,25 +221,25 @@ ) ) (func $37 (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_s + (i16x8.le_s (get_local $0) (get_local $1) ) ) (func $38 (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_u + (i16x8.le_u (get_local $0) (get_local $1) ) ) (func $39 (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_s + (i16x8.gt_s (get_local $0) (get_local $1) ) ) (func $40 (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_u + (i16x8.gt_u (get_local $0) (get_local $1) ) @@ -281,25 +281,25 @@ ) ) (func $47 (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_s + (i32x4.le_s (get_local $0) (get_local $1) ) ) (func $48 (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_u + (i32x4.le_u (get_local $0) (get_local $1) ) ) (func $49 (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_s + (i32x4.gt_s (get_local $0) (get_local $1) ) ) (func $50 (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_u + (i32x4.gt_u (get_local $0) (get_local $1) ) @@ -335,13 +335,13 @@ ) ) (func $56 (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.gt + (f32x4.le (get_local $0) (get_local $1) ) ) (func $57 (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.le + (f32x4.gt (get_local $0) (get_local $1) ) @@ -371,13 +371,13 @@ ) ) (func $62 (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.gt + (f64x2.le (get_local $0) (get_local $1) ) ) (func $63 (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.le + (f64x2.gt (get_local $0) (get_local $1) ) From f24ad1d9322c7e5b50be9af7055839faaff77679 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 15:16:20 -0800 Subject: [PATCH 13/36] UPDATE ME: add stuff to blacklisted memory.wast file --- test/spec/memory.wast | 51 ++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/test/spec/memory.wast b/test/spec/memory.wast index e54888f7c72..3bb849d03f4 100644 --- a/test/spec/memory.wast +++ b/test/spec/memory.wast @@ -92,6 +92,7 @@ (module (memory 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) (module (memory 0) (func (drop (i32.load align=4 (i32.const 0))))) (module (memory 0) (func (drop (f32.load align=4 (i32.const 0))))) +(module (memory 0) (func (drop (v128.load align=16 (i32.const 0))))) (assert_invalid (module (memory 0) (func (drop (i64.load align=0 (i32.const 0))))) @@ -113,7 +114,6 @@ (module (memory 0) (func (drop (i64.load align=7 (i32.const 0))))) "alignment must be a power of two" ) - (assert_invalid (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) "alignment must not be larger than natural" @@ -134,6 +134,10 @@ (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) "alignment must not be larger than natural" ) +(assert_invalid + (module (memory 0) (func (v128.load align=128 (i32.const 0)))) + "alignment must not be larget than natural" +) (assert_invalid (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) "alignment must not be larger than natural" @@ -150,32 +154,45 @@ (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) "alignment must not be larger than natural" ) +(assert_invalid + (module (memory 0) (func (v128.store align=128 (i32.const 0)))) + "alignment must not be larget than natural" +) (module (memory 1) (data (i32.const 0) "ABC\a7D") (data (i32.const 20) "WASM") + (data (i32.const 128) "WASMSIMDGOESFAST") ;; Data section (func (export "data") (result i32) (i32.and (i32.and (i32.and - (i32.eq (i32.load8_u (i32.const 0)) (i32.const 65)) - (i32.eq (i32.load8_u (i32.const 3)) (i32.const 167)) + (i32.and + (i32.eq (i32.load8_u (i32.const 0)) (i32.const 65)) + (i32.eq (i32.load8_u (i32.const 3)) (i32.const 167)) + ) + (i32.and + (i32.eq (i32.load8_u (i32.const 6)) (i32.const 0)) + (i32.eq (i32.load8_u (i32.const 19)) (i32.const 0)) + ) ) (i32.and - (i32.eq (i32.load8_u (i32.const 6)) (i32.const 0)) - (i32.eq (i32.load8_u (i32.const 19)) (i32.const 0)) + (i32.and + (i32.eq (i32.load8_u (i32.const 20)) (i32.const 87)) + (i32.eq (i32.load8_u (i32.const 23)) (i32.const 77)) + ) + (i32.and + (i32.eq (i32.load8_u (i32.const 24)) (i32.const 0)) + (i32.eq (i32.load8_u (i32.const 1023)) (i32.const 0)) + ) ) ) - (i32.and - (i32.and - (i32.eq (i32.load8_u (i32.const 20)) (i32.const 87)) - (i32.eq (i32.load8_u (i32.const 23)) (i32.const 77)) - ) - (i32.and - (i32.eq (i32.load8_u (i32.const 24)) (i32.const 0)) - (i32.eq (i32.load8_u (i32.const 1023)) (i32.const 0)) + (i8x16.all_true + (i8x16.eq + (v128.load (i32.const 128)) + (v128.const i32 87 65 83 77 83 73 77 68 71 79 69 83 70 65 83 84) ) ) ) @@ -285,6 +302,12 @@ (i64.store32 (i32.const 8) (get_local $i)) (i64.load32_u (i32.const 8)) ) + + ;; SIMD loads and stores + (func (export "v128_load") (param $v v128) (result v128) + (v128.store (i32.const 16) (get_local $v)) + (v128.load (i32.const 16)) + ) ) (assert_return (invoke "data") (i32.const 1)) @@ -315,3 +338,5 @@ (assert_return (invoke "i64_load16_u" (i64.const 40000)) (i64.const 40000)) (assert_return (invoke "i64_load32_s" (i64.const 20000)) (i64.const 20000)) (assert_return (invoke "i64_load32_u" (i64.const 40000)) (i64.const 40000)) + +(assert_return (invoke "v128_load" (v128.const i32 1 2 3 4)) (v128.const i32 1 2 3 4)) From bb947f74c0c57f97ca2bfc7c285a1a8a9fd71a17 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 15:36:45 -0800 Subject: [PATCH 14/36] Start spec tests, implement v128 load/store interpretation --- src/shell-interface.h | 6 ++ src/wasm-interpreter.h | 4 +- test/spec/simd.wast | 147 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 test/spec/simd.wast diff --git a/src/shell-interface.h b/src/shell-interface.h index 23f1c7de55e..fc6a5897ce4 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -183,11 +183,17 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { uint32_t load32u(Address addr) override { return memory.get(addr); } int64_t load64s(Address addr) override { return memory.get(addr); } uint64_t load64u(Address addr) override { return memory.get(addr); } + std::array load128(Address addr) override { + return memory.get>(addr); + } void store8(Address addr, int8_t value) override { memory.set(addr, value); } void store16(Address addr, int16_t value) override { memory.set(addr, value); } void store32(Address addr, int32_t value) override { memory.set(addr, value); } void store64(Address addr, int64_t value) override { memory.set(addr, value); } + void store128(Address addr, const std::array& value) override { + memory.set>(addr, value); + } void growMemory(Address /*oldSize*/, Address newSize) override { memory.resize(newSize); diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 8e962d3a3f2..ff047a8f1e8 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -780,7 +780,7 @@ class ModuleInstanceBase { } case f32: return Literal(load32u(addr)).castToF32(); case f64: return Literal(load64u(addr)).castToF64(); - case v128: assert(false && "v128 not implemented yet"); + case v128: return Literal(load128(addr).data()); case none: case unreachable: WASM_UNREACHABLE(); } @@ -824,11 +824,13 @@ class ModuleInstanceBase { virtual uint32_t load32u(Address addr) { WASM_UNREACHABLE(); } virtual int64_t load64s(Address addr) { WASM_UNREACHABLE(); } virtual uint64_t load64u(Address addr) { WASM_UNREACHABLE(); } + virtual std::array load128(Address addr) { WASM_UNREACHABLE(); } virtual void store8(Address addr, int8_t value) { WASM_UNREACHABLE(); } virtual void store16(Address addr, int16_t value) { WASM_UNREACHABLE(); } virtual void store32(Address addr, int32_t value) { WASM_UNREACHABLE(); } virtual void store64(Address addr, int64_t value) { WASM_UNREACHABLE(); } + virtual void store128(Address addr, const std::array&) { WASM_UNREACHABLE(); } }; SubType* self() { diff --git a/test/spec/simd.wast b/test/spec/simd.wast new file mode 100644 index 00000000000..98b2812eca1 --- /dev/null +++ b/test/spec/simd.wast @@ -0,0 +1,147 @@ +(module + (memory 1) + (data (i32.const 128) "WASMSIMDGOESFAST") + (func (export "v128.load") (param $0 i32) (result v128) + (v128.load (get_local $0)) + ) + (func (export "v128.store") (param $0 i32) (param $1 v128) (v128.store offset=0 align=16 (get_local $0) (get_local $1))) + (func (export "v128.const") (result v128) (v128.const i32 1 2 3 4)) + (func (export "v128.shuffle") (param $0 v128) (param $1 v128) (result v128) (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 (get_local $0) (get_local $1))) + (func (export "i8x16.splat") (param $0 i32) (result v128) (i8x16.splat (get_local $0))) + (func (export "i8x16.extract_lane_s") (param $0 v128) (result i32) (i8x16.extract_lane_s 0 (get_local $0))) + (func (export "i8x16.extract_lane_u") (param $0 v128) (result i32) (i8x16.extract_lane_u 0 (get_local $0))) + (func (export "i8x16.replace_lane") (param $0 v128) (param $1 i32) (result v128) (i8x16.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i16x8.splat") (param $0 i32) (result v128) (i16x8.splat (get_local $0))) + (func (export "i16x8.extract_lane_s") (param $0 v128) (result i32) (i16x8.extract_lane_s 0 (get_local $0))) + (func (export "i16x8.extract_lane_u") (param $0 v128) (result i32) (i16x8.extract_lane_u 0 (get_local $0))) + (func (export "i16x8.replace_lane") (param $0 v128) (param $1 i32) (result v128) (i16x8.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i32x4.splat") (param $0 i32) (result v128) (i32x4.splat (get_local $0))) + (func (export "i32x4.extract_lane") (param $0 v128) (result i32) (i32x4.extract_lane 0 (get_local $0))) + (func (export "i32x4.replace_lane") (param $0 v128) (param $1 i32) (result v128) (i32x4.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i64x2.extract_lane") (param $0 v128) (result i64) (i64x2.extract_lane 0 (get_local $0))) + (func (export "i64x2.replace_lane") (param $0 v128) (param $1 i64) (result v128) (i64x2.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "f32x4.splat") (param $0 f32) (result v128) (f32x4.splat (get_local $0))) + (func (export "f32x4.extract_lane") (param $0 v128) (result f32) (f32x4.extract_lane 0 (get_local $0))) + (func (export "f32x4.replace_lane") (param $0 v128) (param $1 f32) (result v128) (f32x4.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "f64x2.splat") (param $0 f64) (result v128) (f64x2.splat (get_local $0))) + (func (export "f64x2.extract_lane") (param $0 v128) (result f64) (f64x2.extract_lane 0 (get_local $0))) + (func (export "f64x2.replace_lane") (param $0 v128) (param $1 f64) (result v128) (f64x2.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i8x16.eq") (param $0 v128) (param $1 v128) (result v128) (i8x16.eq (get_local $0) (get_local $1))) + (func (export "i8x16.ne") (param $0 v128) (param $1 v128) (result v128) (i8x16.ne (get_local $0) (get_local $1))) + (func (export "i8x16.lt_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.lt_s (get_local $0) (get_local $1))) + (func (export "i8x16.lt_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.lt_u (get_local $0) (get_local $1))) + (func (export "i8x16.gt_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.gt_s (get_local $0) (get_local $1))) + (func (export "i8x16.gt_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.gt_u (get_local $0) (get_local $1))) + (func (export "i8x16.le_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.le_s (get_local $0) (get_local $1))) + (func (export "i8x16.le_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.le_u (get_local $0) (get_local $1))) + (func (export "i8x16.ge_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.ge_s (get_local $0) (get_local $1))) + (func (export "i8x16.ge_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.ge_u (get_local $0) (get_local $1))) + (func (export "i16x8.eq") (param $0 v128) (param $1 v128) (result v128) (i16x8.eq (get_local $0) (get_local $1))) + (func (export "i16x8.ne") (param $0 v128) (param $1 v128) (result v128) (i16x8.ne (get_local $0) (get_local $1))) + (func (export "i16x8.lt_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.lt_s (get_local $0) (get_local $1))) + (func (export "i16x8.lt_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.lt_u (get_local $0) (get_local $1))) + (func (export "i16x8.gt_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.gt_s (get_local $0) (get_local $1))) + (func (export "i16x8.gt_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.gt_u (get_local $0) (get_local $1))) + (func (export "i16x8.le_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.le_s (get_local $0) (get_local $1))) + (func (export "i16x8.le_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.le_u (get_local $0) (get_local $1))) + (func (export "i16x8.ge_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.ge_s (get_local $0) (get_local $1))) + (func (export "i16x8.ge_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.ge_u (get_local $0) (get_local $1))) + (func (export "i32x4.eq") (param $0 v128) (param $1 v128) (result v128) (i32x4.eq (get_local $0) (get_local $1))) + (func (export "i32x4.ne") (param $0 v128) (param $1 v128) (result v128) (i32x4.ne (get_local $0) (get_local $1))) + (func (export "i32x4.lt_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.lt_s (get_local $0) (get_local $1))) + (func (export "i32x4.lt_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.lt_u (get_local $0) (get_local $1))) + (func (export "i32x4.gt_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.gt_s (get_local $0) (get_local $1))) + (func (export "i32x4.gt_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.gt_u (get_local $0) (get_local $1))) + (func (export "i32x4.le_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.le_s (get_local $0) (get_local $1))) + (func (export "i32x4.le_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.le_u (get_local $0) (get_local $1))) + (func (export "i32x4.ge_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.ge_s (get_local $0) (get_local $1))) + (func (export "i32x4.ge_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.ge_u (get_local $0) (get_local $1))) + (func (export "f32x4.eq") (param $0 v128) (param $1 v128) (result v128) (f32x4.eq (get_local $0) (get_local $1))) + (func (export "f32x4.ne") (param $0 v128) (param $1 v128) (result v128) (f32x4.ne (get_local $0) (get_local $1))) + (func (export "f32x4.lt") (param $0 v128) (param $1 v128) (result v128) (f32x4.lt (get_local $0) (get_local $1))) + (func (export "f32x4.gt") (param $0 v128) (param $1 v128) (result v128) (f32x4.gt (get_local $0) (get_local $1))) + (func (export "f32x4.le") (param $0 v128) (param $1 v128) (result v128) (f32x4.le (get_local $0) (get_local $1))) + (func (export "f32x4.ge") (param $0 v128) (param $1 v128) (result v128) (f32x4.ge (get_local $0) (get_local $1))) + (func (export "f64x2.eq") (param $0 v128) (param $1 v128) (result v128) (f64x2.eq (get_local $0) (get_local $1))) + (func (export "f64x2.ne") (param $0 v128) (param $1 v128) (result v128) (f64x2.ne (get_local $0) (get_local $1))) + (func (export "f64x2.lt") (param $0 v128) (param $1 v128) (result v128) (f64x2.lt (get_local $0) (get_local $1))) + (func (export "f64x2.gt") (param $0 v128) (param $1 v128) (result v128) (f64x2.gt (get_local $0) (get_local $1))) + (func (export "f64x2.le") (param $0 v128) (param $1 v128) (result v128) (f64x2.le (get_local $0) (get_local $1))) + (func (export "f64x2.ge") (param $0 v128) (param $1 v128) (result v128) (f64x2.ge (get_local $0) (get_local $1))) + (func (export "v128.not") (param $0 v128) (result v128) (v128.not (get_local $0))) + (func (export "v128.and") (param $0 v128) (param $1 v128) (result v128) (v128.and (get_local $0) (get_local $1))) + (func (export "v128.or") (param $0 v128) (param $1 v128) (result v128) (v128.or (get_local $0) (get_local $1))) + (func (export "v128.xor") (param $0 v128) (param $1 v128) (result v128) (v128.xor (get_local $0) (get_local $1))) + (func (export "v128.bitselect") (param $0 v128) (param $1 v128) (param $2 v128) (result v128) (v128.bitselect (get_local $0) (get_local $1) (get_local $2))) + (func (export "i8x16.neg") (param $0 v128) (result v128) (i8x16.neg (get_local $0))) + (func (export "i8x16.any_true") (param $0 v128) (result i32) (i8x16.any_true (get_local $0))) + (func (export "i8x16.all_true") (param $0 v128) (result i32) (i8x16.all_true (get_local $0))) + (func (export "i8x16.shl") (param $0 v128) (param $1 i32) (result v128) (i8x16.shl (get_local $0) (get_local $1))) + (func (export "i8x16.shr_s") (param $0 v128) (param $1 i32) (result v128) (i8x16.shr_s (get_local $0) (get_local $1))) + (func (export "i8x16.shr_u") (param $0 v128) (param $1 i32) (result v128) (i8x16.shr_u (get_local $0) (get_local $1))) + (func (export "i8x16.add") (param $0 v128) (param $1 v128) (result v128) (i8x16.add (get_local $0) (get_local $1))) + (func (export "i8x16.add_saturate_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.add_saturate_s (get_local $0) (get_local $1))) + (func (export "i8x16.add_saturate_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.add_saturate_u (get_local $0) (get_local $1))) + (func (export "i8x16.sub") (param $0 v128) (param $1 v128) (result v128) (i8x16.sub (get_local $0) (get_local $1))) + (func (export "i8x16.sub_saturate_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.sub_saturate_s (get_local $0) (get_local $1))) + (func (export "i8x16.sub_saturate_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.sub_saturate_u (get_local $0) (get_local $1))) + (func (export "i8x16.mul") (param $0 v128) (param $1 v128) (result v128) (i8x16.mul (get_local $0) (get_local $1))) + (func (export "i16x8.neg") (param $0 v128) (result v128) (i16x8.neg (get_local $0))) + (func (export "i16x8.any_true") (param $0 v128) (result i32) (i16x8.any_true (get_local $0))) + (func (export "i16x8.all_true") (param $0 v128) (result i32) (i16x8.all_true (get_local $0))) + (func (export "i16x8.shl") (param $0 v128) (param $1 i32) (result v128) (i16x8.shl (get_local $0) (get_local $1))) + (func (export "i16x8.shr_s") (param $0 v128) (param $1 i32) (result v128) (i16x8.shr_s (get_local $0) (get_local $1))) + (func (export "i16x8.shr_u") (param $0 v128) (param $1 i32) (result v128) (i16x8.shr_u (get_local $0) (get_local $1))) + (func (export "i16x8.add") (param $0 v128) (param $1 v128) (result v128) (i16x8.add (get_local $0) (get_local $1))) + (func (export "i16x8.add_saturate_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.add_saturate_s (get_local $0) (get_local $1))) + (func (export "i16x8.add_saturate_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.add_saturate_u (get_local $0) (get_local $1))) + (func (export "i16x8.sub") (param $0 v128) (param $1 v128) (result v128) (i16x8.sub (get_local $0) (get_local $1))) + (func (export "i16x8.sub_saturate_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.sub_saturate_s (get_local $0) (get_local $1))) + (func (export "i16x8.sub_saturate_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.sub_saturate_u (get_local $0) (get_local $1))) + (func (export "i16x8.mul") (param $0 v128) (param $1 v128) (result v128) (i16x8.mul (get_local $0) (get_local $1))) + (func (export "i32x4.neg") (param $0 v128) (result v128) (i32x4.neg (get_local $0))) + (func (export "i32x4.any_true") (param $0 v128) (result i32) (i32x4.any_true (get_local $0))) + (func (export "i32x4.all_true") (param $0 v128) (result i32) (i32x4.all_true (get_local $0))) + (func (export "i32x4.shl") (param $0 v128) (param $1 i32) (result v128) (i32x4.shl (get_local $0) (get_local $1))) + (func (export "i32x4.shr_s") (param $0 v128) (param $1 i32) (result v128) (i32x4.shr_s (get_local $0) (get_local $1))) + (func (export "i32x4.shr_u") (param $0 v128) (param $1 i32) (result v128) (i32x4.shr_u (get_local $0) (get_local $1))) + (func (export "i32x4.add") (param $0 v128) (param $1 v128) (result v128) (i32x4.add (get_local $0) (get_local $1))) + (func (export "i32x4.sub") (param $0 v128) (param $1 v128) (result v128) (i32x4.sub (get_local $0) (get_local $1))) + (func (export "i32x4.mul") (param $0 v128) (param $1 v128) (result v128) (i32x4.mul (get_local $0) (get_local $1))) + (func (export "i64x2.neg") (param $0 v128) (result v128) (i64x2.neg (get_local $0))) + (func (export "i64x2.any_true") (param $0 v128) (result i32) (i64x2.any_true (get_local $0))) + (func (export "i64x2.all_true") (param $0 v128) (result i32) (i64x2.all_true (get_local $0))) + (func (export "i64x2.shl") (param $0 v128) (param $1 i32) (result v128) (i64x2.shl (get_local $0) (get_local $1))) + (func (export "i64x2.shr_s") (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_s (get_local $0) (get_local $1))) + (func (export "i64x2.shr_u") (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_u (get_local $0) (get_local $1))) + (func (export "i64x2.add") (param $0 v128) (param $1 v128) (result v128) (i64x2.add (get_local $0) (get_local $1))) + (func (export "i64x2.sub") (param $0 v128) (param $1 v128) (result v128) (i64x2.sub (get_local $0) (get_local $1))) + (func (export "f32x4.add") (param $0 v128) (param $1 v128) (result v128) (f32x4.add (get_local $0) (get_local $1))) + (func (export "f32x4.sub") (param $0 v128) (param $1 v128) (result v128) (f32x4.sub (get_local $0) (get_local $1))) + (func (export "f32x4.mul") (param $0 v128) (param $1 v128) (result v128) (f32x4.mul (get_local $0) (get_local $1))) + (func (export "f32x4.div") (param $0 v128) (param $1 v128) (result v128) (f32x4.div (get_local $0) (get_local $1))) + (func (export "f32x4.min") (param $0 v128) (param $1 v128) (result v128) (f32x4.min (get_local $0) (get_local $1))) + (func (export "f32x4.max") (param $0 v128) (param $1 v128) (result v128) (f32x4.max (get_local $0) (get_local $1))) + (func (export "f32x4.abs") (param $0 v128) (result v128) (f32x4.abs (get_local $0))) + (func (export "f32x4.neg") (param $0 v128) (result v128) (f32x4.neg (get_local $0))) + (func (export "f32x4.sqrt") (param $0 v128) (result v128) (f32x4.sqrt (get_local $0))) + (func (export "f64x2.add") (param $0 v128) (param $1 v128) (result v128) (f64x2.add (get_local $0) (get_local $1))) + (func (export "f64x2.sub") (param $0 v128) (param $1 v128) (result v128) (f64x2.sub (get_local $0) (get_local $1))) + (func (export "f64x2.mul") (param $0 v128) (param $1 v128) (result v128) (f64x2.mul (get_local $0) (get_local $1))) + (func (export "f64x2.div") (param $0 v128) (param $1 v128) (result v128) (f64x2.div (get_local $0) (get_local $1))) + (func (export "f64x2.min") (param $0 v128) (param $1 v128) (result v128) (f64x2.min (get_local $0) (get_local $1))) + (func (export "f64x2.max") (param $0 v128) (param $1 v128) (result v128) (f64x2.max (get_local $0) (get_local $1))) + (func (export "f64x2.abs") (param $0 v128) (result v128) (f64x2.abs (get_local $0))) + (func (export "f64x2.neg") (param $0 v128) (result v128) (f64x2.neg (get_local $0))) + (func (export "f64x2.sqrt") (param $0 v128) (result v128) (f64x2.sqrt (get_local $0))) + (func (export "i32x4.trunc_s/f32x4:sat") (param $0 v128) (result v128) (i32x4.trunc_s/f32x4:sat (get_local $0))) + (func (export "i32x4.trunc_u/f32x4:sat") (param $0 v128) (result v128) (i32x4.trunc_u/f32x4:sat (get_local $0))) + (func (export "i64x2.trunc_s/f64x2:sat") (param $0 v128) (result v128) (i64x2.trunc_s/f64x2:sat (get_local $0))) + (func (export "i64x2.trunc_u/f64x2:sat") (param $0 v128) (result v128) (i64x2.trunc_u/f64x2:sat (get_local $0))) + (func (export "f32x4.convert_s/i32x4") (param $0 v128) (result v128) (f32x4.convert_s/i32x4 (get_local $0))) + (func (export "f32x4.convert_u/i32x4") (param $0 v128) (result v128) (f32x4.convert_u/i32x4 (get_local $0))) + (func (export "f64x2.convert_s/i64x2") (param $0 v128) (result v128) (f64x2.convert_s/i64x2 (get_local $0))) + (func (export "f64x2.convert_u/i64x2") (param $0 v128) (result v128) (f64x2.convert_u/i64x2 (get_local $0))) +) + +(assert_return (invoke "v128.load" (i32.const 128)) (v128.const i32 87 65 83 77 83 73 77 68 71 79 69 83 70 65 83 84)) From 9de5ddd3b1f4c22b9b9086ae7ed4825a49a82ae0 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 4 Dec 2018 18:45:23 -0800 Subject: [PATCH 15/36] More tests and bug fixes --- src/wasm-interpreter.h | 2 +- src/wasm/literal.cpp | 12 +- test/spec/simd.wast | 691 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 634 insertions(+), 71 deletions(-) diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index ff047a8f1e8..e970a4f83d9 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -810,7 +810,7 @@ class ModuleInstanceBase { // 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 v128: store128(addr, value.getv128()); break; case none: case unreachable: WASM_UNREACHABLE(); } diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 992e6da172f..393414fb74a 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -890,7 +890,7 @@ static LaneArray getLanes(const Literal& val) { for (size_t lane_idx = 0; lane_idx < Lanes; ++lane_idx) { LaneT lane(0); for (size_t offset = 0; offset < lane_width; ++offset) { - lane |= bytes.at(lane_idx * lane_width + offset) << (8 * offset); + lane |= LaneT(bytes.at(lane_idx * lane_width + offset)) << LaneT(8 * offset); } lanes.at(lane_idx) = Literal(lane); } @@ -898,16 +898,16 @@ static LaneArray getLanes(const Literal& val) { } LaneArray<16> Literal::getLanesSI8x16() const { - return getLanes(*this); + return getLanes(*this); } LaneArray<16> Literal::getLanesUI8x16() const { - return getLanes(*this); + return getLanes(*this); } LaneArray<8> Literal::getLanesSI16x8() const { - return getLanes(*this); + return getLanes(*this); } LaneArray<8> Literal::getLanesUI16x8() const { - return getLanes(*this); + return getLanes(*this); } LaneArray<4> Literal::getLanesI32x4() const { return getLanes(*this); @@ -934,7 +934,7 @@ Literal Literal::shuffleV8x16(const Literal& other, const std::array Date: Wed, 5 Dec 2018 11:47:42 -0800 Subject: [PATCH 16/36] Finish comparison tests and make comparisons emit masks --- src/wasm/literal.cpp | 106 ++++--- test/spec/simd.wast | 645 ++++++++++++------------------------------- 2 files changed, 243 insertions(+), 508 deletions(-) diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 393414fb74a..4ff5dc88b91 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -1155,144 +1155,158 @@ Literal Literal::shrUI64x2(const Literal& other) const { return shift<2, &Literal::getLanesI64x2, &Literal::shrU>(*this, other); } - template (Literal::*IntoLanes)() const, - Literal (Literal::*BinaryOp)(const Literal&) const> -static Literal binary(const Literal& val, const Literal& other) { + Literal (Literal::*CompareOp)(const Literal&) const, + typename LaneT = int32_t> +static Literal compare(const Literal& val, const Literal& other) { LaneArray lanes = (val.*IntoLanes)(); LaneArray other_lanes = (other.*IntoLanes)(); for (size_t i = 0; i < Lanes; ++i) { - lanes[i] = (lanes[i].*BinaryOp)(other_lanes[i]); + lanes[i] = (lanes[i].*CompareOp)(other_lanes[i]) == Literal(int32_t(1)) + ? Literal(LaneT(-1)) + : Literal(LaneT(0)); } return Literal(lanes); } Literal Literal::eqI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesUI8x16, &Literal::eq>(*this, other); + return compare<16, &Literal::getLanesUI8x16, &Literal::eq>(*this, other); } Literal Literal::neI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesUI8x16, &Literal::ne>(*this, other); + return compare<16, &Literal::getLanesUI8x16, &Literal::ne>(*this, other); } Literal Literal::ltSI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesSI8x16, &Literal::ltS>(*this, other); + return compare<16, &Literal::getLanesSI8x16, &Literal::ltS>(*this, other); } Literal Literal::ltUI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesUI8x16, &Literal::ltU>(*this, other); + return compare<16, &Literal::getLanesUI8x16, &Literal::ltU>(*this, other); } Literal Literal::gtSI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesSI8x16, &Literal::gtS>(*this, other); + return compare<16, &Literal::getLanesSI8x16, &Literal::gtS>(*this, other); } Literal Literal::gtUI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesUI8x16, &Literal::gtU>(*this, other); + return compare<16, &Literal::getLanesUI8x16, &Literal::gtU>(*this, other); } Literal Literal::leSI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesSI8x16, &Literal::leS>(*this, other); + return compare<16, &Literal::getLanesSI8x16, &Literal::leS>(*this, other); } Literal Literal::leUI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesUI8x16, &Literal::leU>(*this, other); + return compare<16, &Literal::getLanesUI8x16, &Literal::leU>(*this, other); } Literal Literal::geSI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesSI8x16, &Literal::geS>(*this, other); + return compare<16, &Literal::getLanesSI8x16, &Literal::geS>(*this, other); } Literal Literal::geUI8x16(const Literal& other) const { - return binary<16, &Literal::getLanesUI8x16, &Literal::geU>(*this, other); + return compare<16, &Literal::getLanesUI8x16, &Literal::geU>(*this, other); } Literal Literal::eqI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesUI16x8, &Literal::eq>(*this, other); + return compare<8, &Literal::getLanesUI16x8, &Literal::eq>(*this, other); } Literal Literal::neI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesUI16x8, &Literal::ne>(*this, other); + return compare<8, &Literal::getLanesUI16x8, &Literal::ne>(*this, other); } Literal Literal::ltSI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesSI16x8, &Literal::ltS>(*this, other); + return compare<8, &Literal::getLanesSI16x8, &Literal::ltS>(*this, other); } Literal Literal::ltUI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesUI16x8, &Literal::ltU>(*this, other); + return compare<8, &Literal::getLanesUI16x8, &Literal::ltU>(*this, other); } Literal Literal::gtSI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesSI16x8, &Literal::gtS>(*this, other); + return compare<8, &Literal::getLanesSI16x8, &Literal::gtS>(*this, other); } Literal Literal::gtUI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesUI16x8, &Literal::gtU>(*this, other); + return compare<8, &Literal::getLanesUI16x8, &Literal::gtU>(*this, other); } Literal Literal::leSI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesSI16x8, &Literal::leS>(*this, other); + return compare<8, &Literal::getLanesSI16x8, &Literal::leS>(*this, other); } Literal Literal::leUI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesUI16x8, &Literal::leU>(*this, other); + return compare<8, &Literal::getLanesUI16x8, &Literal::leU>(*this, other); } Literal Literal::geSI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesSI16x8, &Literal::geS>(*this, other); + return compare<8, &Literal::getLanesSI16x8, &Literal::geS>(*this, other); } Literal Literal::geUI16x8(const Literal& other) const { - return binary<8, &Literal::getLanesUI16x8, &Literal::geU>(*this, other); + return compare<8, &Literal::getLanesUI16x8, &Literal::geU>(*this, other); } Literal Literal::eqI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::eq>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::eq>(*this, other); } Literal Literal::neI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::ne>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::ne>(*this, other); } Literal Literal::ltSI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::ltS>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::ltS>(*this, other); } Literal Literal::ltUI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::ltU>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::ltU>(*this, other); } Literal Literal::gtSI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::gtS>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::gtS>(*this, other); } Literal Literal::gtUI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::gtU>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::gtU>(*this, other); } Literal Literal::leSI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::leS>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::leS>(*this, other); } Literal Literal::leUI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::leU>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::leU>(*this, other); } Literal Literal::geSI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::geS>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::geS>(*this, other); } Literal Literal::geUI32x4(const Literal& other) const { - return binary<4, &Literal::getLanesI32x4, &Literal::geU>(*this, other); + return compare<4, &Literal::getLanesI32x4, &Literal::geU>(*this, other); } Literal Literal::eqF32x4(const Literal& other) const { - return binary<4, &Literal::getLanesF32x4, &Literal::eq>(*this, other); + return compare<4, &Literal::getLanesF32x4, &Literal::eq>(*this, other); } Literal Literal::neF32x4(const Literal& other) const { - return binary<4, &Literal::getLanesF32x4, &Literal::ne>(*this, other); + return compare<4, &Literal::getLanesF32x4, &Literal::ne>(*this, other); } Literal Literal::ltF32x4(const Literal& other) const { - return binary<4, &Literal::getLanesF32x4, &Literal::lt>(*this, other); + return compare<4, &Literal::getLanesF32x4, &Literal::lt>(*this, other); } Literal Literal::gtF32x4(const Literal& other) const { - return binary<4, &Literal::getLanesF32x4, &Literal::gt>(*this, other); + return compare<4, &Literal::getLanesF32x4, &Literal::gt>(*this, other); } Literal Literal::leF32x4(const Literal& other) const { - return binary<4, &Literal::getLanesF32x4, &Literal::le>(*this, other); + return compare<4, &Literal::getLanesF32x4, &Literal::le>(*this, other); } Literal Literal::geF32x4(const Literal& other) const { - return binary<4, &Literal::getLanesF32x4, &Literal::ge>(*this, other); + return compare<4, &Literal::getLanesF32x4, &Literal::ge>(*this, other); } Literal Literal::eqF64x2(const Literal& other) const { - return binary<2, &Literal::getLanesF64x2, &Literal::eq>(*this, other); + return compare<2, &Literal::getLanesF64x2, &Literal::eq, int64_t>(*this, other); } Literal Literal::neF64x2(const Literal& other) const { - return binary<2, &Literal::getLanesF64x2, &Literal::ne>(*this, other); + return compare<2, &Literal::getLanesF64x2, &Literal::ne, int64_t>(*this, other); } Literal Literal::ltF64x2(const Literal& other) const { - return binary<2, &Literal::getLanesF64x2, &Literal::lt>(*this, other); + return compare<2, &Literal::getLanesF64x2, &Literal::lt, int64_t>(*this, other); } Literal Literal::gtF64x2(const Literal& other) const { - return binary<2, &Literal::getLanesF64x2, &Literal::gt>(*this, other); + return compare<2, &Literal::getLanesF64x2, &Literal::gt, int64_t>(*this, other); } Literal Literal::leF64x2(const Literal& other) const { - return binary<2, &Literal::getLanesF64x2, &Literal::le>(*this, other); + return compare<2, &Literal::getLanesF64x2, &Literal::le, int64_t>(*this, other); } Literal Literal::geF64x2(const Literal& other) const { - return binary<2, &Literal::getLanesF64x2, &Literal::ge>(*this, other); + return compare<2, &Literal::getLanesF64x2, &Literal::ge, int64_t>(*this, other); +} + +template (Literal::*IntoLanes)() const, + Literal (Literal::*BinaryOp)(const Literal&) const> +static Literal binary(const Literal& val, const Literal& other) { + LaneArray lanes = (val.*IntoLanes)(); + LaneArray other_lanes = (other.*IntoLanes)(); + for (size_t i = 0; i < Lanes; ++i) { + lanes[i] = (lanes[i].*BinaryOp)(other_lanes[i]); + } + return Literal(lanes); } + Literal Literal::andV128(const Literal& other) const { return binary<4, &Literal::getLanesI32x4, &Literal::and_>(*this, other); } diff --git a/test/spec/simd.wast b/test/spec/simd.wast index 3a9c5656f2f..ad1fe56cdef 100644 --- a/test/spec/simd.wast +++ b/test/spec/simd.wast @@ -1,255 +1,101 @@ (module (memory 1) (data (i32.const 128) "WASMSIMDGOESFAST") - (func (export "v128.load") (param $0 i32) (result v128) - (v128.load (get_local $0)) - ) + (func (export "v128.load") (param $0 i32) (result v128)(v128.load (get_local $0))) (func (export "v128.store") (param $0 i32) (param $1 v128) (result v128) (v128.store offset=0 align=16 (get_local $0) (get_local $1)) (v128.load (get_local $0)) ) - (func (export "v128.const") (result v128) - (v128.const i32 1 2 3 4) - ) + (func (export "v128.const") (result v128) (v128.const i32 1 2 3 4)) (func (export "v128.shuffle_interleave_bytes") (param $0 v128) (param $1 v128) (result v128) (v8x16.shuffle 0 17 2 19 4 21 6 23 8 25 10 27 12 29 14 31 (get_local $0) (get_local $1)) ) (func (export "v128.shuffle_reverse_i32s") (param $0 v128) (result v128) (v8x16.shuffle 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3 (get_local $0) (get_local $0)) ) - (func (export "i8x16.splat") (param $0 i32) (result v128) - (i8x16.splat (get_local $0)) - ) - (func (export "i8x16.extract_lane_s_first") (param $0 v128) (result i32) - (i8x16.extract_lane_s 0 (get_local $0)) - ) - (func (export "i8x16.extract_lane_s_last") (param $0 v128) (result i32) - (i8x16.extract_lane_s 15 (get_local $0)) - ) - (func (export "i8x16.extract_lane_u_first") (param $0 v128) (result i32) - (i8x16.extract_lane_u 0 (get_local $0)) - ) - (func (export "i8x16.extract_lane_u_last") (param $0 v128) (result i32) - (i8x16.extract_lane_u 15 (get_local $0)) - ) - (func (export "i8x16.replace_lane_first") (param $0 v128) (param $1 i32) (result v128) - (i8x16.replace_lane 0 (get_local $0) (get_local $1)) - ) - (func (export "i8x16.replace_lane_last") (param $0 v128) (param $1 i32) (result v128) - (i8x16.replace_lane 15 (get_local $0) (get_local $1)) - ) - (func (export "i16x8.splat") (param $0 i32) (result v128) - (i16x8.splat (get_local $0)) - ) - (func (export "i16x8.extract_lane_s_first") (param $0 v128) (result i32) - (i16x8.extract_lane_s 0 (get_local $0)) - ) - (func (export "i16x8.extract_lane_s_last") (param $0 v128) (result i32) - (i16x8.extract_lane_s 7 (get_local $0)) - ) - (func (export "i16x8.extract_lane_u_first") (param $0 v128) (result i32) - (i16x8.extract_lane_u 0 (get_local $0)) - ) - (func (export "i16x8.extract_lane_u_last") (param $0 v128) (result i32) - (i16x8.extract_lane_u 7 (get_local $0)) - ) - (func (export "i16x8.replace_lane_first") (param $0 v128) (param $1 i32) (result v128) - (i16x8.replace_lane 0 (get_local $0) (get_local $1)) - ) - (func (export "i16x8.replace_lane_last") (param $0 v128) (param $1 i32) (result v128) - (i16x8.replace_lane 7 (get_local $0) (get_local $1)) - ) - (func (export "i32x4.splat") (param $0 i32) (result v128) - (i32x4.splat (get_local $0)) - ) - (func (export "i32x4.extract_lane_first") (param $0 v128) (result i32) - (i32x4.extract_lane 0 (get_local $0)) - ) - (func (export "i32x4.extract_lane_last") (param $0 v128) (result i32) - (i32x4.extract_lane 3 (get_local $0)) - ) - (func (export "i32x4.replace_lane_first") (param $0 v128) (param $1 i32) - (result v128) (i32x4.replace_lane 0 (get_local $0) (get_local $1)) - ) - (func (export "i32x4.replace_lane_last") (param $0 v128) (param $1 i32) - (result v128) (i32x4.replace_lane 3 (get_local $0) (get_local $1)) - ) - (func (export "i64x2.splat") (param $0 i64) (result v128) - (i64x2.splat (get_local $0)) - ) - (func (export "i64x2.extract_lane_first") (param $0 v128) (result i64) - (i64x2.extract_lane 0 (get_local $0)) - ) - (func (export "i64x2.extract_lane_last") (param $0 v128) (result i64) - (i64x2.extract_lane 1 (get_local $0)) - ) - (func (export "i64x2.replace_lane_first") (param $0 v128) (param $1 i64) (result v128) - (i64x2.replace_lane 0 (get_local $0) (get_local $1)) - ) - (func (export "i64x2.replace_lane_last") (param $0 v128) (param $1 i64) (result v128) - (i64x2.replace_lane 1 (get_local $0) (get_local $1)) - ) - (func (export "f32x4.splat") (param $0 f32) (result v128) - (f32x4.splat (get_local $0)) - ) - (func (export "f32x4.extract_lane_first") (param $0 v128) (result f32) - (f32x4.extract_lane 0 (get_local $0)) - ) - (func (export "f32x4.extract_lane_last") (param $0 v128) (result f32) - (f32x4.extract_lane 3 (get_local $0)) - ) - (func (export "f32x4.replace_lane_first") (param $0 v128) (param $1 f32) (result v128) - (f32x4.replace_lane 0 (get_local $0) (get_local $1)) - ) - (func (export "f32x4.replace_lane_last") (param $0 v128) (param $1 f32) (result v128) - (f32x4.replace_lane 3 (get_local $0) (get_local $1)) - ) - (func (export "f64x2.splat") (param $0 f64) (result v128) - (f64x2.splat (get_local $0)) - ) - (func (export "f64x2.extract_lane_first") (param $0 v128) (result f64) - (f64x2.extract_lane 0 (get_local $0)) - ) - (func (export "f64x2.extract_lane_last") (param $0 v128) (result f64) - (f64x2.extract_lane 1 (get_local $0)) - ) - (func (export "f64x2.replace_lane_first") (param $0 v128) (param $1 f64) (result v128) - (f64x2.replace_lane 0 (get_local $0) (get_local $1)) - ) - (func (export "f64x2.replace_lane_last") (param $0 v128) (param $1 f64) (result v128) - (f64x2.replace_lane 1 (get_local $0) (get_local $1)) - ) - (func (export "i8x16.eq") (param $0 v128) (param $1 v128) (result v128) - (i8x16.eq (get_local $0) (get_local $1)) - ) - (func (export "i8x16.ne") (param $0 v128) (param $1 v128) (result v128) - (i8x16.ne (get_local $0) (get_local $1)) - ) - (func (export "i8x16.lt_s") (param $0 v128) (param $1 v128) (result v128) - (i8x16.lt_s (get_local $0) (get_local $1)) - ) - (func (export "i8x16.lt_u") (param $0 v128) (param $1 v128) (result v128) - (i8x16.lt_u (get_local $0) (get_local $1)) - ) - (func (export "i8x16.gt_s") (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_s (get_local $0) (get_local $1)) - ) - (func (export "i8x16.gt_u") (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_u (get_local $0) (get_local $1)) - ) - (func (export "i8x16.le_s") (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_s (get_local $0) (get_local $1)) - ) - (func (export "i8x16.le_u") (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_u (get_local $0) (get_local $1)) - ) - (func (export "i8x16.ge_s") (param $0 v128) (param $1 v128) (result v128) - (i8x16.ge_s (get_local $0) (get_local $1)) - ) - (func (export "i8x16.ge_u") (param $0 v128) (param $1 v128) (result v128) - (i8x16.ge_u (get_local $0) (get_local $1)) - ) - (func (export "i16x8.eq") (param $0 v128) (param $1 v128) (result v128) - (i16x8.eq (get_local $0) (get_local $1)) - ) - (func (export "i16x8.ne") (param $0 v128) (param $1 v128) (result v128) - (i16x8.ne (get_local $0) (get_local $1)) - ) - (func (export "i16x8.lt_s") (param $0 v128) (param $1 v128) (result v128) - (i16x8.lt_s (get_local $0) (get_local $1)) - ) - (func (export "i16x8.lt_u") (param $0 v128) (param $1 v128) (result v128) - (i16x8.lt_u (get_local $0) (get_local $1)) - ) - (func (export "i16x8.gt_s") (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_s (get_local $0) (get_local $1)) - ) - (func (export "i16x8.gt_u") (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_u (get_local $0) (get_local $1)) - ) - (func (export "i16x8.le_s") (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_s (get_local $0) (get_local $1)) - ) - (func (export "i16x8.le_u") (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_u (get_local $0) (get_local $1)) - ) - (func (export "i16x8.ge_s") (param $0 v128) (param $1 v128) (result v128) - (i16x8.ge_s (get_local $0) (get_local $1)) - ) - (func (export "i16x8.ge_u") (param $0 v128) (param $1 v128) (result v128) - (i16x8.ge_u (get_local $0) (get_local $1)) - ) - (func (export "i32x4.eq") (param $0 v128) (param $1 v128) (result v128) - (i32x4.eq (get_local $0) (get_local $1)) - ) - (func (export "i32x4.ne") (param $0 v128) (param $1 v128) (result v128) - (i32x4.ne (get_local $0) (get_local $1)) - ) - (func (export "i32x4.lt_s") (param $0 v128) (param $1 v128) (result v128) - (i32x4.lt_s (get_local $0) (get_local $1)) - ) - (func (export "i32x4.lt_u") (param $0 v128) (param $1 v128) (result v128) - (i32x4.lt_u (get_local $0) (get_local $1)) - ) - (func (export "i32x4.gt_s") (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_s (get_local $0) (get_local $1)) - ) - (func (export "i32x4.gt_u") (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_u (get_local $0) (get_local $1)) - ) - (func (export "i32x4.le_s") (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_s (get_local $0) (get_local $1)) - ) - (func (export "i32x4.le_u") (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_u (get_local $0) (get_local $1)) - ) - (func (export "i32x4.ge_s") (param $0 v128) (param $1 v128) (result v128) - (i32x4.ge_s (get_local $0) (get_local $1)) - ) - (func (export "i32x4.ge_u") (param $0 v128) (param $1 v128) (result v128) - (i32x4.ge_u (get_local $0) (get_local $1)) - ) - (func (export "f32x4.eq") (param $0 v128) (param $1 v128) (result v128) - (f32x4.eq (get_local $0) (get_local $1)) - ) - (func (export "f32x4.ne") (param $0 v128) (param $1 v128) (result v128) - (f32x4.ne (get_local $0) (get_local $1)) - ) - (func (export "f32x4.lt") (param $0 v128) (param $1 v128) (result v128) - (f32x4.lt (get_local $0) (get_local $1)) - ) - (func (export "f32x4.gt") (param $0 v128) (param $1 v128) (result v128) - (f32x4.gt (get_local $0) (get_local $1)) - ) - (func (export "f32x4.le") (param $0 v128) (param $1 v128) (result v128) - (f32x4.le (get_local $0) (get_local $1)) - ) - (func (export "f32x4.ge") (param $0 v128) (param $1 v128) (result v128) - (f32x4.ge (get_local $0) (get_local $1)) - ) - (func (export "f64x2.eq") (param $0 v128) (param $1 v128) (result v128) - (f64x2.eq (get_local $0) (get_local $1)) - ) - (func (export "f64x2.ne") (param $0 v128) (param $1 v128) (result v128) - (f64x2.ne (get_local $0) (get_local $1)) - ) - (func (export "f64x2.lt") (param $0 v128) (param $1 v128) (result v128) - (f64x2.lt (get_local $0) (get_local $1)) - ) - (func (export "f64x2.gt") (param $0 v128) (param $1 v128) (result v128) - (f64x2.gt (get_local $0) (get_local $1)) - ) - (func (export "f64x2.le") (param $0 v128) (param $1 v128) (result v128) - (f64x2.le (get_local $0) (get_local $1)) - ) - (func (export "f64x2.ge") (param $0 v128) (param $1 v128) (result v128) - (f64x2.ge (get_local $0) (get_local $1)) - ) + (func (export "i8x16.splat") (param $0 i32) (result v128) (i8x16.splat (get_local $0))) + (func (export "i8x16.extract_lane_s_first") (param $0 v128) (result i32) (i8x16.extract_lane_s 0 (get_local $0))) + (func (export "i8x16.extract_lane_s_last") (param $0 v128) (result i32) (i8x16.extract_lane_s 15 (get_local $0))) + (func (export "i8x16.extract_lane_u_first") (param $0 v128) (result i32) (i8x16.extract_lane_u 0 (get_local $0))) + (func (export "i8x16.extract_lane_u_last") (param $0 v128) (result i32) (i8x16.extract_lane_u 15 (get_local $0))) + (func (export "i8x16.replace_lane_first") (param $0 v128) (param $1 i32) (result v128) (i8x16.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i8x16.replace_lane_last") (param $0 v128) (param $1 i32) (result v128) (i8x16.replace_lane 15 (get_local $0) (get_local $1))) + (func (export "i16x8.splat") (param $0 i32) (result v128) (i16x8.splat (get_local $0))) + (func (export "i16x8.extract_lane_s_first") (param $0 v128) (result i32) (i16x8.extract_lane_s 0 (get_local $0))) + (func (export "i16x8.extract_lane_s_last") (param $0 v128) (result i32) (i16x8.extract_lane_s 7 (get_local $0))) + (func (export "i16x8.extract_lane_u_first") (param $0 v128) (result i32) (i16x8.extract_lane_u 0 (get_local $0))) + (func (export "i16x8.extract_lane_u_last") (param $0 v128) (result i32) (i16x8.extract_lane_u 7 (get_local $0))) + (func (export "i16x8.replace_lane_first") (param $0 v128) (param $1 i32) (result v128) (i16x8.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i16x8.replace_lane_last") (param $0 v128) (param $1 i32) (result v128) (i16x8.replace_lane 7 (get_local $0) (get_local $1))) + (func (export "i32x4.splat") (param $0 i32) (result v128) (i32x4.splat (get_local $0))) + (func (export "i32x4.extract_lane_first") (param $0 v128) (result i32) (i32x4.extract_lane 0 (get_local $0))) + (func (export "i32x4.extract_lane_last") (param $0 v128) (result i32) (i32x4.extract_lane 3 (get_local $0))) + (func (export "i32x4.replace_lane_first") (param $0 v128) (param $1 i32) (result v128) (i32x4.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i32x4.replace_lane_last") (param $0 v128) (param $1 i32) (result v128) (i32x4.replace_lane 3 (get_local $0) (get_local $1))) + (func (export "i64x2.splat") (param $0 i64) (result v128) (i64x2.splat (get_local $0))) + (func (export "i64x2.extract_lane_first") (param $0 v128) (result i64) (i64x2.extract_lane 0 (get_local $0))) + (func (export "i64x2.extract_lane_last") (param $0 v128) (result i64) (i64x2.extract_lane 1 (get_local $0))) + (func (export "i64x2.replace_lane_first") (param $0 v128) (param $1 i64) (result v128) (i64x2.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "i64x2.replace_lane_last") (param $0 v128) (param $1 i64) (result v128) (i64x2.replace_lane 1 (get_local $0) (get_local $1))) + (func (export "f32x4.splat") (param $0 f32) (result v128) (f32x4.splat (get_local $0))) + (func (export "f32x4.extract_lane_first") (param $0 v128) (result f32) (f32x4.extract_lane 0 (get_local $0))) + (func (export "f32x4.extract_lane_last") (param $0 v128) (result f32) (f32x4.extract_lane 3 (get_local $0))) + (func (export "f32x4.replace_lane_first") (param $0 v128) (param $1 f32) (result v128) (f32x4.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "f32x4.replace_lane_last") (param $0 v128) (param $1 f32) (result v128) (f32x4.replace_lane 3 (get_local $0) (get_local $1))) + (func (export "f64x2.splat") (param $0 f64) (result v128) (f64x2.splat (get_local $0))) + (func (export "f64x2.extract_lane_first") (param $0 v128) (result f64) (f64x2.extract_lane 0 (get_local $0))) + (func (export "f64x2.extract_lane_last") (param $0 v128) (result f64) (f64x2.extract_lane 1 (get_local $0))) + (func (export "f64x2.replace_lane_first") (param $0 v128) (param $1 f64) (result v128) (f64x2.replace_lane 0 (get_local $0) (get_local $1))) + (func (export "f64x2.replace_lane_last") (param $0 v128) (param $1 f64) (result v128) (f64x2.replace_lane 1 (get_local $0) (get_local $1))) + (func (export "i8x16.eq") (param $0 v128) (param $1 v128) (result v128) (i8x16.eq (get_local $0) (get_local $1))) + (func (export "i8x16.ne") (param $0 v128) (param $1 v128) (result v128) (i8x16.ne (get_local $0) (get_local $1))) + (func (export "i8x16.lt_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.lt_s (get_local $0) (get_local $1))) + (func (export "i8x16.lt_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.lt_u (get_local $0) (get_local $1))) + (func (export "i8x16.gt_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.gt_s (get_local $0) (get_local $1))) + (func (export "i8x16.gt_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.gt_u (get_local $0) (get_local $1))) + (func (export "i8x16.le_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.le_s (get_local $0) (get_local $1))) + (func (export "i8x16.le_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.le_u (get_local $0) (get_local $1))) + (func (export "i8x16.ge_s") (param $0 v128) (param $1 v128) (result v128) (i8x16.ge_s (get_local $0) (get_local $1))) + (func (export "i8x16.ge_u") (param $0 v128) (param $1 v128) (result v128) (i8x16.ge_u (get_local $0) (get_local $1))) + (func (export "i16x8.eq") (param $0 v128) (param $1 v128) (result v128) (i16x8.eq (get_local $0) (get_local $1))) + (func (export "i16x8.ne") (param $0 v128) (param $1 v128) (result v128) (i16x8.ne (get_local $0) (get_local $1))) + (func (export "i16x8.lt_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.lt_s (get_local $0) (get_local $1))) + (func (export "i16x8.lt_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.lt_u (get_local $0) (get_local $1))) + (func (export "i16x8.gt_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.gt_s (get_local $0) (get_local $1))) + (func (export "i16x8.gt_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.gt_u (get_local $0) (get_local $1))) + (func (export "i16x8.le_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.le_s (get_local $0) (get_local $1))) + (func (export "i16x8.le_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.le_u (get_local $0) (get_local $1))) + (func (export "i16x8.ge_s") (param $0 v128) (param $1 v128) (result v128) (i16x8.ge_s (get_local $0) (get_local $1))) + (func (export "i16x8.ge_u") (param $0 v128) (param $1 v128) (result v128) (i16x8.ge_u (get_local $0) (get_local $1))) + (func (export "i32x4.eq") (param $0 v128) (param $1 v128) (result v128) (i32x4.eq (get_local $0) (get_local $1))) + (func (export "i32x4.ne") (param $0 v128) (param $1 v128) (result v128) (i32x4.ne (get_local $0) (get_local $1))) + (func (export "i32x4.lt_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.lt_s (get_local $0) (get_local $1))) + (func (export "i32x4.lt_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.lt_u (get_local $0) (get_local $1))) + (func (export "i32x4.gt_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.gt_s (get_local $0) (get_local $1))) + (func (export "i32x4.gt_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.gt_u (get_local $0) (get_local $1))) + (func (export "i32x4.le_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.le_s (get_local $0) (get_local $1))) + (func (export "i32x4.le_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.le_u (get_local $0) (get_local $1))) + (func (export "i32x4.ge_s") (param $0 v128) (param $1 v128) (result v128) (i32x4.ge_s (get_local $0) (get_local $1))) + (func (export "i32x4.ge_u") (param $0 v128) (param $1 v128) (result v128) (i32x4.ge_u (get_local $0) (get_local $1))) + (func (export "f32x4.eq") (param $0 v128) (param $1 v128) (result v128) (f32x4.eq (get_local $0) (get_local $1))) + (func (export "f32x4.ne") (param $0 v128) (param $1 v128) (result v128) (f32x4.ne (get_local $0) (get_local $1))) + (func (export "f32x4.lt") (param $0 v128) (param $1 v128) (result v128) (f32x4.lt (get_local $0) (get_local $1))) + (func (export "f32x4.gt") (param $0 v128) (param $1 v128) (result v128) (f32x4.gt (get_local $0) (get_local $1))) + (func (export "f32x4.le") (param $0 v128) (param $1 v128) (result v128) (f32x4.le (get_local $0) (get_local $1))) + (func (export "f32x4.ge") (param $0 v128) (param $1 v128) (result v128) (f32x4.ge (get_local $0) (get_local $1))) + (func (export "f64x2.eq") (param $0 v128) (param $1 v128) (result v128) (f64x2.eq (get_local $0) (get_local $1))) + (func (export "f64x2.ne") (param $0 v128) (param $1 v128) (result v128) (f64x2.ne (get_local $0) (get_local $1))) + (func (export "f64x2.lt") (param $0 v128) (param $1 v128) (result v128) (f64x2.lt (get_local $0) (get_local $1))) + (func (export "f64x2.gt") (param $0 v128) (param $1 v128) (result v128) (f64x2.gt (get_local $0) (get_local $1))) + (func (export "f64x2.le") (param $0 v128) (param $1 v128) (result v128) (f64x2.le (get_local $0) (get_local $1))) + (func (export "f64x2.ge") (param $0 v128) (param $1 v128) (result v128) (f64x2.ge (get_local $0) (get_local $1))) (func (export "v128.not") (param $0 v128) (result v128) (v128.not (get_local $0))) (func (export "v128.and") (param $0 v128) (param $1 v128) (result v128) (v128.and (get_local $0) (get_local $1))) (func (export "v128.or") (param $0 v128) (param $1 v128) (result v128) (v128.or (get_local $0) (get_local $1))) (func (export "v128.xor") (param $0 v128) (param $1 v128) (result v128) (v128.xor (get_local $0) (get_local $1))) - (func (export "v128.bitselect") (param $0 v128) (param $1 v128) (param $2 v128) (result v128) (v128.bitselect (get_local $0) (get_local $1) (get_local $2))) + (func (export "v128.bitselect") (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (v128.bitselect (get_local $0) (get_local $1) (get_local $2)) + ) (func (export "i8x16.neg") (param $0 v128) (result v128) (i8x16.neg (get_local $0))) (func (export "i8x16.any_true") (param $0 v128) (result i32) (i8x16.any_true (get_local $0))) (func (export "i8x16.all_true") (param $0 v128) (result i32) (i8x16.all_true (get_local $0))) @@ -337,134 +183,50 @@ ;; i8x16 lane accesses (assert_return (invoke "i8x16.splat" (i32.const 5)) (v128.const i32 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5)) (assert_return (invoke "i8x16.splat" (i32.const 257)) (v128.const i32 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)) -(assert_return - (invoke "i8x16.extract_lane_s_first" (v128.const i32 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) - (i32.const -1) -) -(assert_return - (invoke "i8x16.extract_lane_s_last" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255)) - (i32.const -1) -) -(assert_return - (invoke "i8x16.extract_lane_u_first" (v128.const i32 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) - (i32.const 255) -) -(assert_return - (invoke "i8x16.extract_lane_u_last" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255)) - (i32.const 255) -) -(assert_return - (invoke "i8x16.replace_lane_first" (v128.const i64 0 0) (i32.const 7)) - (v128.const i32 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) -) -(assert_return - (invoke "i8x16.replace_lane_last" (v128.const i64 0 0) (i32.const 7)) - (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7) -) +(assert_return (invoke "i8x16.extract_lane_s_first" (v128.const i32 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const -1)) +(assert_return (invoke "i8x16.extract_lane_s_last" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255)) (i32.const -1)) +(assert_return (invoke "i8x16.extract_lane_u_first" (v128.const i32 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 255)) +(assert_return (invoke "i8x16.extract_lane_u_last" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255)) (i32.const 255)) +(assert_return (invoke "i8x16.replace_lane_first" (v128.const i64 0 0) (i32.const 7)) (v128.const i32 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) +(assert_return (invoke "i8x16.replace_lane_last" (v128.const i64 0 0) (i32.const 7)) (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7)) ;; i16x8 lane accesses (assert_return (invoke "i16x8.splat" (i32.const 5)) (v128.const i32 5 5 5 5 5 5 5 5)) (assert_return (invoke "i16x8.splat" (i32.const 65537)) (v128.const i32 1 1 1 1 1 1 1 1)) -(assert_return - (invoke "i16x8.extract_lane_s_first" (v128.const i32 65535 0 0 0 0 0 0 0)) - (i32.const -1) -) -(assert_return - (invoke "i16x8.extract_lane_s_last" (v128.const i32 0 0 0 0 0 0 0 65535)) - (i32.const -1) -) -(assert_return - (invoke "i16x8.extract_lane_u_first" (v128.const i32 65535 0 0 0 0 0 0 0)) - (i32.const 65535) -) -(assert_return - (invoke "i16x8.extract_lane_u_last" (v128.const i32 0 0 0 0 0 0 0 65535)) - (i32.const 65535) -) -(assert_return - (invoke "i16x8.replace_lane_first" (v128.const i64 0 0) (i32.const 7)) - (v128.const i32 7 0 0 0 0 0 0 0) -) -(assert_return - (invoke "i16x8.replace_lane_last" (v128.const i64 0 0) (i32.const 7)) - (v128.const i32 0 0 0 0 0 0 0 7) -) +(assert_return (invoke "i16x8.extract_lane_s_first" (v128.const i32 65535 0 0 0 0 0 0 0)) (i32.const -1)) +(assert_return (invoke "i16x8.extract_lane_s_last" (v128.const i32 0 0 0 0 0 0 0 65535)) (i32.const -1)) +(assert_return (invoke "i16x8.extract_lane_u_first" (v128.const i32 65535 0 0 0 0 0 0 0)) (i32.const 65535)) +(assert_return (invoke "i16x8.extract_lane_u_last" (v128.const i32 0 0 0 0 0 0 0 65535)) (i32.const 65535)) +(assert_return (invoke "i16x8.replace_lane_first" (v128.const i64 0 0) (i32.const 7)) (v128.const i32 7 0 0 0 0 0 0 0)) +(assert_return (invoke "i16x8.replace_lane_last" (v128.const i64 0 0) (i32.const 7)) (v128.const i32 0 0 0 0 0 0 0 7)) ;; i32x4 lane accesses (assert_return (invoke "i32x4.splat" (i32.const -5)) (v128.const i32 -5 -5 -5 -5)) -(assert_return - (invoke "i32x4.extract_lane_first" (v128.const i32 -5 0 0 0)) - (i32.const -5) -) -(assert_return - (invoke "i32x4.extract_lane_last" (v128.const i32 0 0 0 -5)) - (i32.const -5) -) -(assert_return - (invoke "i32x4.replace_lane_first" (v128.const i64 0 0) (i32.const 53)) - (v128.const i32 53 0 0 0) -) -(assert_return - (invoke "i32x4.replace_lane_last" (v128.const i64 0 0) (i32.const 53)) - (v128.const i32 0 0 0 53) -) +(assert_return (invoke "i32x4.extract_lane_first" (v128.const i32 -5 0 0 0)) (i32.const -5)) +(assert_return (invoke "i32x4.extract_lane_last" (v128.const i32 0 0 0 -5)) (i32.const -5)) +(assert_return (invoke "i32x4.replace_lane_first" (v128.const i64 0 0) (i32.const 53)) (v128.const i32 53 0 0 0)) +(assert_return (invoke "i32x4.replace_lane_last" (v128.const i64 0 0) (i32.const 53)) (v128.const i32 0 0 0 53)) ;; i64x2 lane accesses (assert_return (invoke "i64x2.splat" (i64.const -5)) (v128.const i64 -5 -5)) -(assert_return - (invoke "i64x2.extract_lane_first" (v128.const i64 -5 0)) - (i64.const -5) -) -(assert_return - (invoke "i64x2.extract_lane_last" (v128.const i64 0 -5)) - (i64.const -5) -) -(assert_return - (invoke "i64x2.replace_lane_first" (v128.const i64 0 0) (i64.const 53)) - (v128.const i64 53 0) -) -(assert_return - (invoke "i64x2.replace_lane_last" (v128.const i64 0 0) (i64.const 53)) - (v128.const i64 0 53) -) +(assert_return (invoke "i64x2.extract_lane_first" (v128.const i64 -5 0)) (i64.const -5)) +(assert_return (invoke "i64x2.extract_lane_last" (v128.const i64 0 -5)) (i64.const -5)) +(assert_return (invoke "i64x2.replace_lane_first" (v128.const i64 0 0) (i64.const 53)) (v128.const i64 53 0)) +(assert_return (invoke "i64x2.replace_lane_last" (v128.const i64 0 0) (i64.const 53)) (v128.const i64 0 53)) ;; f32x4 lane accesses (assert_return (invoke "f32x4.splat" (f32.const -5)) (v128.const f32 -5 -5 -5 -5)) -(assert_return - (invoke "f32x4.extract_lane_first" (v128.const f32 -5 0 0 0)) - (f32.const -5) -) -(assert_return - (invoke "f32x4.extract_lane_last" (v128.const f32 0 0 0 -5)) - (f32.const -5) -) -(assert_return - (invoke "f32x4.replace_lane_first" (v128.const i64 0 0) (f32.const 53)) - (v128.const f32 53 0 0 0) -) -(assert_return - (invoke "f32x4.replace_lane_last" (v128.const i64 0 0) (f32.const 53)) - (v128.const f32 0 0 0 53) -) +(assert_return (invoke "f32x4.extract_lane_first" (v128.const f32 -5 0 0 0)) (f32.const -5)) +(assert_return (invoke "f32x4.extract_lane_last" (v128.const f32 0 0 0 -5)) (f32.const -5)) +(assert_return (invoke "f32x4.replace_lane_first" (v128.const i64 0 0) (f32.const 53)) (v128.const f32 53 0 0 0)) +(assert_return (invoke "f32x4.replace_lane_last" (v128.const i64 0 0) (f32.const 53)) (v128.const f32 0 0 0 53)) ;; f64x2 lane accesses (assert_return (invoke "f64x2.splat" (f64.const -5)) (v128.const f64 -5 -5)) -(assert_return - (invoke "f64x2.extract_lane_first" (v128.const f64 -5 0)) - (f64.const -5) -) -(assert_return - (invoke "f64x2.extract_lane_last" (v128.const f64 0 -5)) - (f64.const -5) -) -(assert_return - (invoke "f64x2.replace_lane_first" (v128.const f64 0 0) (f64.const 53)) - (v128.const f64 53 0) -) -(assert_return - (invoke "f64x2.replace_lane_last" (v128.const f64 0 0) (f64.const 53)) - (v128.const f64 0 53) -) +(assert_return (invoke "f64x2.extract_lane_first" (v128.const f64 -5 0)) (f64.const -5)) +(assert_return (invoke "f64x2.extract_lane_last" (v128.const f64 0 -5)) (f64.const -5)) +(assert_return (invoke "f64x2.replace_lane_first" (v128.const f64 0 0) (f64.const 53)) (v128.const f64 53 0)) +(assert_return (invoke "f64x2.replace_lane_last" (v128.const f64 0 0) (f64.const 53)) (v128.const f64 0 53)) ;; i8x16 comparisons (assert_return @@ -472,239 +234,198 @@ (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0) + (v128.const i32 -1 0 -1 0 0 0 0 0 -1 0 0 -1 0 0 0 0) ) (assert_return (invoke "i8x16.ne" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 0 1 0 1 1 1 1 1 0 1 1 0 1 1 1 1) + (v128.const i32 0 -1 0 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1) ) (assert_return (invoke "i8x16.lt_s" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 0) + (v128.const i32 0 0 0 -1 0 -1 -1 0 0 0 -1 0 0 -1 -1 0) ) (assert_return (invoke "i8x16.lt_u" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1) + (v128.const i32 0 -1 0 0 -1 -1 0 -1 0 -1 0 0 -1 -1 0 -1) ) (assert_return (invoke "i8x16.gt_s" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1) + (v128.const i32 0 -1 0 0 -1 0 0 -1 0 -1 0 0 -1 0 0 -1) ) (assert_return (invoke "i8x16.gt_u" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0) + (v128.const i32 0 0 0 -1 0 0 -1 0 0 0 -1 0 0 0 -1 0) ) (assert_return (invoke "i8x16.le_s" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0) + (v128.const i32 -1 0 -1 -1 0 -1 -1 0 -1 0 -1 -1 0 -1 -1 0) ) (assert_return (invoke "i8x16.le_u" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 1) + (v128.const i32 -1 -1 -1 0 -1 -1 0 -1 -1 -1 0 -1 -1 -1 0 -1) ) (assert_return (invoke "i8x16.ge_s" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 1 1 1 0 1 0 0 1 1 1 0 1 1 0 0 1) + (v128.const i32 -1 -1 -1 0 -1 0 0 -1 -1 -1 0 -1 -1 0 0 -1) ) (assert_return (invoke "i8x16.ge_u" (v128.const i32 0 127 13 128 1 13 129 42 0 127 255 42 1 13 129 42) (v128.const i32 0 255 13 42 129 127 0 128 0 255 13 42 129 127 0 128) ) - (v128.const i32 1 0 1 1 0 0 1 0 1 0 1 1 0 0 1 0) + (v128.const i32 -1 0 -1 -1 0 0 -1 0 -1 0 -1 -1 0 0 -1 0) ) ;; i16x8 comparisons -(assert_return - (invoke "i16x8.eq" +(assert_return (invoke "i16x8.eq" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 1 0 0 0 0 0 0 0) + (v128.const i32 -1 0 0 0 0 0 0 0) ) (assert_return (invoke "i16x8.ne" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 0 1 1 1 1 1 1 1) + (v128.const i32 0 -1 -1 -1 -1 -1 -1 -1) ) (assert_return (invoke "i16x8.lt_s" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 0 0 0 1 0 1 0 1) + (v128.const i32 0 0 0 -1 0 -1 0 -1) ) (assert_return (invoke "i16x8.lt_u" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 0 0 0 0 1 0 1 0) + (v128.const i32 0 0 0 0 -1 0 -1 0) ) (assert_return (invoke "i16x8.gt_s" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 0 1 1 0 1 0 1 0) + (v128.const i32 0 -1 -1 0 -1 0 -1 0) ) (assert_return (invoke "i16x8.gt_u" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 0 1 1 1 0 1 0 1) + (v128.const i32 0 -1 -1 -1 0 -1 0 -1) ) (assert_return (invoke "i16x8.le_s" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 1 0 0 1 0 1 0 1) + (v128.const i32 -1 0 0 -1 0 -1 0 -1) ) (assert_return (invoke "i16x8.le_u" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 1 0 0 0 1 0 1 0) + (v128.const i32 -1 0 0 0 -1 0 -1 0) ) (assert_return (invoke "i16x8.ge_s" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 1 1 1 0 1 0 1 0) + (v128.const i32 -1 -1 -1 0 -1 0 -1 0) ) (assert_return (invoke "i16x8.ge_u" (v128.const i32 0 32767 13 32768 1 32769 42 40000) (v128.const i32 0 13 1 32767 32769 42 40000 32767) ) - (v128.const i32 1 1 1 1 0 1 0 1) + (v128.const i32 -1 -1 -1 -1 0 -1 0 -1) ) -(;; + ;; i32x4 comparisons -(assert_return - (invoke "i32x4.eq" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.ne" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.lt_s" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.lt_u" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.gt_s" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.gt_u" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.le_s" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.le_u" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.ge_s" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "i32x4.ge_u" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) +(assert_return (invoke "i32x4.eq" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 -1 0 0 0)) +(assert_return (invoke "i32x4.ne" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 0 -1 -1 -1)) +(assert_return (invoke "i32x4.lt_s" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 0 -1 0 -1)) +(assert_return (invoke "i32x4.lt_u" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 0 0 -1 -1)) +(assert_return (invoke "i32x4.gt_s" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 0 0 -1 0)) +(assert_return (invoke "i32x4.gt_u" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 0 -1 0 0)) +(assert_return (invoke "i32x4.le_s" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 -1 -1 0 -1)) +(assert_return (invoke "i32x4.le_u" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 -1 0 -1 -1)) +(assert_return (invoke "i32x4.ge_s" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 -1 0 -1 0)) +(assert_return (invoke "i32x4.ge_u" (v128.const i32 0 -1 53 -7) (v128.const i32 0 53 -7 -1)) (v128.const i32 -1 -1 0 0)) ;; f32x4 comparisons -(assert_return - (invoke "f32x4.eq" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f32x4.ne" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f32x4.lt" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f32x4.gt" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f32x4.le" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f32x4.ge" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) +(assert_return (invoke "f32x4.eq" (v128.const f32 0 -1 1 0) (v128.const f32 0 0 -1 1)) (v128.const i32 -1 0 0 0)) +(assert_return (invoke "f32x4.ne" (v128.const f32 0 -1 1 0) (v128.const f32 0 0 -1 1)) (v128.const i32 0 -1 -1 -1)) +(assert_return (invoke "f32x4.lt" (v128.const f32 0 -1 1 0) (v128.const f32 0 0 -1 1)) (v128.const i32 0 -1 0 -1)) +(assert_return (invoke "f32x4.gt" (v128.const f32 0 -1 1 0) (v128.const f32 0 0 -1 1)) (v128.const i32 0 0 -1 0)) +(assert_return (invoke "f32x4.le" (v128.const f32 0 -1 1 0) (v128.const f32 0 0 -1 1)) (v128.const i32 -1 -1 0 -1)) +(assert_return (invoke "f32x4.ge" (v128.const f32 0 -1 1 0) (v128.const f32 0 0 -1 1)) (v128.const i32 -1 0 -1 0)) +(assert_return (invoke "f32x4.eq" (v128.const f32 nan 0 nan infinity) (v128.const f32 0 nan nan infinity)) (v128.const i32 0 0 0 -1)) +(assert_return (invoke "f32x4.ne" (v128.const f32 nan 0 nan infinity) (v128.const f32 0 nan nan infinity)) (v128.const i32 -1 -1 -1 0)) +(assert_return (invoke "f32x4.lt" (v128.const f32 nan 0 nan infinity) (v128.const f32 0 nan nan infinity)) (v128.const i32 0 0 0 0)) +(assert_return (invoke "f32x4.gt" (v128.const f32 nan 0 nan infinity) (v128.const f32 0 nan nan infinity)) (v128.const i32 0 0 0 0)) +(assert_return (invoke "f32x4.le" (v128.const f32 nan 0 nan infinity) (v128.const f32 0 nan nan infinity)) (v128.const i32 0 0 0 -1)) +(assert_return (invoke "f32x4.ge" (v128.const f32 nan 0 nan infinity) (v128.const f32 0 nan nan infinity)) (v128.const i32 0 0 0 -1)) +(assert_return (invoke "f32x4.eq" (v128.const f32 -infinity 0 nan -infinity) (v128.const f32 0 infinity infinity nan)) (v128.const i32 0 0 0 0)) +(assert_return (invoke "f32x4.ne" (v128.const f32 -infinity 0 nan -infinity) (v128.const f32 0 infinity infinity nan)) (v128.const i32 -1 -1 -1 -1)) +(assert_return (invoke "f32x4.lt" (v128.const f32 -infinity 0 nan -infinity) (v128.const f32 0 infinity infinity nan)) (v128.const i32 -1 -1 0 0)) +(assert_return (invoke "f32x4.gt" (v128.const f32 -infinity 0 nan -infinity) (v128.const f32 0 infinity infinity nan)) (v128.const i32 0 0 0 0)) +(assert_return (invoke "f32x4.le" (v128.const f32 -infinity 0 nan -infinity) (v128.const f32 0 infinity infinity nan)) (v128.const i32 -1 -1 0 0)) +(assert_return (invoke "f32x4.ge" (v128.const f32 -infinity 0 nan -infinity) (v128.const f32 0 infinity infinity nan)) (v128.const i32 0 0 0 0)) ;; f64x2 comparisons -(assert_return - (invoke "f64x2.eq" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f64x2.ne" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f64x2.lt" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f64x2.gt" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f64x2.le" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "f64x2.ge" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) -) -(assert_return - (invoke "" (v128.const i32 ) (v128.const i32 )) - (v128.const i32 ) +(assert_return (invoke "f64x2.eq" (v128.const f64 0 1) (v128.const f64 0 0)) (v128.const i64 -1 0)) +(assert_return (invoke "f64x2.ne" (v128.const f64 0 1) (v128.const f64 0 0)) (v128.const i64 0 -1)) +(assert_return (invoke "f64x2.lt" (v128.const f64 0 1) (v128.const f64 0 0)) (v128.const i64 0 0)) +(assert_return (invoke "f64x2.gt" (v128.const f64 0 1) (v128.const f64 0 0)) (v128.const i64 0 -1)) +(assert_return (invoke "f64x2.le" (v128.const f64 0 1) (v128.const f64 0 0)) (v128.const i64 -1 0)) +(assert_return (invoke "f64x2.ge" (v128.const f64 0 1) (v128.const f64 0 0)) (v128.const i64 -1 -1)) +(assert_return (invoke "f64x2.eq" (v128.const f64 nan 0) (v128.const f64 infinity infinity)) (v128.const i64 0 0)) +(assert_return (invoke "f64x2.ne" (v128.const f64 nan 0) (v128.const f64 infinity infinity)) (v128.const i64 -1 -1)) +(assert_return (invoke "f64x2.lt" (v128.const f64 nan 0) (v128.const f64 infinity infinity)) (v128.const i64 0 -1)) +(assert_return (invoke "f64x2.gt" (v128.const f64 nan 0) (v128.const f64 infinity infinity)) (v128.const i64 0 0)) +(assert_return (invoke "f64x2.le" (v128.const f64 nan 0) (v128.const f64 infinity infinity)) (v128.const i64 0 -1)) +(assert_return (invoke "f64x2.ge" (v128.const f64 nan 0) (v128.const f64 infinity infinity)) (v128.const i64 0 0)) + +;; bitwise operations +(assert_return (invoke "v128.not" (v128.const i32 0 -1 0 -1)) (v128.const i32 -1 0 -1 0)) +(assert_return (invoke "v128.and" (v128.const i32 0 0 -1 -1) (v128.const i32 0 -1 0 -1)) (v128.const i32 0 0 0 -1)) +(assert_return (invoke "v128.or" (v128.const i32 0 0 -1 -1) (v128.const i32 0 -1 0 -1)) (v128.const i32 0 -1 -1 -1)) +(assert_return (invoke "v128.xor" (v128.const i32 0 0 -1 -1) (v128.const i32 0 -1 0 -1)) (v128.const i32 0 -1 -1 0)) +(assert_return (invoke "v128.bitselect" + (v128.const i32 0xAAAAAAAA 0xAAAAAAAA 0xAAAAAAAA 0xAAAAAAAA) + (v128.const i32 0xBBBBBBBB 0xBBBBBBBB 0xBBBBBBBB 0xBBBBBBBB) + (v128.const i32 0xF0F0F0F0 0xFFFFFFFF 0x00000000 0xFF00FF00) + ) + (v128.const i32 0xABABABAB 0xAAAAAAAA 0xBBBBBBBB 0xAABBAABB) ) -;;) From 99291577758977b165c2875fd40bc61e79d11d68 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 5 Dec 2018 16:51:07 -0800 Subject: [PATCH 17/36] Fix saturating arithmetic --- src/wasm/literal.cpp | 90 +++++++++++++++++++++++++++++++++++--------- test/spec/simd.wast | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 17 deletions(-) diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 4ff5dc88b91..3f9977bcba1 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -510,41 +510,97 @@ Literal Literal::sub(const Literal& other) const { WASM_UNREACHABLE(); } -template -static Literal sat_arith(const Literal& val, const Literal& other) { - assert(val.type == Type::i32 && other.type == Type::i32); - Literal sum = val.add(other); - if (sum.geti32() > std::numeric_limits::max()) { - return Literal(std::numeric_limits::max()); - } else if (sum.geti32() < std::numeric_limits::min()) { - return Literal(std::numeric_limits::min()); +template +static T sat_add(T a, T b) { + using UT = typename std::make_unsigned::type; + using ST = typename std::make_signed::type; + UT ua = static_cast(a); + UT ub = static_cast(b); + UT ures = ua + ub; + if (std::is_signed::value) { + // overflow if sign of result is different from sign of a and b + if (static_cast((ures ^ ua) & (ures ^ ub)) < 0) { + return (a < 0) + ? std::numeric_limits::min() + : std::numeric_limits::max(); + } + return static_cast(ures); + } else { + return (ures >= ub) ? ures : 0; + } +} + +template +static T add_sat_s(T a, T b) { + static_assert(std::is_signed::value); + using UT = typename std::make_unsigned::type; + UT ua = static_cast(a); + UT ub = static_cast(b); + UT ures = ua + ub; + // overflow if sign of result is different from sign of a and b + if (static_cast((ures ^ ua) & (ures ^ ub)) < 0) { + return (a < 0) + ? std::numeric_limits::min() + : std::numeric_limits::max(); } - return sum; + return static_cast(ures); +} + +template +static T sub_sat_s(T a, T b) { + static_assert(std::is_signed::value); + using UT = typename std::make_unsigned::type; + UT ua = static_cast(a); + UT ub = static_cast(b); + UT ures = ua - ub; + // overflow if a and b have different signs and result and a differ in sign + if (static_cast((ua ^ ub) & (ures ^ ua)) < 0) { + return (a < 0) + ? std::numeric_limits::min() + : std::numeric_limits::max(); + } + return static_cast(ures); +} + +template +static T add_sat_u(T a, T b) { + static_assert(std::is_unsigned::value); + T res = a + b; + // overflow if result is less than arguments + return (res < a) ? std::numeric_limits::max() : res; +} + +template +static T sub_sat_u(T a, T b) { + static_assert(std::is_unsigned::value); + T res = a - b; + // overflow if result is greater than a + return (res > a) ? 0 : res; } Literal Literal::addSatSI8(const Literal& other) const { - return sat_arith(*this, other); + return Literal(add_sat_s(geti32(), other.geti32())); } Literal Literal::addSatUI8(const Literal& other) const { - return sat_arith(*this, other); + return Literal(add_sat_u(geti32(), other.geti32())); } Literal Literal::addSatSI16(const Literal& other) const { - return sat_arith(*this, other); + return Literal(add_sat_s(geti32(), other.geti32())); } Literal Literal::addSatUI16(const Literal& other) const { - return sat_arith(*this, other); + return Literal(add_sat_u(geti32(), other.geti32())); } Literal Literal::subSatSI8(const Literal& other) const { - return sat_arith(*this, other); + return Literal(sub_sat_s(geti32(), other.geti32())); } Literal Literal::subSatUI8(const Literal& other) const { - return sat_arith(*this, other); + return Literal(sub_sat_u(geti32(), other.geti32())); } Literal Literal::subSatSI16(const Literal& other) const { - return sat_arith(*this, other); + return Literal(sub_sat_s(geti32(), other.geti32())); } Literal Literal::subSatUI16(const Literal& other) const { - return sat_arith(*this, other); + return Literal(sub_sat_u(geti32(), other.geti32())); } Literal Literal::mul(const Literal& other) const { diff --git a/test/spec/simd.wast b/test/spec/simd.wast index ad1fe56cdef..a8e149e99b2 100644 --- a/test/spec/simd.wast +++ b/test/spec/simd.wast @@ -429,3 +429,83 @@ ) (v128.const i32 0xABABABAB 0xAAAAAAAA 0xBBBBBBBB 0xAABBAABB) ) + +;; i8x16 arithmetic +(assert_return (invoke "i8x16.neg" (v128.const i32 0 1 42 -3 -56 127 -128 -126 0 -1 -42 3 56 -127 -128 126)) + (v128.const i32 0 -1 -42 3 56 -127 -128 126 0 1 42 -3 -56 127 -128 -126) +) +(assert_return (invoke "i8x16.any_true" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i8x16.any_true" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0)) (i32.const 1)) +(assert_return (invoke "i8x16.any_true" (v128.const i32 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i8x16.any_true" (v128.const i32 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i8x16.all_true" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i8x16.all_true" (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i8x16.all_true" (v128.const i32 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1)) (i32.const 0)) +(assert_return (invoke "i8x16.all_true" (v128.const i32 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i8x16.shl" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 1)) + (v128.const i32 0 2 4 8 16 32 64 -128 0 6 12 24 48 96 -64 -128) +) +(assert_return (invoke "i8x16.shl" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 8)) + (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) +) +(assert_return (invoke "i8x16.shr_u" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 1)) + (v128.const i32 0 0 1 2 4 8 16 32 64 1 3 6 12 24 48 96) +) +(assert_return (invoke "i8x16.shr_u" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 8)) + (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) +) +(assert_return (invoke "i8x16.shr_s" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 1)) + (v128.const i32 0 0 1 2 4 8 16 32 -64 1 3 6 12 24 48 -32) +) +(assert_return (invoke "i8x16.shr_s" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 8)) + (v128.const i32 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 -1) +) +(assert_return + (invoke "i8x16.add" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 3 17 0 0 0 135 109 46 145 225 48 184 17 249 128 215) +) +(assert_return + (invoke "i8x16.add_saturate_s" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 3 17 0 128 0 135 109 46 127 225 48 184 17 249 127 215) +) +(assert_return + (invoke "i8x16.add_saturate_u" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 3 255 255 255 255 135 109 46 145 225 255 184 17 255 128 215) +) +(assert_return + (invoke "i8x16.sub" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 253 67 254 0 254 123 159 12 61 167 158 100 17 251 130 187) +) +(assert_return + (invoke "i8x16.sub_saturate_s" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 253 67 254 0 127 128 159 12 61 167 158 128 17 251 130 127) +) +(assert_return + (invoke "i8x16.sub_saturate_u" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 0 0 254 0 0 123 0 12 61 167 158 100 17 0 0 0) +) +(assert_return + (invoke "i8x16.mul" + (v128.const i32 0 42 255 128 127 129 6 29 103 196 231 142 17 250 1 73) + (v128.const i32 3 231 1 128 129 6 103 17 42 29 73 42 0 255 127 142) + ) + (v128.const i32 0 230 255 0 255 6 106 237 230 52 223 76 0 6 127 126) +) From 4822fe2cdb685b0573b181702db02fbbbb37b707 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 5 Dec 2018 17:50:09 -0800 Subject: [PATCH 18/36] Finish i16x8 arithmetic --- test/spec/simd.wast | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/test/spec/simd.wast b/test/spec/simd.wast index a8e149e99b2..23043478ac6 100644 --- a/test/spec/simd.wast +++ b/test/spec/simd.wast @@ -509,3 +509,71 @@ ) (v128.const i32 0 230 255 0 255 6 106 237 230 52 223 76 0 6 127 126) ) + +;; i16x8 arithmetic +(assert_return (invoke "i16x8.neg" (v128.const i32 0 1 42 -3 -56 32767 -32768 32766)) + (v128.const i32 0 -1 -42 3 56 -32767 -32768 -32766) +) +(assert_return (invoke "i16x8.any_true" (v128.const i32 0 0 0 0 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i16x8.any_true" (v128.const i32 0 0 1 0 0 0 0 0)) (i32.const 1)) +(assert_return (invoke "i16x8.any_true" (v128.const i32 1 1 1 1 1 0 1 1)) (i32.const 1)) +(assert_return (invoke "i16x8.any_true" (v128.const i32 1 1 1 1 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i16x8.all_true" (v128.const i32 0 0 0 0 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i16x8.all_true" (v128.const i32 0 0 1 0 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i16x8.all_true" (v128.const i32 1 1 1 1 1 0 1 1)) (i32.const 0)) +(assert_return (invoke "i16x8.all_true" (v128.const i32 1 1 1 1 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i16x8.shl" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 1)) (v128.const i32 0 16 32 256 512 4096 8192 0)) +(assert_return (invoke "i16x8.shl" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 0 0 0 0 0 0 0)) +(assert_return (invoke "i16x8.shr_u" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 1)) (v128.const i32 0 4 8 64 128 1024 2048 16384)) +(assert_return (invoke "i16x8.shr_u" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 0 0 0 0 0 0 0)) +(assert_return (invoke "i16x8.shr_s" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 1)) (v128.const i32 0 4 8 64 128 1024 2048 -16384)) +(assert_return (invoke "i16x8.shr_s" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 0 0 0 0 0 0 -1)) +(assert_return + (invoke "i16x8.add" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 768 65281 0 0 34560 12288 63744 32768) +) +(assert_return + (invoke "i16x8.add_saturate_s" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 768 65281 32768 0 34560 12288 63744 32767) +) +(assert_return + (invoke "i16x8.add_saturate_u" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 768 65281 65535 65535 34560 65535 65535 32768) +) +(assert_return + (invoke "i16x8.sub" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 64768 65279 0 65024 31488 40448 64256 32764) +) +(assert_return + (invoke "i16x8.sub_saturate_s" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 64768 65279 0 32767 32768 40448 64256 32764) +) +(assert_return + (invoke "i16x8.sub_saturate_u" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 0 65279 0 0 31488 40448 0 32764) +) +(assert_return + (invoke "i16x8.mul" + (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) + (v128.const i32 768 1 32768 33024 1536 18688 65280 2) + ) + (v128.const i32 0 65280 0 0 0 0 0 65532) +) From 0319bf27d0a0d92e56f4efc3c0b816aa3c2e1f0f Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 6 Dec 2018 10:34:25 -0800 Subject: [PATCH 19/36] Test through i32x4 arithmetic and fix shifts --- src/wasm/literal.cpp | 3 ++- test/spec/simd.wast | 32 ++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 3f9977bcba1..42ec40ade28 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -1167,9 +1167,10 @@ template (Literal::*IntoLanes)() const, Literal (Literal::*ShiftOp)(const Literal&) const> static Literal shift(const Literal& val, const Literal& other) { assert(other.type == Type::i32); + size_t lane_bits = 128 / Lanes; LaneArray lanes = (val.*IntoLanes)(); for (size_t i = 0; i < Lanes; ++i) { - lanes[i] = (lanes[i].*ShiftOp)(other); + lanes[i] = (lanes[i].*ShiftOp)(Literal(other.geti32() % lane_bits)); } return Literal(lanes); } diff --git a/test/spec/simd.wast b/test/spec/simd.wast index 23043478ac6..92eb4ac8ea6 100644 --- a/test/spec/simd.wast +++ b/test/spec/simd.wast @@ -446,19 +446,19 @@ (v128.const i32 0 2 4 8 16 32 64 -128 0 6 12 24 48 96 -64 -128) ) (assert_return (invoke "i8x16.shl" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 8)) - (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) ) (assert_return (invoke "i8x16.shr_u" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 1)) (v128.const i32 0 0 1 2 4 8 16 32 64 1 3 6 12 24 48 96) ) (assert_return (invoke "i8x16.shr_u" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 8)) - (v128.const i32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) ) (assert_return (invoke "i8x16.shr_s" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 1)) (v128.const i32 0 0 1 2 4 8 16 32 -64 1 3 6 12 24 48 -32) ) (assert_return (invoke "i8x16.shr_s" (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) (i32.const 8)) - (v128.const i32 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 -1) + (v128.const i32 0 1 2 4 8 16 32 64 -128 3 6 12 24 48 96 -64) ) (assert_return (invoke "i8x16.add" @@ -523,11 +523,11 @@ (assert_return (invoke "i16x8.all_true" (v128.const i32 1 1 1 1 1 0 1 1)) (i32.const 0)) (assert_return (invoke "i16x8.all_true" (v128.const i32 1 1 1 1 1 1 1 1)) (i32.const 1)) (assert_return (invoke "i16x8.shl" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 1)) (v128.const i32 0 16 32 256 512 4096 8192 0)) -(assert_return (invoke "i16x8.shl" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 0 0 0 0 0 0 0)) +(assert_return (invoke "i16x8.shl" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 8 16 128 256 2048 4096 -32768)) (assert_return (invoke "i16x8.shr_u" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 1)) (v128.const i32 0 4 8 64 128 1024 2048 16384)) -(assert_return (invoke "i16x8.shr_u" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 0 0 0 0 0 0 0)) +(assert_return (invoke "i16x8.shr_u" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 8 16 128 256 2048 4096 -32768)) (assert_return (invoke "i16x8.shr_s" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 1)) (v128.const i32 0 4 8 64 128 1024 2048 -16384)) -(assert_return (invoke "i16x8.shr_s" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 0 0 0 0 0 0 -1)) +(assert_return (invoke "i16x8.shr_s" (v128.const i32 0 8 16 128 256 2048 4096 -32768) (i32.const 16)) (v128.const i32 0 8 16 128 256 2048 4096 -32768)) (assert_return (invoke "i16x8.add" (v128.const i32 0 65280 32768 32512 33024 59136 64000 32766) @@ -577,3 +577,23 @@ ) (v128.const i32 0 65280 0 0 0 0 0 65532) ) + +;; i32x4 arithmetic +(assert_return (invoke "i32x4.neg" (v128.const i32 0 1 0x80000000 0x7fffffff)) (v128.const i32 0 -1 0x80000000 0x80000001)) +(assert_return (invoke "i32x4.any_true" (v128.const i32 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i32x4.any_true" (v128.const i32 0 0 1 0)) (i32.const 1)) +(assert_return (invoke "i32x4.any_true" (v128.const i32 1 0 1 1)) (i32.const 1)) +(assert_return (invoke "i32x4.any_true" (v128.const i32 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i32x4.all_true" (v128.const i32 0 0 0 0)) (i32.const 0)) +(assert_return (invoke "i32x4.all_true" (v128.const i32 0 0 1 0)) (i32.const 0)) +(assert_return (invoke "i32x4.all_true" (v128.const i32 1 0 1 1)) (i32.const 0)) +(assert_return (invoke "i32x4.all_true" (v128.const i32 1 1 1 1)) (i32.const 1)) +(assert_return (invoke "i32x4.shl" (v128.const i32 1 0x40000000 0x80000000 -1) (i32.const 1)) (v128.const i32 2 0x80000000 0 -2)) +(assert_return (invoke "i32x4.shl" (v128.const i32 1 0x40000000 0x80000000 -1) (i32.const 32)) (v128.const i32 1 0x40000000 0x80000000 -1)) +(assert_return (invoke "i32x4.shr_s" (v128.const i32 1 0x40000000 0x80000000 -1) (i32.const 1)) (v128.const i32 0 0x20000000 0xc0000000 -1)) +(assert_return (invoke "i32x4.shr_s" (v128.const i32 1 0x40000000 0x80000000 -1) (i32.const 32)) (v128.const i32 1 0x40000000 0x80000000 -1)) +(assert_return (invoke "i32x4.shr_u" (v128.const i32 1 0x40000000 0x80000000 -1) (i32.const 1)) (v128.const i32 0 0x20000000 0x40000000 0x7fffffff)) +(assert_return (invoke "i32x4.shr_u" (v128.const i32 1 0x40000000 0x80000000 -1) (i32.const 32)) (v128.const i32 1 0x40000000 0x80000000 -1)) +(assert_return (invoke "i32x4.add" (v128.const i32 0 0x80000001 42 5) (v128.const i32 0 0x80000001 5 42)) (v128.const i32 0 2 47 47)) +(assert_return (invoke "i32x4.sub" (v128.const i32 0 2 47 47) (v128.const i32 0 0x80000001 42 5)) (v128.const i32 0 0x80000001 5 42)) +(assert_return (invoke "i32x4.mul" (v128.const i32 0 0x80000001 42 5) (v128.const i32 0 0x80000001 42 5)) (v128.const i32 0 1 1764 25)) From e662229437dbc363efe7cbca088ab18f66a505dc Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 6 Dec 2018 13:23:46 -0800 Subject: [PATCH 20/36] Finish spec tests and fix conversions --- src/wasm/literal.cpp | 16 +++++----- test/spec/simd.wast | 74 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 76 insertions(+), 14 deletions(-) diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 42ec40ade28..8cf4c679150 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -1092,28 +1092,28 @@ Literal Literal::sqrtF64x2() const { return unary<2, &Literal::getLanesF64x2, &Literal::sqrt>(*this); } Literal Literal::truncSatToSI32x4() const { - return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToSI32>(*this); + return unary<4, &Literal::getLanesF32x4, &Literal::truncSatToSI32>(*this); } Literal Literal::truncSatToUI32x4() const { - return unary<4, &Literal::getLanesI32x4, &Literal::truncSatToUI32>(*this); + return unary<4, &Literal::getLanesF32x4, &Literal::truncSatToUI32>(*this); } Literal Literal::truncSatToSI64x2() const { - return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToSI64>(*this); + return unary<2, &Literal::getLanesF64x2, &Literal::truncSatToSI64>(*this); } Literal Literal::truncSatToUI64x2() const { - return unary<2, &Literal::getLanesI64x2, &Literal::truncSatToUI64>(*this); + return unary<2, &Literal::getLanesF64x2, &Literal::truncSatToUI64>(*this); } Literal Literal::convertSToF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::convertSIToF32>(*this); + return unary<4, &Literal::getLanesI32x4, &Literal::convertSIToF32>(*this); } Literal Literal::convertUToF32x4() const { - return unary<4, &Literal::getLanesF32x4, &Literal::convertUIToF32>(*this); + return unary<4, &Literal::getLanesI32x4, &Literal::convertUIToF32>(*this); } Literal Literal::convertSToF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::convertSIToF64>(*this); + return unary<2, &Literal::getLanesI64x2, &Literal::convertSIToF64>(*this); } Literal Literal::convertUToF64x2() const { - return unary<2, &Literal::getLanesF64x2, &Literal::convertUIToF64>(*this); + return unary<2, &Literal::getLanesI64x2, &Literal::convertUIToF64>(*this); } template (Literal::*IntoLanes)() const> diff --git a/test/spec/simd.wast b/test/spec/simd.wast index 92eb4ac8ea6..e4ac42322a0 100644 --- a/test/spec/simd.wast +++ b/test/spec/simd.wast @@ -137,6 +137,9 @@ (func (export "i64x2.shl") (param $0 v128) (param $1 i32) (result v128) (i64x2.shl (get_local $0) (get_local $1))) (func (export "i64x2.shr_s") (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_s (get_local $0) (get_local $1))) (func (export "i64x2.shr_u") (param $0 v128) (param $1 i32) (result v128) (i64x2.shr_u (get_local $0) (get_local $1))) + (func (export "f32x4.abs") (param $0 v128) (result v128) (f32x4.abs (get_local $0))) + (func (export "f32x4.neg") (param $0 v128) (result v128) (f32x4.neg (get_local $0))) + (func (export "f32x4.sqrt") (param $0 v128) (result v128) (f32x4.sqrt (get_local $0))) (func (export "i64x2.add") (param $0 v128) (param $1 v128) (result v128) (i64x2.add (get_local $0) (get_local $1))) (func (export "i64x2.sub") (param $0 v128) (param $1 v128) (result v128) (i64x2.sub (get_local $0) (get_local $1))) (func (export "f32x4.add") (param $0 v128) (param $1 v128) (result v128) (f32x4.add (get_local $0) (get_local $1))) @@ -145,18 +148,15 @@ (func (export "f32x4.div") (param $0 v128) (param $1 v128) (result v128) (f32x4.div (get_local $0) (get_local $1))) (func (export "f32x4.min") (param $0 v128) (param $1 v128) (result v128) (f32x4.min (get_local $0) (get_local $1))) (func (export "f32x4.max") (param $0 v128) (param $1 v128) (result v128) (f32x4.max (get_local $0) (get_local $1))) - (func (export "f32x4.abs") (param $0 v128) (result v128) (f32x4.abs (get_local $0))) - (func (export "f32x4.neg") (param $0 v128) (result v128) (f32x4.neg (get_local $0))) - (func (export "f32x4.sqrt") (param $0 v128) (result v128) (f32x4.sqrt (get_local $0))) + (func (export "f64x2.abs") (param $0 v128) (result v128) (f64x2.abs (get_local $0))) + (func (export "f64x2.neg") (param $0 v128) (result v128) (f64x2.neg (get_local $0))) + (func (export "f64x2.sqrt") (param $0 v128) (result v128) (f64x2.sqrt (get_local $0))) (func (export "f64x2.add") (param $0 v128) (param $1 v128) (result v128) (f64x2.add (get_local $0) (get_local $1))) (func (export "f64x2.sub") (param $0 v128) (param $1 v128) (result v128) (f64x2.sub (get_local $0) (get_local $1))) (func (export "f64x2.mul") (param $0 v128) (param $1 v128) (result v128) (f64x2.mul (get_local $0) (get_local $1))) (func (export "f64x2.div") (param $0 v128) (param $1 v128) (result v128) (f64x2.div (get_local $0) (get_local $1))) (func (export "f64x2.min") (param $0 v128) (param $1 v128) (result v128) (f64x2.min (get_local $0) (get_local $1))) (func (export "f64x2.max") (param $0 v128) (param $1 v128) (result v128) (f64x2.max (get_local $0) (get_local $1))) - (func (export "f64x2.abs") (param $0 v128) (result v128) (f64x2.abs (get_local $0))) - (func (export "f64x2.neg") (param $0 v128) (result v128) (f64x2.neg (get_local $0))) - (func (export "f64x2.sqrt") (param $0 v128) (result v128) (f64x2.sqrt (get_local $0))) (func (export "i32x4.trunc_s/f32x4:sat") (param $0 v128) (result v128) (i32x4.trunc_s/f32x4:sat (get_local $0))) (func (export "i32x4.trunc_u/f32x4:sat") (param $0 v128) (result v128) (i32x4.trunc_u/f32x4:sat (get_local $0))) (func (export "i64x2.trunc_s/f64x2:sat") (param $0 v128) (result v128) (i64x2.trunc_s/f64x2:sat (get_local $0))) @@ -597,3 +597,65 @@ (assert_return (invoke "i32x4.add" (v128.const i32 0 0x80000001 42 5) (v128.const i32 0 0x80000001 5 42)) (v128.const i32 0 2 47 47)) (assert_return (invoke "i32x4.sub" (v128.const i32 0 2 47 47) (v128.const i32 0 0x80000001 42 5)) (v128.const i32 0 0x80000001 5 42)) (assert_return (invoke "i32x4.mul" (v128.const i32 0 0x80000001 42 5) (v128.const i32 0 0x80000001 42 5)) (v128.const i32 0 1 1764 25)) + +;; i64x2 arithmetic +(assert_return (invoke "i64x2.neg" (v128.const i64 0x8000000000000000 42)) (v128.const i64 0x8000000000000000 -42)) +(assert_return (invoke "i64x2.any_true" (v128.const i64 0 0)) (i32.const 0)) +(assert_return (invoke "i64x2.any_true" (v128.const i64 1 0)) (i32.const 1)) +(assert_return (invoke "i64x2.any_true" (v128.const i64 1 1)) (i32.const 1)) +(assert_return (invoke "i64x2.all_true" (v128.const i64 0 0)) (i32.const 0)) +(assert_return (invoke "i64x2.all_true" (v128.const i64 1 0)) (i32.const 0)) +(assert_return (invoke "i64x2.all_true" (v128.const i64 1 1)) (i32.const 1)) +(assert_return (invoke "i64x2.shl" (v128.const i64 1 0x8000000000000000) (i32.const 1)) (v128.const i64 2 0)) +(assert_return (invoke "i64x2.shl" (v128.const i64 1 0x8000000000000000) (i32.const 64)) (v128.const i64 1 0x8000000000000000)) +(assert_return (invoke "i64x2.shr_s" (v128.const i64 1 0x8000000000000000) (i32.const 1)) (v128.const i64 0 0xc000000000000000)) +(assert_return (invoke "i64x2.shr_s" (v128.const i64 1 0x8000000000000000) (i32.const 64)) (v128.const i64 1 0x8000000000000000)) +(assert_return (invoke "i64x2.shr_u" (v128.const i64 1 0x8000000000000000) (i32.const 1)) (v128.const i64 0 0x4000000000000000)) +(assert_return (invoke "i64x2.shr_u" (v128.const i64 1 0x8000000000000000) (i32.const 64)) (v128.const i64 1 0x8000000000000000)) +(assert_return (invoke "i64x2.add" (v128.const i64 0x8000000000000001 42) (v128.const i64 0x8000000000000001 0)) (v128.const i64 2 42)) +(assert_return (invoke "i64x2.sub" (v128.const i64 2 42) (v128.const i64 0x8000000000000001 0)) (v128.const i64 0x8000000000000001 42)) + +;; f32x4 arithmetic +(assert_return (invoke "f32x4.abs" (v128.const f32 -0 nan -infinity 5)) (v128.const f32 0 nan infinity 5)) +(assert_return (invoke "f32x4.neg" (v128.const f32 -0 nan -infinity 5)) (v128.const f32 0 -nan infinity -5)) +(assert_return (invoke "f32x4.sqrt" (v128.const f32 -0 nan infinity 4)) (v128.const f32 -0 nan infinity 2)) +(assert_return (invoke "f32x4.add" (v128.const f32 nan -nan infinity 42) (v128.const f32 42 infinity infinity 1)) (v128.const f32 nan -nan infinity 43)) +(assert_return (invoke "f32x4.sub" (v128.const f32 nan -nan infinity 42) (v128.const f32 42 infinity -infinity 1)) (v128.const f32 nan -nan infinity 41)) +(assert_return (invoke "f32x4.mul" (v128.const f32 nan -nan infinity 42) (v128.const f32 42 infinity infinity 2)) (v128.const f32 nan -nan infinity 84)) +(assert_return (invoke "f32x4.div" (v128.const f32 nan -nan infinity 42) (v128.const f32 42 infinity 2 2)) (v128.const f32 nan -nan infinity 21)) +(assert_return (invoke "f32x4.min" (v128.const f32 -0 0 nan 5) (v128.const f32 0 -0 5 nan)) (v128.const f32 -0 -0 nan nan)) +(assert_return (invoke "f32x4.max" (v128.const f32 -0 0 nan 5) (v128.const f32 0 -0 5 nan)) (v128.const f32 0 0 nan nan)) + +;; f64x2 arithmetic +(assert_return (invoke "f64x2.abs" (v128.const f64 -0 nan)) (v128.const f64 0 nan)) +(assert_return (invoke "f64x2.abs" (v128.const f64 -infinity 5)) (v128.const f64 infinity 5)) +(assert_return (invoke "f64x2.neg" (v128.const f64 -0 nan)) (v128.const f64 0 -nan)) +(assert_return (invoke "f64x2.neg" (v128.const f64 -infinity 5)) (v128.const f64 infinity -5)) +(assert_return (invoke "f64x2.sqrt" (v128.const f64 -0 nan)) (v128.const f64 -0 nan)) +(assert_return (invoke "f64x2.sqrt" (v128.const f64 infinity 4)) (v128.const f64 infinity 2)) +(assert_return (invoke "f64x2.add" (v128.const f64 nan -nan) (v128.const f64 42 infinity)) (v128.const f64 nan -nan)) +(assert_return (invoke "f64x2.add" (v128.const f64 infinity 42) (v128.const f64 infinity 1)) (v128.const f64 infinity 43)) +(assert_return (invoke "f64x2.sub" (v128.const f64 nan -nan) (v128.const f64 42 infinity)) (v128.const f64 nan -nan)) +(assert_return (invoke "f64x2.sub" (v128.const f64 infinity 42) (v128.const f64 -infinity 1)) (v128.const f64 infinity 41)) +(assert_return (invoke "f64x2.mul" (v128.const f64 nan -nan) (v128.const f64 42 infinity)) (v128.const f64 nan -nan)) +(assert_return (invoke "f64x2.mul" (v128.const f64 infinity 42) (v128.const f64 infinity 2)) (v128.const f64 infinity 84)) +(assert_return (invoke "f64x2.div" (v128.const f64 nan -nan) (v128.const f64 42 infinity)) (v128.const f64 nan -nan)) +(assert_return (invoke "f64x2.div" (v128.const f64 infinity 42) (v128.const f64 2 2)) (v128.const f64 infinity 21)) +(assert_return (invoke "f64x2.min" (v128.const f64 -0 0) (v128.const f64 0 -0)) (v128.const f64 -0 -0)) +(assert_return (invoke "f64x2.min" (v128.const f64 nan 5) (v128.const f64 5 nan)) (v128.const f64 nan nan)) +(assert_return (invoke "f64x2.max" (v128.const f64 -0 0) (v128.const f64 0 -0)) (v128.const f64 0 0)) +(assert_return (invoke "f64x2.max" (v128.const f64 nan 5) (v128.const f64 5 nan)) (v128.const f64 nan nan)) + +;; conversions +(assert_return (invoke "i32x4.trunc_s/f32x4:sat" (v128.const f32 42 nan infinity -infinity)) (v128.const i32 42 0 2147483647 -2147483648)) +(assert_return (invoke "i32x4.trunc_u/f32x4:sat" (v128.const f32 42 nan infinity -infinity)) (v128.const i32 42 0 4294967295 0)) +(assert_return (invoke "i64x2.trunc_s/f64x2:sat" (v128.const f64 42 nan)) (v128.const i64 42 0)) +(assert_return (invoke "i64x2.trunc_s/f64x2:sat" (v128.const f64 infinity -infinity)) (v128.const i64 9223372036854775807 -9223372036854775808)) +(assert_return (invoke "i64x2.trunc_u/f64x2:sat" (v128.const f64 42 nan)) (v128.const i64 42 0)) +(assert_return (invoke "i64x2.trunc_u/f64x2:sat" (v128.const f64 infinity -infinity)) (v128.const i64 18446744073709551615 0)) +(assert_return (invoke "f32x4.convert_s/i32x4" (v128.const i32 0 -1 2147483647 -2147483648)) (v128.const f32 0 -1 2147483648 -2147483648)) +(assert_return (invoke "f32x4.convert_u/i32x4" (v128.const i32 0 -1 2147483647 -2147483648)) (v128.const f32 0 4294967296 2147483648 2147483648)) +(assert_return (invoke "f64x2.convert_s/i64x2" (v128.const i64 0 -1)) (v128.const f64 0 -1)) +(assert_return (invoke "f64x2.convert_s/i64x2" (v128.const i64 9223372036854775807 -9223372036854775808)) (v128.const f64 9223372036854775807 -9223372036854775808)) +(assert_return (invoke "f64x2.convert_u/i64x2" (v128.const i64 0 -1)) (v128.const f64 0 18446744073709551616)) +(assert_return (invoke "f64x2.convert_u/i64x2" (v128.const i64 9223372036854775807 -9223372036854775808)) (v128.const f64 9223372036854775807 9223372036854775808)) From 3e56e844dacc755d3ac834edd015314bd89eada2 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 6 Dec 2018 13:40:01 -0800 Subject: [PATCH 21/36] Fix i63x4 in print --- src/passes/Print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index f5139626bac..64dd0deae97 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -357,7 +357,7 @@ struct PrintExpressionContents : public Visitor { case SplatVecI8x16: o << "i8x16.splat"; break; case SplatVecI16x8: o << "i16x8.splat"; break; case SplatVecI32x4: o << "i32x4.splat"; break; - case SplatVecI64x2: o << "i63x2.splat"; break; + case SplatVecI64x2: o << "i64x2.splat"; break; case SplatVecF32x4: o << "f32x4.splat"; break; case SplatVecF64x2: o << "f64x2.splat"; break; case NotVec128: o << "v128.not"; break; From 48ac9c6f68d379c0e949ff0ea945e860be6db3e3 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 6 Dec 2018 14:18:28 -0800 Subject: [PATCH 22/36] Fix comparison binary parsing bug --- src/wasm-stack.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/wasm-stack.h b/src/wasm-stack.h index d092c2d2c36..0c10a88fcc5 100644 --- a/src/wasm-stack.h +++ b/src/wasm-stack.h @@ -1192,43 +1192,43 @@ void StackWriter::visitBinary(Binary* curr) { case NeVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16Ne); break; case LtSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LtS); break; case LtUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LtU); break; - case LeSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GtS); break; - case LeUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GtU); break; - case GtSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LeS); break; - case GtUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LeU); break; + case GtSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GtS); break; + case GtUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GtU); break; + case LeSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LeS); break; + case LeUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16LeU); break; case GeSVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GeS); break; case GeUVecI8x16: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I8x16GeU); break; case EqVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Eq); break; case NeVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8Ne); break; case LtSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LtS); break; case LtUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LtU); break; - case LeSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GtS); break; - case LeUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GtU); break; - case GtSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LeS); break; - case GtUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LeU); break; + case GtSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GtS); break; + case GtUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GtU); break; + case LeSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LeS); break; + case LeUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8LeU); break; case GeSVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GeS); break; case GeUVecI16x8: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I16x8GeU); break; case EqVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Eq); break; case NeVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4Ne); break; case LtSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LtS); break; case LtUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LtU); break; - case LeSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GtS); break; - case LeUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GtU); break; - case GtSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LeS); break; - case GtUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LeU); break; + case GtSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GtS); break; + case GtUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GtU); break; + case LeSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LeS); break; + case LeUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4LeU); break; case GeSVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GeS); break; case GeUVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4GeU); break; case EqVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Eq); break; case NeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Ne); break; case LtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Lt); break; - case LeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Gt); break; - case GtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Le); break; + case GtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Gt); break; + case LeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Le); break; case GeVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Ge); break; case EqVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Eq); break; case NeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Ne); break; case LtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Lt); break; - case LeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Gt); break; - case GtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Le); break; + case GtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Gt); break; + case LeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Le); break; case GeVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Ge); break; case AndVec128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128And); break; case OrVec128: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::V128Or); break; From 5f6aec3ff294c399bffee0c1f2a81b0a218fba56 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 6 Dec 2018 15:42:17 -0800 Subject: [PATCH 23/36] Add builder and C apis --- src/binaryen-c.cpp | 174 +++++++++++++++++++++++++++++++++++++++++++++ src/binaryen-c.h | 140 ++++++++++++++++++++++++++++++++++++ src/wasm-builder.h | 41 +++++++++++ src/wasm.h | 10 +-- 4 files changed, 360 insertions(+), 5 deletions(-) diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 1b3a30103c5..9507b2bc2bd 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -484,6 +484,141 @@ BinaryenOp BinaryenTruncSatSFloat64ToInt32(void) { return TruncSatSFloat64ToInt3 BinaryenOp BinaryenTruncSatSFloat64ToInt64(void) { return TruncSatSFloat64ToInt64; } BinaryenOp BinaryenTruncSatUFloat64ToInt32(void) { return TruncSatUFloat64ToInt32; } BinaryenOp BinaryenTruncSatUFloat64ToInt64(void) { return TruncSatUFloat64ToInt64; } +BinaryenOp BinaryenSplatVecI8x16(void) { return SplatVecI8x16; } +BinaryenOp BinaryenExtractLaneSVecI8x16(void) { return ExtractLaneSVecI8x16; } +BinaryenOp BinaryenExtractLaneUVecI8x16(void) { return ExtractLaneUVecI8x16; } +BinaryenOp BinaryenReplaceLaneVecI8x16(void) { return ReplaceLaneVecI8x16; } +BinaryenOp BinaryenSplatVecI16x8(void) { return SplatVecI16x8; } +BinaryenOp BinaryenExtractLaneSVecI16x8(void) { return ExtractLaneSVecI16x8; } +BinaryenOp BinaryenExtractLaneUVecI16x8(void) { return ExtractLaneUVecI16x8; } +BinaryenOp BinaryenReplaceLaneVecI16x8(void) { return ReplaceLaneVecI16x8; } +BinaryenOp BinaryenSplatVecI32x4(void) { return SplatVecI32x4; } +BinaryenOp BinaryenExtractLaneVecI32x4(void) { return ExtractLaneVecI32x4; } +BinaryenOp BinaryenReplaceLaneVecI32x4(void) { return ReplaceLaneVecI32x4; } +BinaryenOp BinaryenSplatVecI64x2(void) { return SplatVecI64x2; } +BinaryenOp BinaryenExtractLaneVecI64x2(void) { return ExtractLaneVecI64x2; } +BinaryenOp BinaryenReplaceLaneVecI64x2(void) { return ReplaceLaneVecI64x2; } +BinaryenOp BinaryenSplatVecF32x4(void) { return SplatVecF32x4; } +BinaryenOp BinaryenExtractLaneVecF32x4(void) { return ExtractLaneVecF32x4; } +BinaryenOp BinaryenReplaceLaneVecF32x4(void) { return ReplaceLaneVecF32x4; } +BinaryenOp BinaryenSplatVecF64x2(void) { return SplatVecF64x2; } +BinaryenOp BinaryenExtractLaneVecF64x2(void) { return ExtractLaneVecF64x2; } +BinaryenOp BinaryenReplaceLaneVecF64x2(void) { return ReplaceLaneVecF64x2; } +BinaryenOp BinaryenEqVecI8x16(void) { return EqVecI8x16; } +BinaryenOp BinaryenNeVecI8x16(void) { return NeVecI8x16; } +BinaryenOp BinaryenLtSVecI8x16(void) { return LtSVecI8x16; } +BinaryenOp BinaryenLtUVecI8x16(void) { return LtUVecI8x16; } +BinaryenOp BinaryenGtSVecI8x16(void) { return GtSVecI8x16; } +BinaryenOp BinaryenGtUVecI8x16(void) { return GtUVecI8x16; } +BinaryenOp BinaryenLeSVecI8x16(void) { return LeSVecI8x16; } +BinaryenOp BinaryenLeUVecI8x16(void) { return LeUVecI8x16; } +BinaryenOp BinaryenGeSVecI8x16(void) { return GeSVecI8x16; } +BinaryenOp BinaryenGeUVecI8x16(void) { return GeUVecI8x16; } +BinaryenOp BinaryenEqVecI16x8(void) { return EqVecI16x8; } +BinaryenOp BinaryenNeVecI16x8(void) { return NeVecI16x8; } +BinaryenOp BinaryenLtSVecI16x8(void) { return LtSVecI16x8; } +BinaryenOp BinaryenLtUVecI16x8(void) { return LtUVecI16x8; } +BinaryenOp BinaryenGtSVecI16x8(void) { return GtSVecI16x8; } +BinaryenOp BinaryenGtUVecI16x8(void) { return GtUVecI16x8; } +BinaryenOp BinaryenLeSVecI16x8(void) { return LeSVecI16x8; } +BinaryenOp BinaryenLeUVecI16x8(void) { return LeUVecI16x8; } +BinaryenOp BinaryenGeSVecI16x8(void) { return GeSVecI16x8; } +BinaryenOp BinaryenGeUVecI16x8(void) { return GeUVecI16x8; } +BinaryenOp BinaryenEqVecI32x4(void) { return EqVecI32x4; } +BinaryenOp BinaryenNeVecI32x4(void) { return NeVecI32x4; } +BinaryenOp BinaryenLtSVecI32x4(void) { return LtSVecI32x4; } +BinaryenOp BinaryenLtUVecI32x4(void) { return LtUVecI32x4; } +BinaryenOp BinaryenGtSVecI32x4(void) { return GtSVecI32x4; } +BinaryenOp BinaryenGtUVecI32x4(void) { return GtUVecI32x4; } +BinaryenOp BinaryenLeSVecI32x4(void) { return LeSVecI32x4; } +BinaryenOp BinaryenLeUVecI32x4(void) { return LeUVecI32x4; } +BinaryenOp BinaryenGeSVecI32x4(void) { return GeSVecI32x4; } +BinaryenOp BinaryenGeUVecI32x4(void) { return GeUVecI32x4; } +BinaryenOp BinaryenEqVecF32x4(void) { return EqVecF32x4; } +BinaryenOp BinaryenNeVecF32x4(void) { return NeVecF32x4; } +BinaryenOp BinaryenLtVecF32x4(void) { return LtVecF32x4; } +BinaryenOp BinaryenGtVecF32x4(void) { return GtVecF32x4; } +BinaryenOp BinaryenLeVecF32x4(void) { return LeVecF32x4; } +BinaryenOp BinaryenGeVecF32x4(void) { return GeVecF32x4; } +BinaryenOp BinaryenEqVecF64x2(void) { return EqVecF64x2; } +BinaryenOp BinaryenNeVecF64x2(void) { return NeVecF64x2; } +BinaryenOp BinaryenLtVecF64x2(void) { return LtVecF64x2; } +BinaryenOp BinaryenGtVecF64x2(void) { return GtVecF64x2; } +BinaryenOp BinaryenLeVecF64x2(void) { return LeVecF64x2; } +BinaryenOp BinaryenGeVecF64x2(void) { return GeVecF64x2; } +BinaryenOp BinaryenNotVec128(void) { return NotVec128; } +BinaryenOp BinaryenAndVec128(void) { return AndVec128; } +BinaryenOp BinaryenOrVec128(void) { return OrVec128; } +BinaryenOp BinaryenXorVec128(void) { return XorVec128; } +BinaryenOp BinaryenNegVecI8x16(void) { return NegVecI8x16; } +BinaryenOp BinaryenAnyTrueVecI8x16(void) { return AnyTrueVecI8x16; } +BinaryenOp BinaryenAllTrueVecI8x16(void) { return AllTrueVecI8x16; } +BinaryenOp BinaryenShlVecI8x16(void) { return ShlVecI8x16; } +BinaryenOp BinaryenShrSVecI8x16(void) { return ShrSVecI8x16; } +BinaryenOp BinaryenShrUVecI8x16(void) { return ShrUVecI8x16; } +BinaryenOp BinaryenAddVecI8x16(void) { return AddVecI8x16; } +BinaryenOp BinaryenAddSatSVecI8x16(void) { return AddSatSVecI8x16; } +BinaryenOp BinaryenAddSatUVecI8x16(void) { return AddSatUVecI8x16; } +BinaryenOp BinaryenSubVecI8x16(void) { return SubVecI8x16; } +BinaryenOp BinaryenSubSatSVecI8x16(void) { return SubSatSVecI8x16; } +BinaryenOp BinaryenSubSatUVecI8x16(void) { return SubSatUVecI8x16; } +BinaryenOp BinaryenMulVecI8x16(void) { return MulVecI8x16; } +BinaryenOp BinaryenNegVecI16x8(void) { return NegVecI16x8; } +BinaryenOp BinaryenAnyTrueVecI16x8(void) { return AnyTrueVecI16x8; } +BinaryenOp BinaryenAllTrueVecI16x8(void) { return AllTrueVecI16x8; } +BinaryenOp BinaryenShlVecI16x8(void) { return ShlVecI16x8; } +BinaryenOp BinaryenShrSVecI16x8(void) { return ShrSVecI16x8; } +BinaryenOp BinaryenShrUVecI16x8(void) { return ShrUVecI16x8; } +BinaryenOp BinaryenAddVecI16x8(void) { return AddVecI16x8; } +BinaryenOp BinaryenAddSatSVecI16x8(void) { return AddSatSVecI16x8; } +BinaryenOp BinaryenAddSatUVecI16x8(void) { return AddSatUVecI16x8; } +BinaryenOp BinaryenSubVecI16x8(void) { return SubVecI16x8; } +BinaryenOp BinaryenSubSatSVecI16x8(void) { return SubSatSVecI16x8; } +BinaryenOp BinaryenSubSatUVecI16x8(void) { return SubSatUVecI16x8; } +BinaryenOp BinaryenMulVecI16x8(void) { return MulVecI16x8; } +BinaryenOp BinaryenNegVecI32x4(void) { return NegVecI32x4; } +BinaryenOp BinaryenAnyTrueVecI32x4(void) { return AnyTrueVecI32x4; } +BinaryenOp BinaryenAllTrueVecI32x4(void) { return AllTrueVecI32x4; } +BinaryenOp BinaryenShlVecI32x4(void) { return ShlVecI32x4; } +BinaryenOp BinaryenShrSVecI32x4(void) { return ShrSVecI32x4; } +BinaryenOp BinaryenShrUVecI32x4(void) { return ShrUVecI32x4; } +BinaryenOp BinaryenAddVecI32x4(void) { return AddVecI32x4; } +BinaryenOp BinaryenSubVecI32x4(void) { return SubVecI32x4; } +BinaryenOp BinaryenMulVecI32x4(void) { return MulVecI32x4; } +BinaryenOp BinaryenNegVecI64x2(void) { return NegVecI64x2; } +BinaryenOp BinaryenAnyTrueVecI64x2(void) { return AnyTrueVecI64x2; } +BinaryenOp BinaryenAllTrueVecI64x2(void) { return AllTrueVecI64x2; } +BinaryenOp BinaryenShlVecI64x2(void) { return ShlVecI64x2; } +BinaryenOp BinaryenShrSVecI64x2(void) { return ShrSVecI64x2; } +BinaryenOp BinaryenShrUVecI64x2(void) { return ShrUVecI64x2; } +BinaryenOp BinaryenAddVecI64x2(void) { return AddVecI64x2; } +BinaryenOp BinaryenSubVecI64x2(void) { return SubVecI64x2; } +BinaryenOp BinaryenAbsVecF32x4(void) { return AbsVecF32x4; } +BinaryenOp BinaryenNegVecF32x4(void) { return NegVecF32x4; } +BinaryenOp BinaryenSqrtVecF32x4(void) { return SqrtVecF32x4; } +BinaryenOp BinaryenAddVecF32x4(void) { return AddVecF32x4; } +BinaryenOp BinaryenSubVecF32x4(void) { return SubVecF32x4; } +BinaryenOp BinaryenMulVecF32x4(void) { return MulVecF32x4; } +BinaryenOp BinaryenDivVecF32x4(void) { return DivVecF32x4; } +BinaryenOp BinaryenMinVecF32x4(void) { return MinVecF32x4; } +BinaryenOp BinaryenMaxVecF32x4(void) { return MaxVecF32x4; } +BinaryenOp BinaryenAbsVecF64x2(void) { return AbsVecF64x2; } +BinaryenOp BinaryenNegVecF64x2(void) { return NegVecF64x2; } +BinaryenOp BinaryenSqrtVecF64x2(void) { return SqrtVecF64x2; } +BinaryenOp BinaryenAddVecF64x2(void) { return AddVecF64x2; } +BinaryenOp BinaryenSubVecF64x2(void) { return SubVecF64x2; } +BinaryenOp BinaryenMulVecF64x2(void) { return MulVecF64x2; } +BinaryenOp BinaryenDivVecF64x2(void) { return DivVecF64x2; } +BinaryenOp BinaryenMinVecF64x2(void) { return MinVecF64x2; } +BinaryenOp BinaryenMaxVecF64x2(void) { return MaxVecF64x2; } +BinaryenOp BinaryenTruncSatSVecF32x4ToVecI32x4(void) { return TruncSatSVecF32x4ToVecI32x4; } +BinaryenOp BinaryenTruncSatUVecF32x4ToVecI32x4(void) { return TruncSatUVecF32x4ToVecI32x4; } +BinaryenOp BinaryenTruncSatSVecF64x2ToVecI64x2(void) { return TruncSatSVecF64x2ToVecI64x2; } +BinaryenOp BinaryenTruncSatUVecF64x2ToVecI64x2(void) { return TruncSatUVecF64x2ToVecI64x2; } +BinaryenOp BinaryenConvertSVecI32x4ToVecF32x4(void) { return ConvertSVecI32x4ToVecF32x4; } +BinaryenOp BinaryenConvertUVecI32x4ToVecF32x4(void) { return ConvertUVecI32x4ToVecF32x4; } +BinaryenOp BinaryenConvertSVecI64x2ToVecF64x2(void) { return ConvertSVecI64x2ToVecF64x2; } +BinaryenOp BinaryenConvertUVecI64x2ToVecF64x2(void) { return ConvertUVecI64x2ToVecF64x2; } BinaryenExpressionRef BinaryenBlock(BinaryenModuleRef module, const char* name, BinaryenExpressionRef* children, BinaryenIndex numChildren, BinaryenType type) { auto* ret = ((Module*)module)->allocator.alloc(); @@ -864,6 +999,45 @@ BinaryenExpressionRef BinaryenAtomicWake(BinaryenModuleRef module, BinaryenExpre return static_cast(ret); } +BinaryenExpressionRef BinaryenSIMDExtract(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx) { + auto* ret = Builder(*((Module*)module)).makeSIMDExtract(SIMDExtractOp(op), (Expression*) vec, idx); + if (tracing) { + auto id = noteExpression(ret); + std::cout << " expressions[" << id << "] = BinaryenSIMDExtract(the_module, " << op << ", expressions[" << expressions[vec] << "], " << int(idx) << ");\n"; + } + return static_cast(ret); +} +BinaryenExpressionRef BinaryenSIMDReplace(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx, BinaryenExpressionRef value) { + auto* ret = Builder(*((Module*)module)).makeSIMDReplace(SIMDReplaceOp(op), (Expression*) vec, idx, (Expression*)value); + if (tracing) { + auto id = noteExpression(ret); + std::cout << " expressions[" << id << "] = BinaryenSIMDReplace(the_module, " << op << ", expressions[" << expressions[vec] << "], " << int(idx) << ", expression);\n"; + } + return static_cast(ret); +} +BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, uint8_t mask_[16]) { + std::array mask; + memcpy(mask.data(), mask_, 16); + auto* ret = Builder(*((Module*)module)).makeSIMDShuffle((Expression*)left, (Expression*)right, mask); + if (tracing) { + WASM_UNREACHABLE(); + } + return static_cast(ret); +} +BinaryenExpressionRef BinaryenSIMDBitselect(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, BinaryenExpressionRef cond) { + auto* ret = Builder(*((Module*)module)).makeSIMDBitselect((Expression*)left, (Expression*)right, (Expression*)cond); + if (tracing) { + WASM_UNREACHABLE(); + } + return static_cast(ret); +} +BinaryenExpressionRef BinaryenSIMDShift(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, BinaryenExpressionRef shift) { + auto* ret = Builder(*((Module*)module)).makeSIMDShift(SIMDShiftOp(op), (Expression*)vec, (Expression*)shift); + if (tracing) { + WASM_UNREACHABLE(); + } + return static_cast(ret); +} // Expression utility diff --git a/src/binaryen-c.h b/src/binaryen-c.h index d4497be92e3..2623a4b6b1c 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -339,6 +339,141 @@ BinaryenOp BinaryenTruncSatSFloat64ToInt32(void); BinaryenOp BinaryenTruncSatSFloat64ToInt64(void); BinaryenOp BinaryenTruncSatUFloat64ToInt32(void); BinaryenOp BinaryenTruncSatUFloat64ToInt64(void); +BinaryenOp BinaryenSplatVecI8x16(void); +BinaryenOp BinaryenExtractLaneSVecI8x16(void); +BinaryenOp BinaryenExtractLaneUVecI8x16(void); +BinaryenOp BinaryenReplaceLaneVecI8x16(void); +BinaryenOp BinaryenSplatVecI16x8(void); +BinaryenOp BinaryenExtractLaneSVecI16x8(void); +BinaryenOp BinaryenExtractLaneUVecI16x8(void); +BinaryenOp BinaryenReplaceLaneVecI16x8(void); +BinaryenOp BinaryenSplatVecI32x4(void); +BinaryenOp BinaryenExtractLaneVecI32x4(void); +BinaryenOp BinaryenReplaceLaneVecI32x4(void); +BinaryenOp BinaryenSplatVecI64x2(void); +BinaryenOp BinaryenExtractLaneVecI64x2(void); +BinaryenOp BinaryenReplaceLaneVecI64x2(void); +BinaryenOp BinaryenSplatVecF32x4(void); +BinaryenOp BinaryenExtractLaneVecF32x4(void); +BinaryenOp BinaryenReplaceLaneVecF32x4(void); +BinaryenOp BinaryenSplatVecF64x2(void); +BinaryenOp BinaryenExtractLaneVecF64x2(void); +BinaryenOp BinaryenReplaceLaneVecF64x2(void); +BinaryenOp BinaryenEqVecI8x16(void); +BinaryenOp BinaryenNeVecI8x16(void); +BinaryenOp BinaryenLtSVecI8x16(void); +BinaryenOp BinaryenLtUVecI8x16(void); +BinaryenOp BinaryenGtSVecI8x16(void); +BinaryenOp BinaryenGtUVecI8x16(void); +BinaryenOp BinaryenLeSVecI8x16(void); +BinaryenOp BinaryenLeUVecI8x16(void); +BinaryenOp BinaryenGeSVecI8x16(void); +BinaryenOp BinaryenGeUVecI8x16(void); +BinaryenOp BinaryenEqVecI16x8(void); +BinaryenOp BinaryenNeVecI16x8(void); +BinaryenOp BinaryenLtSVecI16x8(void); +BinaryenOp BinaryenLtUVecI16x8(void); +BinaryenOp BinaryenGtSVecI16x8(void); +BinaryenOp BinaryenGtUVecI16x8(void); +BinaryenOp BinaryenLeSVecI16x8(void); +BinaryenOp BinaryenLeUVecI16x8(void); +BinaryenOp BinaryenGeSVecI16x8(void); +BinaryenOp BinaryenGeUVecI16x8(void); +BinaryenOp BinaryenEqVecI32x4(void); +BinaryenOp BinaryenNeVecI32x4(void); +BinaryenOp BinaryenLtSVecI32x4(void); +BinaryenOp BinaryenLtUVecI32x4(void); +BinaryenOp BinaryenGtSVecI32x4(void); +BinaryenOp BinaryenGtUVecI32x4(void); +BinaryenOp BinaryenLeSVecI32x4(void); +BinaryenOp BinaryenLeUVecI32x4(void); +BinaryenOp BinaryenGeSVecI32x4(void); +BinaryenOp BinaryenGeUVecI32x4(void); +BinaryenOp BinaryenEqVecF32x4(void); +BinaryenOp BinaryenNeVecF32x4(void); +BinaryenOp BinaryenLtVecF32x4(void); +BinaryenOp BinaryenGtVecF32x4(void); +BinaryenOp BinaryenLeVecF32x4(void); +BinaryenOp BinaryenGeVecF32x4(void); +BinaryenOp BinaryenEqVecF64x2(void); +BinaryenOp BinaryenNeVecF64x2(void); +BinaryenOp BinaryenLtVecF64x2(void); +BinaryenOp BinaryenGtVecF64x2(void); +BinaryenOp BinaryenLeVecF64x2(void); +BinaryenOp BinaryenGeVecF64x2(void); +BinaryenOp BinaryenNotVec128(void); +BinaryenOp BinaryenAndVec128(void); +BinaryenOp BinaryenOrVec128(void); +BinaryenOp BinaryenXorVec128(void); +BinaryenOp BinaryenNegVecI8x16(void); +BinaryenOp BinaryenAnyTrueVecI8x16(void); +BinaryenOp BinaryenAllTrueVecI8x16(void); +BinaryenOp BinaryenShlVecI8x16(void); +BinaryenOp BinaryenShrSVecI8x16(void); +BinaryenOp BinaryenShrUVecI8x16(void); +BinaryenOp BinaryenAddVecI8x16(void); +BinaryenOp BinaryenAddSatSVecI8x16(void); +BinaryenOp BinaryenAddSatUVecI8x16(void); +BinaryenOp BinaryenSubVecI8x16(void); +BinaryenOp BinaryenSubSatSVecI8x16(void); +BinaryenOp BinaryenSubSatUVecI8x16(void); +BinaryenOp BinaryenMulVecI8x16(void); +BinaryenOp BinaryenNegVecI16x8(void); +BinaryenOp BinaryenAnyTrueVecI16x8(void); +BinaryenOp BinaryenAllTrueVecI16x8(void); +BinaryenOp BinaryenShlVecI16x8(void); +BinaryenOp BinaryenShrSVecI16x8(void); +BinaryenOp BinaryenShrUVecI16x8(void); +BinaryenOp BinaryenAddVecI16x8(void); +BinaryenOp BinaryenAddSatSVecI16x8(void); +BinaryenOp BinaryenAddSatUVecI16x8(void); +BinaryenOp BinaryenSubVecI16x8(void); +BinaryenOp BinaryenSubSatSVecI16x8(void); +BinaryenOp BinaryenSubSatUVecI16x8(void); +BinaryenOp BinaryenMulVecI16x8(void); +BinaryenOp BinaryenNegVecI32x4(void); +BinaryenOp BinaryenAnyTrueVecI32x4(void); +BinaryenOp BinaryenAllTrueVecI32x4(void); +BinaryenOp BinaryenShlVecI32x4(void); +BinaryenOp BinaryenShrSVecI32x4(void); +BinaryenOp BinaryenShrUVecI32x4(void); +BinaryenOp BinaryenAddVecI32x4(void); +BinaryenOp BinaryenSubVecI32x4(void); +BinaryenOp BinaryenMulVecI32x4(void); +BinaryenOp BinaryenNegVecI64x2(void); +BinaryenOp BinaryenAnyTrueVecI64x2(void); +BinaryenOp BinaryenAllTrueVecI64x2(void); +BinaryenOp BinaryenShlVecI64x2(void); +BinaryenOp BinaryenShrSVecI64x2(void); +BinaryenOp BinaryenShrUVecI64x2(void); +BinaryenOp BinaryenAddVecI64x2(void); +BinaryenOp BinaryenSubVecI64x2(void); +BinaryenOp BinaryenAbsVecF32x4(void); +BinaryenOp BinaryenNegVecF32x4(void); +BinaryenOp BinaryenSqrtVecF32x4(void); +BinaryenOp BinaryenAddVecF32x4(void); +BinaryenOp BinaryenSubVecF32x4(void); +BinaryenOp BinaryenMulVecF32x4(void); +BinaryenOp BinaryenDivVecF32x4(void); +BinaryenOp BinaryenMinVecF32x4(void); +BinaryenOp BinaryenMaxVecF32x4(void); +BinaryenOp BinaryenAbsVecF64x2(void); +BinaryenOp BinaryenNegVecF64x2(void); +BinaryenOp BinaryenSqrtVecF64x2(void); +BinaryenOp BinaryenAddVecF64x2(void); +BinaryenOp BinaryenSubVecF64x2(void); +BinaryenOp BinaryenMulVecF64x2(void); +BinaryenOp BinaryenDivVecF64x2(void); +BinaryenOp BinaryenMinVecF64x2(void); +BinaryenOp BinaryenMaxVecF64x2(void); +BinaryenOp BinaryenTruncSatSVecF32x4ToVecI32x4(void); +BinaryenOp BinaryenTruncSatUVecF32x4ToVecI32x4(void); +BinaryenOp BinaryenTruncSatSVecF64x2ToVecI64x2(void); +BinaryenOp BinaryenTruncSatUVecF64x2ToVecI64x2(void); +BinaryenOp BinaryenConvertSVecI32x4ToVecF32x4(void); +BinaryenOp BinaryenConvertUVecI32x4ToVecF32x4(void); +BinaryenOp BinaryenConvertSVecI64x2ToVecF64x2(void); +BinaryenOp BinaryenConvertUVecI64x2ToVecF64x2(void); typedef void* BinaryenExpressionRef; @@ -400,6 +535,11 @@ BinaryenExpressionRef BinaryenAtomicRMW(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef BinaryenAtomicCmpxchg(BinaryenModuleRef module, BinaryenIndex bytes, BinaryenIndex offset, BinaryenExpressionRef ptr, BinaryenExpressionRef expected, BinaryenExpressionRef replacement, BinaryenType type); BinaryenExpressionRef BinaryenAtomicWait(BinaryenModuleRef module, BinaryenExpressionRef ptr, BinaryenExpressionRef expected, BinaryenExpressionRef timeout, BinaryenType type); BinaryenExpressionRef BinaryenAtomicWake(BinaryenModuleRef module, BinaryenExpressionRef ptr, BinaryenExpressionRef wakeCount); +BinaryenExpressionRef BinaryenSIMDExtract(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx); +BinaryenExpressionRef BinaryenSIMDReplace(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx, BinaryenExpressionRef value); +BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, uint8_t mask[16]); +BinaryenExpressionRef BinaryenSIMDBitselect(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, BinaryenExpressionRef cond); +BinaryenExpressionRef BinaryenSIMDShift(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, BinaryenExpressionRef shift); // Gets the id (kind) of the specified expression. BinaryenExpressionId BinaryenExpressionGetId(BinaryenExpressionRef expr); diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 8e6e39feb6d..dccefa14446 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -293,6 +293,47 @@ class Builder { ret->finalize(); return ret; } + SIMDExtract* makeSIMDExtract(SIMDExtractOp op, Expression* vec, uint8_t idx) { + auto* ret = allocator.alloc(); + ret->op = op; + ret->vec = vec; + ret->idx = idx; + ret->finalize(); + return ret; + } + SIMDReplace* makeSIMDReplace(SIMDReplaceOp op, Expression* vec, uint8_t idx, Expression* value) { + auto* ret = allocator.alloc(); + ret->op = op; + ret->vec = vec; + ret->idx = idx; + ret->value = value; + ret->finalize(); + return ret; + } + SIMDShuffle* makeSIMDShuffle(Expression* left, Expression* right, const std::array& mask) { + auto* ret = allocator.alloc(); + ret->left = left; + ret->right = right; + ret->mask = mask; + ret->finalize(); + return ret; + } + SIMDBitselect* makeSIMDBitselect(Expression* left, Expression* right, Expression* cond) { + auto* ret = allocator.alloc(); + ret->left = left; + ret->right = right; + ret->cond = cond; + ret->finalize(); + return ret; + } + SIMDShift* makeSIMDShift(SIMDShiftOp op, Expression* vec, Expression* shift) { + auto* ret = allocator.alloc(); + ret->op = op; + ret->vec = vec; + ret->shift = shift; + ret->finalize(); + return ret; + } Const* makeConst(Literal value) { assert(isConcreteType(value.type)); auto* ret = allocator.alloc(); diff --git a/src/wasm.h b/src/wasm.h index 14ec00aceb2..124ad9ada6b 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -165,11 +165,11 @@ enum BinaryOp { EqFloat64, NeFloat64, // int or float LtFloat64, LeFloat64, GtFloat64, GeFloat64, // float // SIMD relational ops (return vectors) - EqVecI8x16, NeVecI8x16, LtSVecI8x16, LtUVecI8x16, LeSVecI8x16, LeUVecI8x16, GtSVecI8x16, GtUVecI8x16, GeSVecI8x16, GeUVecI8x16, - EqVecI16x8, NeVecI16x8, LtSVecI16x8, LtUVecI16x8, LeSVecI16x8, LeUVecI16x8, GtSVecI16x8, GtUVecI16x8, GeSVecI16x8, GeUVecI16x8, - EqVecI32x4, NeVecI32x4, LtSVecI32x4, LtUVecI32x4, LeSVecI32x4, LeUVecI32x4, GtSVecI32x4, GtUVecI32x4, GeSVecI32x4, GeUVecI32x4, - EqVecF32x4, NeVecF32x4, LtVecF32x4, LeVecF32x4, GtVecF32x4, GeVecF32x4, - EqVecF64x2, NeVecF64x2, LtVecF64x2, LeVecF64x2, GtVecF64x2, GeVecF64x2, + EqVecI8x16, NeVecI8x16, LtSVecI8x16, LtUVecI8x16, GtSVecI8x16, GtUVecI8x16, LeSVecI8x16, LeUVecI8x16, GeSVecI8x16, GeUVecI8x16, + EqVecI16x8, NeVecI16x8, LtSVecI16x8, LtUVecI16x8, GtSVecI16x8, GtUVecI16x8, LeSVecI16x8, LeUVecI16x8, GeSVecI16x8, GeUVecI16x8, + EqVecI32x4, NeVecI32x4, LtSVecI32x4, LtUVecI32x4, GtSVecI32x4, GtUVecI32x4, LeSVecI32x4, LeUVecI32x4, GeSVecI32x4, GeUVecI32x4, + EqVecF32x4, NeVecF32x4, LtVecF32x4, GtVecF32x4, LeVecF32x4, GeVecF32x4, + EqVecF64x2, NeVecF64x2, LtVecF64x2, GtVecF64x2, LeVecF64x2, GeVecF64x2, // SIMD arithmetic AndVec128, OrVec128, XorVec128, AddVecI8x16, AddSatSVecI8x16, AddSatUVecI8x16, SubVecI8x16, SubSatSVecI8x16, SubSatUVecI8x16, MulVecI8x16, From f63b80fd12c0d0f3cfd52ea7fb40ebfcfe967a75 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 11 Dec 2018 12:17:42 -0800 Subject: [PATCH 24/36] Upgrade tracing and finish kitchen sink C tests --- src/binaryen-c.cpp | 112 +- src/binaryen-c.h | 4 +- src/literal.h | 2 +- src/wasm/literal.cpp | 2 +- test/example/c-api-kitchen-sink.c | 184 +- test/example/c-api-kitchen-sink.txt | 4835 +++++++++++++++++------ test/example/c-api-kitchen-sink.txt.txt | 788 ++++ test/simd.wast.fromBinary | 32 +- test/simd.wast.fromBinary.noDebugInfo | 32 +- 9 files changed, 4805 insertions(+), 1186 deletions(-) diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 9507b2bc2bd..160ccc548b4 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -86,9 +86,9 @@ static PassOptions globalPassOptions = PassOptions::getWithDefaultOptimizationOp static int tracing = 0; -void traceNameOrNULL(const char* name) { - if (name) std::cout << "\"" << name << "\""; - else std::cout << "NULL"; +void traceNameOrNULL(const char* name, std::ostream &out = std::cout) { + if (name) out << "\"" << name << "\""; + else out << "NULL"; } std::map functionTypes; @@ -105,14 +105,19 @@ size_t noteExpression(BinaryenExpressionRef expression) { return id; } +std::string getTemp() { + static size_t n = 0; + return "t" + std::to_string(n++); +} + template -void printArg(T arg) { - std::cout << arg; +void printArg(std::ostream &setup, std::ostream& out, T arg) { + out << arg; } template<> -void printArg(void* arg) { - std::cout << "expressions[" << expressions[arg] << "]"; +void printArg(std::ostream &setup, std::ostream& out, BinaryenExpressionRef arg) { + out << "expressions[" << expressions[arg] << "]"; } struct StringLit { @@ -121,60 +126,83 @@ struct StringLit { }; template<> -void printArg(StringLit arg) { - traceNameOrNULL(arg.name); +void printArg(std::ostream &setup, std::ostream& out, StringLit arg) { + traceNameOrNULL(arg.name, out); } template<> -void printArg(BinaryenType arg) { +void printArg(std::ostream &setup, std::ostream &out, BinaryenType arg) { if (arg == BinaryenTypeAuto()) { - std::cout << "BinaryenTypeAuto()"; + out << "BinaryenTypeAuto()"; } else { - std::cout << arg; + out << arg; } } template<> -void printArg(BinaryenLiteral arg) { +void printArg(std::ostream &setup, std::ostream &out, BinaryenLiteral arg) { switch (arg.type) { - case Type::i32: std::cout << "BinaryenLiteralInt32(" << arg.i32 << ")"; break; - case Type::i64: std::cout << "BinaryenLiteralInt64(" << arg.i64 << ")"; break; + case Type::i32: out << "BinaryenLiteralInt32(" << arg.i32 << ")"; break; + case Type::i64: out << "BinaryenLiteralInt64(" << arg.i64 << ")"; break; case Type::f32: if (std::isnan(arg.f32)) { - std::cout << "BinaryenLiteralFloat32(NAN)"; break; + out << "BinaryenLiteralFloat32(NAN)"; break; } else { - std::cout << "BinaryenLiteralFloat32(" << arg.f32 << ")"; break; + out << "BinaryenLiteralFloat32(" << arg.f32 << ")"; break; } case Type::f64: if (std::isnan(arg.f64)) { - std::cout << "BinaryenLiteralFloat64(NAN)"; break; + out << "BinaryenLiteralFloat64(NAN)"; break; } else { - std::cout << "BinaryenLiteralFloat64(" << arg.f64 << ")"; break; + out << "BinaryenLiteralFloat64(" << arg.f64 << ")"; break; } - case Type::v128: + case Type::v128: { + std::string array = getTemp(); + setup << "uint8_t " << array << "[] = {"; + for (size_t i = 0; i < 16; ++i) { + setup << int(arg.v128[i]); + if (i < 15) { + setup << ", "; + } + } + setup << "};\n"; + out << "BinaryenLiteralVec128(" << array << ")"; + break; + } case Type::none: case Type::unreachable: WASM_UNREACHABLE(); } } template -void traceArgs(T arg) { - printArg(arg); +void traceArgs(std::ostream &setup, std::ostream &out, T arg) { + printArg(setup, out, arg); } template -void traceArgs(T arg, S next, Ts... rest) { - printArg(arg); - std::cout << ", "; - traceArgs(next, rest...); +void traceArgs(std::ostream &setup, std::ostream &out, T arg, S next, Ts... rest) { + printArg(setup, out, arg); + out << ", "; + traceArgs(setup, out, next, rest...); } template void traceExpression(BinaryenExpressionRef expr, const char* constructor, Ts... args) { auto id = noteExpression(expr); - std::cout << " expressions[" << id << "] = " << constructor << "("; - traceArgs("the_module", args...); - std::cout << ");\n"; + std::stringstream setup, out; + out << "expressions[" << id << "] = " << constructor << "("; + traceArgs(setup, out, "the_module", args...); + out << ");\n"; + if (!setup.str().empty()) { + std::cout << " {\n"; + for (std::string line; getline(setup, line);) { + std::cout << " " << line << "\n"; + } + std::cout << " " << out.str(); + std::cout << " }\n"; + } else { + std::cout << " " << out.str(); + } } extern "C" { @@ -334,7 +362,7 @@ BinaryenLiteral BinaryenLiteralInt32(int32_t x) { return toBinaryenLiteral(Liter BinaryenLiteral BinaryenLiteralInt64(int64_t x) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralFloat32(float x) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralFloat64(double x) { return toBinaryenLiteral(Literal(x)); } -BinaryenLiteral BinaryenLiteralVec128(uint8_t x[16]) { return toBinaryenLiteral(Literal(x)); } +BinaryenLiteral BinaryenLiteralVec128(const uint8_t x[16]) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralFloat32Bits(int32_t x) { return toBinaryenLiteral(Literal(x).castToF32()); } BinaryenLiteral BinaryenLiteralFloat64Bits(int64_t x) { return toBinaryenLiteral(Literal(x).castToF64()); } @@ -1002,39 +1030,47 @@ BinaryenExpressionRef BinaryenAtomicWake(BinaryenModuleRef module, BinaryenExpre BinaryenExpressionRef BinaryenSIMDExtract(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx) { auto* ret = Builder(*((Module*)module)).makeSIMDExtract(SIMDExtractOp(op), (Expression*) vec, idx); if (tracing) { - auto id = noteExpression(ret); - std::cout << " expressions[" << id << "] = BinaryenSIMDExtract(the_module, " << op << ", expressions[" << expressions[vec] << "], " << int(idx) << ");\n"; + traceExpression(ret, "BinaryenSIMDExtract", op, vec, int(idx)); } return static_cast(ret); } BinaryenExpressionRef BinaryenSIMDReplace(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx, BinaryenExpressionRef value) { auto* ret = Builder(*((Module*)module)).makeSIMDReplace(SIMDReplaceOp(op), (Expression*) vec, idx, (Expression*)value); if (tracing) { - auto id = noteExpression(ret); - std::cout << " expressions[" << id << "] = BinaryenSIMDReplace(the_module, " << op << ", expressions[" << expressions[vec] << "], " << int(idx) << ", expression);\n"; + traceExpression(ret, "BinaryenSIMDReplace", op, vec, int(idx), value); } return static_cast(ret); } -BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, uint8_t mask_[16]) { +BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, const uint8_t mask_[16]) { std::array mask; memcpy(mask.data(), mask_, 16); auto* ret = Builder(*((Module*)module)).makeSIMDShuffle((Expression*)left, (Expression*)right, mask); if (tracing) { - WASM_UNREACHABLE(); + std::cout << " {\n"; + std::cout << " uint8_t mask[] = {"; + for (size_t i = 0; i < mask.size(); ++i) { + std::cout << int(mask[i]); + if (i < mask.size() - 1) { + std::cout << ", "; + } + } + std::cout << "};\n "; + traceExpression(ret, "BinaryenSIMDShuffle", left, right, "mask"); + std::cout << " }\n"; } return static_cast(ret); } BinaryenExpressionRef BinaryenSIMDBitselect(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, BinaryenExpressionRef cond) { auto* ret = Builder(*((Module*)module)).makeSIMDBitselect((Expression*)left, (Expression*)right, (Expression*)cond); if (tracing) { - WASM_UNREACHABLE(); + traceExpression(ret, "BinaryenSIMDBitselect", left, right, cond); } return static_cast(ret); } BinaryenExpressionRef BinaryenSIMDShift(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, BinaryenExpressionRef shift) { auto* ret = Builder(*((Module*)module)).makeSIMDShift(SIMDShiftOp(op), (Expression*)vec, (Expression*)shift); if (tracing) { - WASM_UNREACHABLE(); + traceExpression(ret, "BinaryenSIMDShift", op, vec, shift); } return static_cast(ret); } diff --git a/src/binaryen-c.h b/src/binaryen-c.h index 2623a4b6b1c..290ab420823 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -179,7 +179,7 @@ struct BinaryenLiteral BinaryenLiteralInt32(int32_t x); struct BinaryenLiteral BinaryenLiteralInt64(int64_t x); struct BinaryenLiteral BinaryenLiteralFloat32(float x); struct BinaryenLiteral BinaryenLiteralFloat64(double x); -struct BinaryenLiteral BinaryenLiteralVec128(uint8_t x[16]); +struct BinaryenLiteral BinaryenLiteralVec128(const uint8_t x[16]); struct BinaryenLiteral BinaryenLiteralFloat32Bits(int32_t x); struct BinaryenLiteral BinaryenLiteralFloat64Bits(int64_t x); @@ -537,7 +537,7 @@ BinaryenExpressionRef BinaryenAtomicWait(BinaryenModuleRef module, BinaryenExpre BinaryenExpressionRef BinaryenAtomicWake(BinaryenModuleRef module, BinaryenExpressionRef ptr, BinaryenExpressionRef wakeCount); BinaryenExpressionRef BinaryenSIMDExtract(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx); BinaryenExpressionRef BinaryenSIMDReplace(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, uint8_t idx, BinaryenExpressionRef value); -BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, uint8_t mask[16]); +BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, const uint8_t mask[16]); BinaryenExpressionRef BinaryenSIMDBitselect(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, BinaryenExpressionRef cond); BinaryenExpressionRef BinaryenSIMDShift(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, BinaryenExpressionRef shift); diff --git a/src/literal.h b/src/literal.h index c84cf3a61cb..c545e3df571 100644 --- a/src/literal.h +++ b/src/literal.h @@ -48,7 +48,7 @@ class Literal { explicit Literal(uint64_t init) : type(Type::i64), i64(init) {} explicit Literal(float init) : type(Type::f32), i32(bit_cast(init)) {} explicit Literal(double init) : type(Type::f64), i64(bit_cast(init)) {} - explicit Literal(uint8_t init[16]); + explicit Literal(const uint8_t init[16]); explicit Literal(const std::array&); explicit Literal(const std::array&); explicit Literal(const std::array&); diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 8cf4c679150..d1b021a5185 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -31,7 +31,7 @@ namespace wasm { template using LaneArray = std::array; -Literal::Literal(uint8_t init[16]) : type(Type::v128) { +Literal::Literal(const uint8_t init[16]) : type(Type::v128) { memcpy(&v128, init, 16); } diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index d056d0e759a..f9b107e3145 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -15,11 +15,14 @@ // helpers +static const uint8_t v128_bytes[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + BinaryenExpressionRef makeUnary(BinaryenModuleRef module, BinaryenOp op, BinaryenType inputType) { if (inputType == BinaryenTypeInt32()) return BinaryenUnary(module, op, BinaryenConst(module, BinaryenLiteralInt32(-10))); if (inputType == BinaryenTypeInt64()) return BinaryenUnary(module, op, BinaryenConst(module, BinaryenLiteralInt64(-22))); if (inputType == BinaryenTypeFloat32()) return BinaryenUnary(module, op, BinaryenConst(module, BinaryenLiteralFloat32(-33.612f))); if (inputType == BinaryenTypeFloat64()) return BinaryenUnary(module, op, BinaryenConst(module, BinaryenLiteralFloat64(-9005.841))); + if (inputType == BinaryenTypeVec128()) return BinaryenUnary(module, op, BinaryenConst(module, BinaryenLiteralVec128(v128_bytes))); abort(); } @@ -41,6 +44,10 @@ BinaryenExpressionRef makeBinary(BinaryenModuleRef module, BinaryenOp op, Binary BinaryenExpressionRef temp = BinaryenConst(module, BinaryenLiteralFloat64(-9007.333)); return BinaryenBinary(module, op, BinaryenConst(module, BinaryenLiteralFloat64(-9005.841)), temp); } + if (type == BinaryenTypeVec128()) { + BinaryenExpressionRef temp = BinaryenConst(module, BinaryenLiteralVec128(v128_bytes)); + return BinaryenBinary(module, op, BinaryenConst(module, BinaryenLiteralVec128(v128_bytes)), temp); + } abort(); } @@ -60,6 +67,10 @@ BinaryenExpressionRef makeFloat64(BinaryenModuleRef module, double x) { return BinaryenConst(module, BinaryenLiteralFloat64(x)); } +BinaryenExpressionRef makeVec128(BinaryenModuleRef module, uint8_t const *bytes) { + return BinaryenConst(module, BinaryenLiteralVec128(bytes)); +} + BinaryenExpressionRef makeSomething(BinaryenModuleRef module) { return makeInt32(module, 1337); } @@ -68,6 +79,34 @@ BinaryenExpressionRef makeDroppedInt32(BinaryenModuleRef module, int x) { return BinaryenDrop(module, BinaryenConst(module, BinaryenLiteralInt32(x))); } +BinaryenExpressionRef makeSIMDExtract(BinaryenModuleRef module, BinaryenOp op) { + return BinaryenSIMDExtract(module, op, makeVec128(module, v128_bytes), 0); +} + +BinaryenExpressionRef makeSIMDReplace(BinaryenModuleRef module, BinaryenOp op, BinaryenType type) { + BinaryenExpressionRef val; + if (type == BinaryenTypeInt32()) { + val = makeInt32(module, 42); + } + if (type == BinaryenTypeInt64()) { + val = makeInt64(module, 42); + } + if (type == BinaryenTypeFloat32()) { + val = makeFloat32(module, 42.); + } + if (type == BinaryenTypeFloat64()) { + val = makeFloat64(module, 42.); + } + if (!val) { + abort(); + } + return BinaryenSIMDReplace(module, op, makeVec128(module, v128_bytes), 0, val); +} + +BinaryenExpressionRef makeSIMDShift(BinaryenModuleRef module, BinaryenOp op) { + return BinaryenSIMDShift(module, op, makeVec128(module, v128_bytes), makeInt32(module, 1)); +} + // tests void test_types() { @@ -89,12 +128,14 @@ void test_core() { // Literals and consts + BinaryenExpressionRef constI32 = BinaryenConst(module, BinaryenLiteralInt32(1)), constI64 = BinaryenConst(module, BinaryenLiteralInt64(2)), constF32 = BinaryenConst(module, BinaryenLiteralFloat32(3.14f)), constF64 = BinaryenConst(module, BinaryenLiteralFloat64(2.1828)), constF32Bits = BinaryenConst(module, BinaryenLiteralFloat32Bits(0xffff1234)), - constF64Bits = BinaryenConst(module, BinaryenLiteralFloat64Bits(0xffff12345678abcdLL)); + constF64Bits = BinaryenConst(module, BinaryenLiteralFloat64Bits(0xffff12345678abcdLL)), + constV128 = BinaryenConst(module, BinaryenLiteralVec128(v128_bytes)); const char* switchValueNames[] = { "the-value" }; const char* switchBodyNames[] = { "the-nothing" }; @@ -160,6 +201,39 @@ void test_core() { makeUnary(module, BinaryenDemoteFloat64(), 4), makeUnary(module, BinaryenReinterpretInt32(), 1), makeUnary(module, BinaryenReinterpretInt64(), 2), + makeUnary(module, BinaryenSplatVecI8x16(), 1), + makeUnary(module, BinaryenSplatVecI16x8(), 1), + makeUnary(module, BinaryenSplatVecI32x4(), 1), + makeUnary(module, BinaryenSplatVecI64x2(), 2), + makeUnary(module, BinaryenSplatVecF32x4(), 3), + makeUnary(module, BinaryenSplatVecF64x2(), 4), + makeUnary(module, BinaryenNotVec128(), 5), + makeUnary(module, BinaryenNegVecI8x16(), 5), + makeUnary(module, BinaryenAnyTrueVecI8x16(), 5), + makeUnary(module, BinaryenAllTrueVecI8x16(), 5), + makeUnary(module, BinaryenNegVecI16x8(), 5), + makeUnary(module, BinaryenAnyTrueVecI16x8(), 5), + makeUnary(module, BinaryenAllTrueVecI16x8(), 5), + makeUnary(module, BinaryenNegVecI32x4(), 5), + makeUnary(module, BinaryenAnyTrueVecI32x4(), 5), + makeUnary(module, BinaryenAllTrueVecI32x4(), 5), + makeUnary(module, BinaryenNegVecI64x2(), 5), + makeUnary(module, BinaryenAnyTrueVecI64x2(), 5), + makeUnary(module, BinaryenAllTrueVecI64x2(), 5), + makeUnary(module, BinaryenAbsVecF32x4(), 5), + makeUnary(module, BinaryenNegVecF32x4(), 5), + makeUnary(module, BinaryenSqrtVecF32x4(), 5), + makeUnary(module, BinaryenAbsVecF64x2(), 5), + makeUnary(module, BinaryenNegVecF64x2(), 5), + makeUnary(module, BinaryenSqrtVecF64x2(), 5), + makeUnary(module, BinaryenTruncSatSVecF32x4ToVecI32x4(), 5), + makeUnary(module, BinaryenTruncSatUVecF32x4ToVecI32x4(), 5), + makeUnary(module, BinaryenTruncSatSVecF64x2ToVecI64x2(), 5), + makeUnary(module, BinaryenTruncSatUVecF64x2ToVecI64x2(), 5), + makeUnary(module, BinaryenConvertSVecI32x4ToVecF32x4(), 5), + makeUnary(module, BinaryenConvertUVecI32x4ToVecF32x4(), 5), + makeUnary(module, BinaryenConvertSVecI64x2ToVecF64x2(), 5), + makeUnary(module, BinaryenConvertUVecI64x2ToVecF64x2(), 5), // Binary makeBinary(module, BinaryenAddInt32(), 1), makeBinary(module, BinaryenSubFloat64(), 4), @@ -193,6 +267,114 @@ void test_core() { makeBinary(module, BinaryenLeFloat64(), 4), makeBinary(module, BinaryenGtFloat64(), 4), makeBinary(module, BinaryenGeFloat32(), 3), + makeBinary(module, BinaryenEqVecI8x16(), 5), + makeBinary(module, BinaryenNeVecI8x16(), 5), + makeBinary(module, BinaryenLtSVecI8x16(), 5), + makeBinary(module, BinaryenLtUVecI8x16(), 5), + makeBinary(module, BinaryenGtSVecI8x16(), 5), + makeBinary(module, BinaryenGtUVecI8x16(), 5), + makeBinary(module, BinaryenLeSVecI8x16(), 5), + makeBinary(module, BinaryenLeUVecI8x16(), 5), + makeBinary(module, BinaryenGeSVecI8x16(), 5), + makeBinary(module, BinaryenGeUVecI8x16(), 5), + makeBinary(module, BinaryenEqVecI16x8(), 5), + makeBinary(module, BinaryenNeVecI16x8(), 5), + makeBinary(module, BinaryenLtSVecI16x8(), 5), + makeBinary(module, BinaryenLtUVecI16x8(), 5), + makeBinary(module, BinaryenGtSVecI16x8(), 5), + makeBinary(module, BinaryenGtUVecI16x8(), 5), + makeBinary(module, BinaryenLeSVecI16x8(), 5), + makeBinary(module, BinaryenLeUVecI16x8(), 5), + makeBinary(module, BinaryenGeSVecI16x8(), 5), + makeBinary(module, BinaryenGeUVecI16x8(), 5), + makeBinary(module, BinaryenEqVecI32x4(), 5), + makeBinary(module, BinaryenNeVecI32x4(), 5), + makeBinary(module, BinaryenLtSVecI32x4(), 5), + makeBinary(module, BinaryenLtUVecI32x4(), 5), + makeBinary(module, BinaryenGtSVecI32x4(), 5), + makeBinary(module, BinaryenGtUVecI32x4(), 5), + makeBinary(module, BinaryenLeSVecI32x4(), 5), + makeBinary(module, BinaryenLeUVecI32x4(), 5), + makeBinary(module, BinaryenGeSVecI32x4(), 5), + makeBinary(module, BinaryenGeUVecI32x4(), 5), + makeBinary(module, BinaryenEqVecF32x4(), 5), + makeBinary(module, BinaryenNeVecF32x4(), 5), + makeBinary(module, BinaryenLtVecF32x4(), 5), + makeBinary(module, BinaryenGtVecF32x4(), 5), + makeBinary(module, BinaryenLeVecF32x4(), 5), + makeBinary(module, BinaryenGeVecF32x4(), 5), + makeBinary(module, BinaryenEqVecF64x2(), 5), + makeBinary(module, BinaryenNeVecF64x2(), 5), + makeBinary(module, BinaryenLtVecF64x2(), 5), + makeBinary(module, BinaryenGtVecF64x2(), 5), + makeBinary(module, BinaryenLeVecF64x2(), 5), + makeBinary(module, BinaryenGeVecF64x2(), 5), + makeBinary(module, BinaryenAndVec128(), 5), + makeBinary(module, BinaryenOrVec128(), 5), + makeBinary(module, BinaryenXorVec128(), 5), + makeBinary(module, BinaryenAddVecI8x16(), 5), + makeBinary(module, BinaryenAddSatSVecI8x16(), 5), + makeBinary(module, BinaryenAddSatUVecI8x16(), 5), + makeBinary(module, BinaryenSubVecI8x16(), 5), + makeBinary(module, BinaryenSubSatSVecI8x16(), 5), + makeBinary(module, BinaryenSubSatUVecI8x16(), 5), + makeBinary(module, BinaryenMulVecI8x16(), 5), + makeBinary(module, BinaryenAddVecI16x8(), 5), + makeBinary(module, BinaryenAddSatSVecI16x8(), 5), + makeBinary(module, BinaryenAddSatUVecI16x8(), 5), + makeBinary(module, BinaryenSubVecI16x8(), 5), + makeBinary(module, BinaryenSubSatSVecI16x8(), 5), + makeBinary(module, BinaryenSubSatUVecI16x8(), 5), + makeBinary(module, BinaryenMulVecI16x8(), 5), + makeBinary(module, BinaryenAddVecI32x4(), 5), + makeBinary(module, BinaryenSubVecI32x4(), 5), + makeBinary(module, BinaryenMulVecI32x4(), 5), + makeBinary(module, BinaryenAddVecI64x2(), 5), + makeBinary(module, BinaryenSubVecI64x2(), 5), + makeBinary(module, BinaryenAddVecF32x4(), 5), + makeBinary(module, BinaryenSubVecF32x4(), 5), + makeBinary(module, BinaryenMulVecF32x4(), 5), + makeBinary(module, BinaryenDivVecF32x4(), 5), + makeBinary(module, BinaryenMinVecF32x4(), 5), + makeBinary(module, BinaryenMaxVecF32x4(), 5), + makeBinary(module, BinaryenAddVecF64x2(), 5), + makeBinary(module, BinaryenSubVecF64x2(), 5), + makeBinary(module, BinaryenMulVecF64x2(), 5), + makeBinary(module, BinaryenDivVecF64x2(), 5), + makeBinary(module, BinaryenMinVecF64x2(), 5), + makeBinary(module, BinaryenMaxVecF64x2(), 5), + // SIMD lane manipulation + makeSIMDExtract(module, BinaryenExtractLaneSVecI8x16()), + makeSIMDExtract(module, BinaryenExtractLaneUVecI8x16()), + makeSIMDExtract(module, BinaryenExtractLaneSVecI16x8()), + makeSIMDExtract(module, BinaryenExtractLaneUVecI16x8()), + makeSIMDExtract(module, BinaryenExtractLaneVecI32x4()), + makeSIMDExtract(module, BinaryenExtractLaneVecI64x2()), + makeSIMDExtract(module, BinaryenExtractLaneVecF32x4()), + makeSIMDExtract(module, BinaryenExtractLaneVecF64x2()), + makeSIMDReplace(module, BinaryenReplaceLaneVecI8x16(), 1), + makeSIMDReplace(module, BinaryenReplaceLaneVecI16x8(), 1), + makeSIMDReplace(module, BinaryenReplaceLaneVecI32x4(), 1), + makeSIMDReplace(module, BinaryenReplaceLaneVecI64x2(), 2), + makeSIMDReplace(module, BinaryenReplaceLaneVecF32x4(), 3), + makeSIMDReplace(module, BinaryenReplaceLaneVecF64x2(), 4), + // SIMD shift + makeSIMDShift(module, BinaryenShlVecI8x16()), + makeSIMDShift(module, BinaryenShrSVecI8x16()), + makeSIMDShift(module, BinaryenShrUVecI8x16()), + makeSIMDShift(module, BinaryenShlVecI16x8()), + makeSIMDShift(module, BinaryenShrSVecI16x8()), + makeSIMDShift(module, BinaryenShrUVecI16x8()), + makeSIMDShift(module, BinaryenAddVecI16x8()), + makeSIMDShift(module, BinaryenShlVecI32x4()), + makeSIMDShift(module, BinaryenShrSVecI32x4()), + makeSIMDShift(module, BinaryenShrUVecI32x4()), + makeSIMDShift(module, BinaryenShlVecI64x2()), + makeSIMDShift(module, BinaryenShrSVecI64x2()), + makeSIMDShift(module, BinaryenShrUVecI64x2()), + // Other SIMD + BinaryenSIMDShuffle(module, makeVec128(module, v128_bytes), makeVec128(module, v128_bytes), (uint8_t[16]) {}), + BinaryenSIMDBitselect(module, makeVec128(module, v128_bytes), makeVec128(module, v128_bytes), makeVec128(module, v128_bytes)), // All the rest BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type BinaryenIf(module, temp1, temp2, temp3), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 600efb4ddd4..4132e5228b7 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -250,6 +250,171 @@ BinaryenTypeAuto: -1 (i64.const -22) ) ) + (drop + (i8x16.splat + (i32.const -10) + ) + ) + (drop + (i16x8.splat + (i32.const -10) + ) + ) + (drop + (i32x4.splat + (i32.const -10) + ) + ) + (drop + (i64x2.splat + (i64.const -22) + ) + ) + (drop + (f32x4.splat + (f32.const -33.61199951171875) + ) + ) + (drop + (f64x2.splat + (f64.const -9005.841) + ) + ) + (drop + (v128.not + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_s/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_u/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_s/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_u/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_s/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_u/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_s/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_u/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) (drop (i32.add (i32.const -10) @@ -442,1463 +607,3911 @@ BinaryenTypeAuto: -1 (f32.const -62.5) ) ) - (block + (drop + (i8x16.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (if - (i32.const 1) - (drop - (i32.const 2) + (drop + (i8x16.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (drop - (i32.const 3) + ) + (drop + (i8x16.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (if - (i32.const 4) - (drop - (i32.const 5) + (drop + (i8x16.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (loop $in (result i32) - (i32.const 0) + (i8x16.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (loop (result i32) - (i32.const 0) + (i8x16.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (br_if $the-value - (i32.const 1) - (i32.const 0) + (i8x16.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (br_if $the-nothing - (i32.const 2) + (drop + (i8x16.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br $the-value - (i32.const 3) + (drop + (i8x16.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br $the-nothing) - (br_table $the-value $the-value - (i32.const 1) - (i32.const 0) + (drop + (i8x16.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br_table $the-nothing $the-nothing - (i32.const 2) + (drop + (i16x8.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) (drop - (i32.eqz - (call "$kitchen()sinker" - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) + (i16x8.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eqz - (i32.trunc_s/f32 - (call $an-imported - (i32.const 13) - (f64.const 3.7) - ) - ) + (i16x8.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eqz - (call_indirect (type $iiIfF) - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - (i32.const 2449) - ) + (i16x8.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (get_local $0) + (i16x8.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (set_local $0 - (i32.const 101) + (drop + (i16x8.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) (drop - (tee_local $0 - (i32.const 102) + (i16x8.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.load - (i32.const 1) + (i16x8.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.load16_s offset=2 align=1 - (i32.const 8) + (i16x8.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.load - (i32.const 2) + (i16x8.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.load offset=2 - (i32.const 9) + (i32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (i32.store - (i32.const 10) - (i32.const 11) + (drop + (i32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (i64.store offset=2 align=4 - (i32.const 110) - (i64.const 111) + (drop + (i32x4.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) (drop - (select - (i32.const 3) - (i32.const 5) - (i32.const 1) + (i32x4.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (return - (i32.const 1337) + (drop + (i32x4.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (nop) - (unreachable) - ) - ) - ) - (i32.const 42) - ) - ) - (func $starter (; 2 ;) (type $v) - (nop) - ) -) -(module - (type $i (func (result i32))) - (type $I (func (result i64))) - (func $unreachable-fn (; 0 ;) (type $i) (result i32) - (call_indirect (type $I) - (unreachable) - ) - ) -) -raw: -(module - (type $v (func)) - (type $vi (func (param i32))) - (type $i (func (result i32))) - (import "module" "check" (func $check (param i32))) - (func $just-one-block (; 1 ;) (type $v) - (local $0 i32) - (call $check - (i32.const 1337) - ) - ) - (func $two-blocks (; 2 ;) (type $v) - (local $0 i32) - (block - (call $check - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - ) - ) - (func $two-blocks-plus-code (; 3 ;) (type $v) - (local $0 i32) - (block - (block - (call $check - (i32.const 0) - ) - (drop - (i32.const 77) + (drop + (i32x4.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.and + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.or + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.xor + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.extract_lane_s 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.extract_lane_u 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.extract_lane_s 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.extract_lane_u 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i16x8.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i32x4.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i64x2.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i64.const 42) + ) + ) + (drop + (f32x4.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f32.const 42) + ) + ) + (drop + (f64x2.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f64.const 42) + ) + ) + (drop + (i8x16.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (v8x16.shuffle 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.bitselect + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (block + ) + (if + (i32.const 1) + (drop + (i32.const 2) + ) + (drop + (i32.const 3) + ) + ) + (if + (i32.const 4) + (drop + (i32.const 5) + ) + ) + (drop + (loop $in (result i32) + (i32.const 0) + ) + ) + (drop + (loop (result i32) + (i32.const 0) + ) + ) + (drop + (br_if $the-value + (i32.const 1) + (i32.const 0) + ) + ) + (br_if $the-nothing + (i32.const 2) + ) + (br $the-value + (i32.const 3) + ) + (br $the-nothing) + (br_table $the-value $the-value + (i32.const 1) + (i32.const 0) + ) + (br_table $the-nothing $the-nothing + (i32.const 2) + ) + (drop + (i32.eqz + (call "$kitchen()sinker" + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + ) + ) + ) + (drop + (i32.eqz + (i32.trunc_s/f32 + (call $an-imported + (i32.const 13) + (f64.const 3.7) + ) + ) + ) + ) + (drop + (i32.eqz + (call_indirect (type $iiIfF) + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + (i32.const 2449) + ) + ) + ) + (drop + (get_local $0) + ) + (set_local $0 + (i32.const 101) + ) + (drop + (tee_local $0 + (i32.const 102) + ) + ) + (drop + (i32.load + (i32.const 1) + ) + ) + (drop + (i64.load16_s offset=2 align=1 + (i32.const 8) + ) + ) + (drop + (f32.load + (i32.const 2) + ) + ) + (drop + (f64.load offset=2 + (i32.const 9) + ) + ) + (i32.store + (i32.const 10) + (i32.const 11) + ) + (i64.store offset=2 align=4 + (i32.const 110) + (i64.const 111) + ) + (drop + (select + (i32.const 3) + (i32.const 5) + (i32.const 1) + ) + ) + (return + (i32.const 1337) + ) + (nop) + (unreachable) + ) + ) + ) + (i32.const 42) + ) + ) + (func $starter (; 2 ;) (type $v) + (nop) + ) +) +(module + (type $i (func (result i32))) + (type $I (func (result i64))) + (func $unreachable-fn (; 0 ;) (type $i) (result i32) + (call_indirect (type $I) + (unreachable) + ) + ) +) +raw: +(module + (type $v (func)) + (type $vi (func (param i32))) + (type $i (func (result i32))) + (import "module" "check" (func $check (param i32))) + (func $just-one-block (; 1 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 1337) + ) + ) + (func $two-blocks (; 2 ;) (type $v) + (local $0 i32) + (block + (call $check + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + ) + ) + (func $two-blocks-plus-code (; 3 ;) (type $v) + (local $0 i32) + (block + (block + (call $check + (i32.const 0) + ) + (drop + (i32.const 77) + ) + ) + (call $check + (i32.const 1) + ) + ) + ) + (func $loop (; 4 ;) (type $v) + (local $0 i32) + (loop $shape$0$continue + (block + (call $check + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + ) + (block + (br $shape$0$continue) + ) + ) + ) + (func $loop-plus-code (; 5 ;) (type $v) + (local $0 i32) + (loop $shape$0$continue + (block + (block + (call $check + (i32.const 0) + ) + (drop + (i32.const 33) + ) + ) + (call $check + (i32.const 1) + ) + ) + (block + (drop + (i32.const -66) + ) + (br $shape$0$continue) + ) + ) + ) + (func $split (; 6 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (call $check + (i32.const 1) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + ) + (func $split-plus-code (; 7 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (drop + (i32.const 10) + ) + (block + (call $check + (i32.const 1) + ) + ) + ) + (block + (drop + (i32.const 20) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + ) + ) + (func $if (; 8 ;) (type $v) + (local $0 i32) + (block $block$3$break + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (call $check + (i32.const 1) + ) + (block + (br $block$3$break) + ) + ) + (br $block$3$break) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + (func $if-plus-code (; 9 ;) (type $v) + (local $0 i32) + (block $block$3$break + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (drop + (i32.const -1) + ) + (block + (call $check + (i32.const 1) + ) + (block + (drop + (i32.const -3) + ) + (br $block$3$break) + ) + ) + ) + (block + (drop + (i32.const -2) + ) + (br $block$3$break) + ) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + (func $if-else (; 10 ;) (type $v) + (local $0 i32) + (block $block$4$break + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (call $check + (i32.const 1) + ) + (block + (br $block$4$break) + ) + ) + (block + (call $check + (i32.const 2) + ) + (block + (br $block$4$break) + ) ) ) + ) + (block (call $check - (i32.const 1) + (i32.const 3) ) ) ) - (func $loop (; 4 ;) (type $v) + (func $loop-tail (; 11 ;) (type $v) (local $0 i32) - (loop $shape$0$continue - (block - (call $check - (i32.const 0) + (block $block$3$break + (loop $shape$0$continue + (block + (call $check + (i32.const 0) + ) + (call $check + (i32.const 1) + ) ) - (call $check - (i32.const 1) + (if + (i32.const 10) + (br $shape$0$continue) + (br $block$3$break) ) ) - (block - (br $shape$0$continue) + ) + (block + (call $check + (i32.const 2) ) ) ) - (func $loop-plus-code (; 5 ;) (type $v) + (func $nontrivial-loop-plus-phi-to-head (; 12 ;) (type $v) (local $0 i32) - (loop $shape$0$continue + (block $block$2$break + (call $check + (i32.const 0) + ) (block + (drop + (i32.const 10) + ) + (br $block$2$break) + ) + ) + (block + (block $block$7$break + (block $block$4$break + (loop $shape$1$continue + (block $block$3$break + (call $check + (i32.const 1) + ) + (if + (i32.const -2) + (br $block$3$break) + (block + (drop + (i32.const 20) + ) + (br $block$7$break) + ) + ) + ) + (block + (call $check + (i32.const 2) + ) + (if + (i32.const -6) + (br $block$4$break) + (block + (drop + (i32.const 30) + ) + (br $shape$1$continue) + ) + ) + ) + ) + ) (block - (call $check - (i32.const 0) + (block $block$6$break + (call $check + (i32.const 3) + ) + (if + (i32.const -10) + (block + (call $check + (i32.const 4) + ) + (block + (br $block$6$break) + ) + ) + (br $block$6$break) + ) ) - (drop - (i32.const 33) + (block + (call $check + (i32.const 5) + ) + (block + (drop + (i32.const 40) + ) + (br $block$7$break) + ) ) ) - (call $check - (i32.const 1) - ) ) (block - (drop - (i32.const -66) + (call $check + (i32.const 6) ) - (br $shape$0$continue) ) ) ) - (func $split (; 6 ;) (type $v) + (func $switch (; 13 ;) (type $v) (local $0 i32) (call $check (i32.const 0) ) - (if - (i32.const 55) - (block - (call $check - (i32.const 1) + (block $switch$1$leave + (block $switch$1$default + (block $switch$1$case$3 + (block $switch$1$case$2 + (br_table $switch$1$default $switch$1$default $switch$1$case$2 $switch$1$default $switch$1$case$3 $switch$1$case$2 $switch$1$default + (i32.const -99) + ) + ) + (block + (block + (call $check + (i32.const 1) + ) + ) + ) + (br $switch$1$leave) + ) + (block + (drop + (i32.const 55) + ) + (block + (call $check + (i32.const 2) + ) + ) ) + (br $switch$1$leave) ) (block - (call $check + (block + (call $check + (i32.const 3) + ) + ) + ) + (br $switch$1$leave) + ) + ) + (func $duffs-device (; 14 ;) (type $v) + (local $0 i32) + (local $1 i32) + (local $2 i64) + (local $3 i32) + (local $4 f32) + (local $5 f64) + (local $6 i32) + (block + (block $block$3$break + (block $block$2$break + (call $check + (i32.const 0) + ) + (if + (i32.const 10) + (block + (set_local $3 + (i32.const 2) + ) + (br $block$2$break) + ) + (block + (set_local $3 + (i32.const 3) + ) + (br $block$3$break) + ) + ) + ) + ) + ) + (loop $shape$1$continue + (if + (i32.eq + (get_local $3) (i32.const 2) ) + (block + (set_local $3 + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + (block + (set_local $3 + (i32.const 3) + ) + (br $shape$1$continue) + ) + ) + (if + (i32.eq + (get_local $3) + (i32.const 3) + ) + (block + (set_local $3 + (i32.const 0) + ) + (call $check + (i32.const 2) + ) + (block + (set_local $3 + (i32.const 2) + ) + (br $shape$1$continue) + ) + ) + ) + ) + ) + ) + (func $return (; 15 ;) (type $i) (result i32) + (local $0 i32) + (block + (call $check + (i32.const 42) + ) + (return + (i32.const 1337) ) ) ) - (func $split-plus-code (; 7 ;) (type $v) +) +optimized: +(module +) +module loaded from binary form: +(module + (type $0 (func (param i32 i32) (result i32))) + (func $adder (; 0 ;) (type $0) (param $0 i32) (param $1 i32) (result i32) + (i32.add + (get_local $0) + (get_local $1) + ) + ) +) +(module + (type $vi (func (param i32))) + (type $v (func)) + (import "spectest" "print" (func $print-i32 (param i32))) + (start $starter) + (func $starter (; 1 ;) (type $v) + (call $print-i32 + (i32.const 1234) + ) + ) +) +(i32.const 1234) +(module + (type $v (func)) + (func $func (; 0 ;) (type $v) (local $0 i32) - (call $check - (i32.const 0) + (set_local $0 + (i64.const 1234) ) - (if - (i32.const 55) - (block - (drop - (i32.const 10) - ) - (block - (call $check - (i32.const 1) - ) - ) - ) - (block + ) +) +validation: 0 +// beginning a Binaryen API trace +#include +#include +#include "src/binaryen-c.h" +int main() { + std::map functionTypes; + std::map expressions; + std::map functions; + std::map globals; + std::map exports; + std::map relooperBlocks; + BinaryenModuleRef the_module = NULL; + RelooperRef the_relooper = NULL; + the_module = BinaryenModuleCreate(); + expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); + expressions[1] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt64(2)); + expressions[3] = BinaryenConst(the_module, BinaryenLiteralFloat32(3.14)); + expressions[4] = BinaryenConst(the_module, BinaryenLiteralFloat64(2.1828)); + expressions[5] = BinaryenConst(the_module, BinaryenLiteralFloat32(NAN)); + expressions[6] = BinaryenConst(the_module, BinaryenLiteralFloat64(NAN)); + { + uint8_t t0[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[7] = BinaryenConst(the_module, BinaryenLiteralVec128(t0)); + } + expressions[8] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); + expressions[9] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); + expressions[10] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); + expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); + expressions[12] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); + expressions[13] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); + expressions[14] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); + expressions[15] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); + expressions[16] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); + expressions[17] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); + { + BinaryenType paramTypes[] = { 1, 2, 3, 4 }; + functionTypes[0] = BinaryenAddFunctionType(the_module, "iiIfF", 1, paramTypes, 4); + } + expressions[18] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[19] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[20] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(4)); + expressions[22] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); + expressions[23] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[24] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[25] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[26] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[27] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[28] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[29] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); + expressions[30] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + expressions[31] = BinaryenConst(the_module, BinaryenLiteralInt32(11)); + expressions[32] = BinaryenConst(the_module, BinaryenLiteralInt32(110)); + expressions[33] = BinaryenConst(the_module, BinaryenLiteralInt64(111)); + expressions[34] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[35] = BinaryenUnary(the_module, 0, expressions[34]); + expressions[36] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[37] = BinaryenUnary(the_module, 3, expressions[36]); + expressions[38] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[39] = BinaryenUnary(the_module, 4, expressions[38]); + expressions[40] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[41] = BinaryenUnary(the_module, 6, expressions[40]); + expressions[42] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[43] = BinaryenUnary(the_module, 9, expressions[42]); + expressions[44] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[45] = BinaryenUnary(the_module, 10, expressions[44]); + expressions[46] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[47] = BinaryenUnary(the_module, 13, expressions[46]); + expressions[48] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[49] = BinaryenUnary(the_module, 14, expressions[48]); + expressions[50] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[51] = BinaryenUnary(the_module, 16, expressions[50]); + expressions[52] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[53] = BinaryenUnary(the_module, 19, expressions[52]); + expressions[54] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[55] = BinaryenUnary(the_module, 20, expressions[54]); + expressions[56] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[57] = BinaryenUnary(the_module, 22, expressions[56]); + expressions[58] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[59] = BinaryenUnary(the_module, 23, expressions[58]); + expressions[60] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[61] = BinaryenUnary(the_module, 24, expressions[60]); + expressions[62] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[63] = BinaryenUnary(the_module, 25, expressions[62]); + expressions[64] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[65] = BinaryenUnary(the_module, 26, expressions[64]); + expressions[66] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[67] = BinaryenUnary(the_module, 27, expressions[66]); + expressions[68] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[69] = BinaryenUnary(the_module, 28, expressions[68]); + expressions[70] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[71] = BinaryenUnary(the_module, 29, expressions[70]); + expressions[72] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[73] = BinaryenUnary(the_module, 30, expressions[72]); + expressions[74] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[75] = BinaryenUnary(the_module, 31, expressions[74]); + expressions[76] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[77] = BinaryenUnary(the_module, 32, expressions[76]); + expressions[78] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[79] = BinaryenUnary(the_module, 52, expressions[78]); + expressions[80] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[81] = BinaryenUnary(the_module, 56, expressions[80]); + expressions[82] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[83] = BinaryenUnary(the_module, 53, expressions[82]); + expressions[84] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[85] = BinaryenUnary(the_module, 57, expressions[84]); + expressions[86] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[87] = BinaryenUnary(the_module, 54, expressions[86]); + expressions[88] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[89] = BinaryenUnary(the_module, 58, expressions[88]); + expressions[90] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[91] = BinaryenUnary(the_module, 55, expressions[90]); + expressions[92] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[93] = BinaryenUnary(the_module, 59, expressions[92]); + expressions[94] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[95] = BinaryenUnary(the_module, 33, expressions[94]); + expressions[96] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[97] = BinaryenUnary(the_module, 34, expressions[96]); + expressions[98] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[99] = BinaryenUnary(the_module, 35, expressions[98]); + expressions[100] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[101] = BinaryenUnary(the_module, 36, expressions[100]); + expressions[102] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[103] = BinaryenUnary(the_module, 37, expressions[102]); + expressions[104] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[105] = BinaryenUnary(the_module, 38, expressions[104]); + expressions[106] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[107] = BinaryenUnary(the_module, 39, expressions[106]); + expressions[108] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[109] = BinaryenUnary(the_module, 40, expressions[108]); + expressions[110] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[111] = BinaryenUnary(the_module, 41, expressions[110]); + expressions[112] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[113] = BinaryenUnary(the_module, 42, expressions[112]); + expressions[114] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[115] = BinaryenUnary(the_module, 43, expressions[114]); + expressions[116] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[117] = BinaryenUnary(the_module, 44, expressions[116]); + expressions[118] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[119] = BinaryenUnary(the_module, 45, expressions[118]); + expressions[120] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[121] = BinaryenUnary(the_module, 46, expressions[120]); + expressions[122] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[123] = BinaryenUnary(the_module, 60, expressions[122]); + expressions[124] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[125] = BinaryenUnary(the_module, 61, expressions[124]); + expressions[126] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[127] = BinaryenUnary(the_module, 62, expressions[126]); + expressions[128] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[129] = BinaryenUnary(the_module, 63, expressions[128]); + expressions[130] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[131] = BinaryenUnary(the_module, 64, expressions[130]); + expressions[132] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[133] = BinaryenUnary(the_module, 65, expressions[132]); + { + uint8_t t1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[134] = BinaryenConst(the_module, BinaryenLiteralVec128(t1)); + } + expressions[135] = BinaryenUnary(the_module, 66, expressions[134]); + { + uint8_t t2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[136] = BinaryenConst(the_module, BinaryenLiteralVec128(t2)); + } + expressions[137] = BinaryenUnary(the_module, 67, expressions[136]); + { + uint8_t t3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[138] = BinaryenConst(the_module, BinaryenLiteralVec128(t3)); + } + expressions[139] = BinaryenUnary(the_module, 68, expressions[138]); + { + uint8_t t4[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[140] = BinaryenConst(the_module, BinaryenLiteralVec128(t4)); + } + expressions[141] = BinaryenUnary(the_module, 69, expressions[140]); + { + uint8_t t5[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[142] = BinaryenConst(the_module, BinaryenLiteralVec128(t5)); + } + expressions[143] = BinaryenUnary(the_module, 70, expressions[142]); + { + uint8_t t6[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[144] = BinaryenConst(the_module, BinaryenLiteralVec128(t6)); + } + expressions[145] = BinaryenUnary(the_module, 71, expressions[144]); + { + uint8_t t7[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[146] = BinaryenConst(the_module, BinaryenLiteralVec128(t7)); + } + expressions[147] = BinaryenUnary(the_module, 72, expressions[146]); + { + uint8_t t8[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[148] = BinaryenConst(the_module, BinaryenLiteralVec128(t8)); + } + expressions[149] = BinaryenUnary(the_module, 73, expressions[148]); + { + uint8_t t9[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[150] = BinaryenConst(the_module, BinaryenLiteralVec128(t9)); + } + expressions[151] = BinaryenUnary(the_module, 74, expressions[150]); + { + uint8_t t10[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[152] = BinaryenConst(the_module, BinaryenLiteralVec128(t10)); + } + expressions[153] = BinaryenUnary(the_module, 75, expressions[152]); + { + uint8_t t11[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[154] = BinaryenConst(the_module, BinaryenLiteralVec128(t11)); + } + expressions[155] = BinaryenUnary(the_module, 76, expressions[154]); + { + uint8_t t12[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[156] = BinaryenConst(the_module, BinaryenLiteralVec128(t12)); + } + expressions[157] = BinaryenUnary(the_module, 77, expressions[156]); + { + uint8_t t13[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[158] = BinaryenConst(the_module, BinaryenLiteralVec128(t13)); + } + expressions[159] = BinaryenUnary(the_module, 78, expressions[158]); + { + uint8_t t14[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[160] = BinaryenConst(the_module, BinaryenLiteralVec128(t14)); + } + expressions[161] = BinaryenUnary(the_module, 79, expressions[160]); + { + uint8_t t15[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[162] = BinaryenConst(the_module, BinaryenLiteralVec128(t15)); + } + expressions[163] = BinaryenUnary(the_module, 80, expressions[162]); + { + uint8_t t16[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[164] = BinaryenConst(the_module, BinaryenLiteralVec128(t16)); + } + expressions[165] = BinaryenUnary(the_module, 81, expressions[164]); + { + uint8_t t17[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[166] = BinaryenConst(the_module, BinaryenLiteralVec128(t17)); + } + expressions[167] = BinaryenUnary(the_module, 82, expressions[166]); + { + uint8_t t18[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[168] = BinaryenConst(the_module, BinaryenLiteralVec128(t18)); + } + expressions[169] = BinaryenUnary(the_module, 83, expressions[168]); + { + uint8_t t19[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[170] = BinaryenConst(the_module, BinaryenLiteralVec128(t19)); + } + expressions[171] = BinaryenUnary(the_module, 84, expressions[170]); + { + uint8_t t20[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[172] = BinaryenConst(the_module, BinaryenLiteralVec128(t20)); + } + expressions[173] = BinaryenUnary(the_module, 85, expressions[172]); + { + uint8_t t21[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[174] = BinaryenConst(the_module, BinaryenLiteralVec128(t21)); + } + expressions[175] = BinaryenUnary(the_module, 86, expressions[174]); + { + uint8_t t22[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[176] = BinaryenConst(the_module, BinaryenLiteralVec128(t22)); + } + expressions[177] = BinaryenUnary(the_module, 87, expressions[176]); + { + uint8_t t23[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[178] = BinaryenConst(the_module, BinaryenLiteralVec128(t23)); + } + expressions[179] = BinaryenUnary(the_module, 88, expressions[178]); + { + uint8_t t24[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[180] = BinaryenConst(the_module, BinaryenLiteralVec128(t24)); + } + expressions[181] = BinaryenUnary(the_module, 89, expressions[180]); + { + uint8_t t25[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[182] = BinaryenConst(the_module, BinaryenLiteralVec128(t25)); + } + expressions[183] = BinaryenUnary(the_module, 90, expressions[182]); + { + uint8_t t26[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[184] = BinaryenConst(the_module, BinaryenLiteralVec128(t26)); + } + expressions[185] = BinaryenUnary(the_module, 91, expressions[184]); + { + uint8_t t27[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[186] = BinaryenConst(the_module, BinaryenLiteralVec128(t27)); + } + expressions[187] = BinaryenUnary(the_module, 92, expressions[186]); + expressions[188] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[189] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[190] = BinaryenBinary(the_module, 0, expressions[189], expressions[188]); + expressions[191] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[192] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[193] = BinaryenBinary(the_module, 64, expressions[192], expressions[191]); + expressions[194] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[195] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[196] = BinaryenBinary(the_module, 3, expressions[195], expressions[194]); + expressions[197] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[198] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[199] = BinaryenBinary(the_module, 29, expressions[198], expressions[197]); + expressions[200] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[201] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[202] = BinaryenBinary(the_module, 30, expressions[201], expressions[200]); + expressions[203] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[204] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[205] = BinaryenBinary(the_module, 6, expressions[204], expressions[203]); + expressions[206] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[207] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[208] = BinaryenBinary(the_module, 7, expressions[207], expressions[206]); + expressions[209] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[210] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[211] = BinaryenBinary(the_module, 33, expressions[210], expressions[209]); + expressions[212] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[213] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[214] = BinaryenBinary(the_module, 9, expressions[213], expressions[212]); + expressions[215] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[216] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[217] = BinaryenBinary(the_module, 35, expressions[216], expressions[215]); + expressions[218] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[219] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[220] = BinaryenBinary(the_module, 36, expressions[219], expressions[218]); + expressions[221] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[222] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[223] = BinaryenBinary(the_module, 12, expressions[222], expressions[221]); + expressions[224] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[225] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[226] = BinaryenBinary(the_module, 13, expressions[225], expressions[224]); + expressions[227] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[228] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[229] = BinaryenBinary(the_module, 39, expressions[228], expressions[227]); + expressions[230] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[231] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[232] = BinaryenBinary(the_module, 53, expressions[231], expressions[230]); + expressions[233] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[234] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[235] = BinaryenBinary(the_module, 67, expressions[234], expressions[233]); + expressions[236] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[237] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[238] = BinaryenBinary(the_module, 55, expressions[237], expressions[236]); + expressions[239] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[240] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[241] = BinaryenBinary(the_module, 69, expressions[240], expressions[239]); + expressions[242] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[243] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[244] = BinaryenBinary(the_module, 15, expressions[243], expressions[242]); + expressions[245] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[246] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[247] = BinaryenBinary(the_module, 58, expressions[246], expressions[245]); + expressions[248] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[249] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[250] = BinaryenBinary(the_module, 17, expressions[249], expressions[248]); + expressions[251] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[252] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[253] = BinaryenBinary(the_module, 43, expressions[252], expressions[251]); + expressions[254] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[255] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[256] = BinaryenBinary(the_module, 44, expressions[255], expressions[254]); + expressions[257] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[258] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[259] = BinaryenBinary(the_module, 20, expressions[258], expressions[257]); + expressions[260] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[261] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[262] = BinaryenBinary(the_module, 46, expressions[261], expressions[260]); + expressions[263] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[264] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[265] = BinaryenBinary(the_module, 22, expressions[264], expressions[263]); + expressions[266] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[267] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[268] = BinaryenBinary(the_module, 23, expressions[267], expressions[266]); + expressions[269] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); + expressions[270] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[271] = BinaryenBinary(the_module, 49, expressions[270], expressions[269]); + expressions[272] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[273] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[274] = BinaryenBinary(the_module, 59, expressions[273], expressions[272]); + expressions[275] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[276] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[277] = BinaryenBinary(the_module, 73, expressions[276], expressions[275]); + expressions[278] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[279] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[280] = BinaryenBinary(the_module, 74, expressions[279], expressions[278]); + expressions[281] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[282] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[283] = BinaryenBinary(the_module, 62, expressions[282], expressions[281]); + { + uint8_t t28[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[284] = BinaryenConst(the_module, BinaryenLiteralVec128(t28)); + } + { + uint8_t t29[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[285] = BinaryenConst(the_module, BinaryenLiteralVec128(t29)); + } + expressions[286] = BinaryenBinary(the_module, 76, expressions[285], expressions[284]); + { + uint8_t t30[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[287] = BinaryenConst(the_module, BinaryenLiteralVec128(t30)); + } + { + uint8_t t31[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[288] = BinaryenConst(the_module, BinaryenLiteralVec128(t31)); + } + expressions[289] = BinaryenBinary(the_module, 77, expressions[288], expressions[287]); + { + uint8_t t32[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[290] = BinaryenConst(the_module, BinaryenLiteralVec128(t32)); + } + { + uint8_t t33[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[291] = BinaryenConst(the_module, BinaryenLiteralVec128(t33)); + } + expressions[292] = BinaryenBinary(the_module, 78, expressions[291], expressions[290]); + { + uint8_t t34[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[293] = BinaryenConst(the_module, BinaryenLiteralVec128(t34)); + } + { + uint8_t t35[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[294] = BinaryenConst(the_module, BinaryenLiteralVec128(t35)); + } + expressions[295] = BinaryenBinary(the_module, 79, expressions[294], expressions[293]); + { + uint8_t t36[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[296] = BinaryenConst(the_module, BinaryenLiteralVec128(t36)); + } + { + uint8_t t37[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[297] = BinaryenConst(the_module, BinaryenLiteralVec128(t37)); + } + expressions[298] = BinaryenBinary(the_module, 80, expressions[297], expressions[296]); + { + uint8_t t38[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[299] = BinaryenConst(the_module, BinaryenLiteralVec128(t38)); + } + { + uint8_t t39[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[300] = BinaryenConst(the_module, BinaryenLiteralVec128(t39)); + } + expressions[301] = BinaryenBinary(the_module, 81, expressions[300], expressions[299]); + { + uint8_t t40[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[302] = BinaryenConst(the_module, BinaryenLiteralVec128(t40)); + } + { + uint8_t t41[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[303] = BinaryenConst(the_module, BinaryenLiteralVec128(t41)); + } + expressions[304] = BinaryenBinary(the_module, 82, expressions[303], expressions[302]); + { + uint8_t t42[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[305] = BinaryenConst(the_module, BinaryenLiteralVec128(t42)); + } + { + uint8_t t43[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[306] = BinaryenConst(the_module, BinaryenLiteralVec128(t43)); + } + expressions[307] = BinaryenBinary(the_module, 83, expressions[306], expressions[305]); + { + uint8_t t44[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[308] = BinaryenConst(the_module, BinaryenLiteralVec128(t44)); + } + { + uint8_t t45[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[309] = BinaryenConst(the_module, BinaryenLiteralVec128(t45)); + } + expressions[310] = BinaryenBinary(the_module, 84, expressions[309], expressions[308]); + { + uint8_t t46[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[311] = BinaryenConst(the_module, BinaryenLiteralVec128(t46)); + } + { + uint8_t t47[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[312] = BinaryenConst(the_module, BinaryenLiteralVec128(t47)); + } + expressions[313] = BinaryenBinary(the_module, 85, expressions[312], expressions[311]); + { + uint8_t t48[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[314] = BinaryenConst(the_module, BinaryenLiteralVec128(t48)); + } + { + uint8_t t49[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[315] = BinaryenConst(the_module, BinaryenLiteralVec128(t49)); + } + expressions[316] = BinaryenBinary(the_module, 86, expressions[315], expressions[314]); + { + uint8_t t50[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[317] = BinaryenConst(the_module, BinaryenLiteralVec128(t50)); + } + { + uint8_t t51[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[318] = BinaryenConst(the_module, BinaryenLiteralVec128(t51)); + } + expressions[319] = BinaryenBinary(the_module, 87, expressions[318], expressions[317]); + { + uint8_t t52[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[320] = BinaryenConst(the_module, BinaryenLiteralVec128(t52)); + } + { + uint8_t t53[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[321] = BinaryenConst(the_module, BinaryenLiteralVec128(t53)); + } + expressions[322] = BinaryenBinary(the_module, 88, expressions[321], expressions[320]); + { + uint8_t t54[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[323] = BinaryenConst(the_module, BinaryenLiteralVec128(t54)); + } + { + uint8_t t55[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[324] = BinaryenConst(the_module, BinaryenLiteralVec128(t55)); + } + expressions[325] = BinaryenBinary(the_module, 89, expressions[324], expressions[323]); + { + uint8_t t56[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[326] = BinaryenConst(the_module, BinaryenLiteralVec128(t56)); + } + { + uint8_t t57[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[327] = BinaryenConst(the_module, BinaryenLiteralVec128(t57)); + } + expressions[328] = BinaryenBinary(the_module, 90, expressions[327], expressions[326]); + { + uint8_t t58[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[329] = BinaryenConst(the_module, BinaryenLiteralVec128(t58)); + } + { + uint8_t t59[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[330] = BinaryenConst(the_module, BinaryenLiteralVec128(t59)); + } + expressions[331] = BinaryenBinary(the_module, 91, expressions[330], expressions[329]); + { + uint8_t t60[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[332] = BinaryenConst(the_module, BinaryenLiteralVec128(t60)); + } + { + uint8_t t61[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[333] = BinaryenConst(the_module, BinaryenLiteralVec128(t61)); + } + expressions[334] = BinaryenBinary(the_module, 92, expressions[333], expressions[332]); + { + uint8_t t62[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[335] = BinaryenConst(the_module, BinaryenLiteralVec128(t62)); + } + { + uint8_t t63[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[336] = BinaryenConst(the_module, BinaryenLiteralVec128(t63)); + } + expressions[337] = BinaryenBinary(the_module, 93, expressions[336], expressions[335]); + { + uint8_t t64[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[338] = BinaryenConst(the_module, BinaryenLiteralVec128(t64)); + } + { + uint8_t t65[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[339] = BinaryenConst(the_module, BinaryenLiteralVec128(t65)); + } + expressions[340] = BinaryenBinary(the_module, 94, expressions[339], expressions[338]); + { + uint8_t t66[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[341] = BinaryenConst(the_module, BinaryenLiteralVec128(t66)); + } + { + uint8_t t67[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[342] = BinaryenConst(the_module, BinaryenLiteralVec128(t67)); + } + expressions[343] = BinaryenBinary(the_module, 95, expressions[342], expressions[341]); + { + uint8_t t68[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[344] = BinaryenConst(the_module, BinaryenLiteralVec128(t68)); + } + { + uint8_t t69[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[345] = BinaryenConst(the_module, BinaryenLiteralVec128(t69)); + } + expressions[346] = BinaryenBinary(the_module, 96, expressions[345], expressions[344]); + { + uint8_t t70[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[347] = BinaryenConst(the_module, BinaryenLiteralVec128(t70)); + } + { + uint8_t t71[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[348] = BinaryenConst(the_module, BinaryenLiteralVec128(t71)); + } + expressions[349] = BinaryenBinary(the_module, 97, expressions[348], expressions[347]); + { + uint8_t t72[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[350] = BinaryenConst(the_module, BinaryenLiteralVec128(t72)); + } + { + uint8_t t73[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[351] = BinaryenConst(the_module, BinaryenLiteralVec128(t73)); + } + expressions[352] = BinaryenBinary(the_module, 98, expressions[351], expressions[350]); + { + uint8_t t74[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[353] = BinaryenConst(the_module, BinaryenLiteralVec128(t74)); + } + { + uint8_t t75[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[354] = BinaryenConst(the_module, BinaryenLiteralVec128(t75)); + } + expressions[355] = BinaryenBinary(the_module, 99, expressions[354], expressions[353]); + { + uint8_t t76[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[356] = BinaryenConst(the_module, BinaryenLiteralVec128(t76)); + } + { + uint8_t t77[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[357] = BinaryenConst(the_module, BinaryenLiteralVec128(t77)); + } + expressions[358] = BinaryenBinary(the_module, 100, expressions[357], expressions[356]); + { + uint8_t t78[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[359] = BinaryenConst(the_module, BinaryenLiteralVec128(t78)); + } + { + uint8_t t79[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[360] = BinaryenConst(the_module, BinaryenLiteralVec128(t79)); + } + expressions[361] = BinaryenBinary(the_module, 101, expressions[360], expressions[359]); + { + uint8_t t80[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[362] = BinaryenConst(the_module, BinaryenLiteralVec128(t80)); + } + { + uint8_t t81[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[363] = BinaryenConst(the_module, BinaryenLiteralVec128(t81)); + } + expressions[364] = BinaryenBinary(the_module, 102, expressions[363], expressions[362]); + { + uint8_t t82[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[365] = BinaryenConst(the_module, BinaryenLiteralVec128(t82)); + } + { + uint8_t t83[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[366] = BinaryenConst(the_module, BinaryenLiteralVec128(t83)); + } + expressions[367] = BinaryenBinary(the_module, 103, expressions[366], expressions[365]); + { + uint8_t t84[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[368] = BinaryenConst(the_module, BinaryenLiteralVec128(t84)); + } + { + uint8_t t85[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[369] = BinaryenConst(the_module, BinaryenLiteralVec128(t85)); + } + expressions[370] = BinaryenBinary(the_module, 104, expressions[369], expressions[368]); + { + uint8_t t86[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[371] = BinaryenConst(the_module, BinaryenLiteralVec128(t86)); + } + { + uint8_t t87[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[372] = BinaryenConst(the_module, BinaryenLiteralVec128(t87)); + } + expressions[373] = BinaryenBinary(the_module, 105, expressions[372], expressions[371]); + { + uint8_t t88[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[374] = BinaryenConst(the_module, BinaryenLiteralVec128(t88)); + } + { + uint8_t t89[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[375] = BinaryenConst(the_module, BinaryenLiteralVec128(t89)); + } + expressions[376] = BinaryenBinary(the_module, 106, expressions[375], expressions[374]); + { + uint8_t t90[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[377] = BinaryenConst(the_module, BinaryenLiteralVec128(t90)); + } + { + uint8_t t91[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[378] = BinaryenConst(the_module, BinaryenLiteralVec128(t91)); + } + expressions[379] = BinaryenBinary(the_module, 107, expressions[378], expressions[377]); + { + uint8_t t92[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[380] = BinaryenConst(the_module, BinaryenLiteralVec128(t92)); + } + { + uint8_t t93[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[381] = BinaryenConst(the_module, BinaryenLiteralVec128(t93)); + } + expressions[382] = BinaryenBinary(the_module, 108, expressions[381], expressions[380]); + { + uint8_t t94[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[383] = BinaryenConst(the_module, BinaryenLiteralVec128(t94)); + } + { + uint8_t t95[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[384] = BinaryenConst(the_module, BinaryenLiteralVec128(t95)); + } + expressions[385] = BinaryenBinary(the_module, 109, expressions[384], expressions[383]); + { + uint8_t t96[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[386] = BinaryenConst(the_module, BinaryenLiteralVec128(t96)); + } + { + uint8_t t97[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[387] = BinaryenConst(the_module, BinaryenLiteralVec128(t97)); + } + expressions[388] = BinaryenBinary(the_module, 110, expressions[387], expressions[386]); + { + uint8_t t98[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[389] = BinaryenConst(the_module, BinaryenLiteralVec128(t98)); + } + { + uint8_t t99[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[390] = BinaryenConst(the_module, BinaryenLiteralVec128(t99)); + } + expressions[391] = BinaryenBinary(the_module, 111, expressions[390], expressions[389]); + { + uint8_t t100[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[392] = BinaryenConst(the_module, BinaryenLiteralVec128(t100)); + } + { + uint8_t t101[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[393] = BinaryenConst(the_module, BinaryenLiteralVec128(t101)); + } + expressions[394] = BinaryenBinary(the_module, 112, expressions[393], expressions[392]); + { + uint8_t t102[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[395] = BinaryenConst(the_module, BinaryenLiteralVec128(t102)); + } + { + uint8_t t103[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[396] = BinaryenConst(the_module, BinaryenLiteralVec128(t103)); + } + expressions[397] = BinaryenBinary(the_module, 113, expressions[396], expressions[395]); + { + uint8_t t104[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[398] = BinaryenConst(the_module, BinaryenLiteralVec128(t104)); + } + { + uint8_t t105[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[399] = BinaryenConst(the_module, BinaryenLiteralVec128(t105)); + } + expressions[400] = BinaryenBinary(the_module, 114, expressions[399], expressions[398]); + { + uint8_t t106[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[401] = BinaryenConst(the_module, BinaryenLiteralVec128(t106)); + } + { + uint8_t t107[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[402] = BinaryenConst(the_module, BinaryenLiteralVec128(t107)); + } + expressions[403] = BinaryenBinary(the_module, 115, expressions[402], expressions[401]); + { + uint8_t t108[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[404] = BinaryenConst(the_module, BinaryenLiteralVec128(t108)); + } + { + uint8_t t109[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[405] = BinaryenConst(the_module, BinaryenLiteralVec128(t109)); + } + expressions[406] = BinaryenBinary(the_module, 116, expressions[405], expressions[404]); + { + uint8_t t110[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[407] = BinaryenConst(the_module, BinaryenLiteralVec128(t110)); + } + { + uint8_t t111[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[408] = BinaryenConst(the_module, BinaryenLiteralVec128(t111)); + } + expressions[409] = BinaryenBinary(the_module, 117, expressions[408], expressions[407]); + { + uint8_t t112[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[410] = BinaryenConst(the_module, BinaryenLiteralVec128(t112)); + } + { + uint8_t t113[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[411] = BinaryenConst(the_module, BinaryenLiteralVec128(t113)); + } + expressions[412] = BinaryenBinary(the_module, 118, expressions[411], expressions[410]); + { + uint8_t t114[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[413] = BinaryenConst(the_module, BinaryenLiteralVec128(t114)); + } + { + uint8_t t115[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[414] = BinaryenConst(the_module, BinaryenLiteralVec128(t115)); + } + expressions[415] = BinaryenBinary(the_module, 119, expressions[414], expressions[413]); + { + uint8_t t116[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[416] = BinaryenConst(the_module, BinaryenLiteralVec128(t116)); + } + { + uint8_t t117[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[417] = BinaryenConst(the_module, BinaryenLiteralVec128(t117)); + } + expressions[418] = BinaryenBinary(the_module, 120, expressions[417], expressions[416]); + { + uint8_t t118[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[419] = BinaryenConst(the_module, BinaryenLiteralVec128(t118)); + } + { + uint8_t t119[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[420] = BinaryenConst(the_module, BinaryenLiteralVec128(t119)); + } + expressions[421] = BinaryenBinary(the_module, 121, expressions[420], expressions[419]); + { + uint8_t t120[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[422] = BinaryenConst(the_module, BinaryenLiteralVec128(t120)); + } + { + uint8_t t121[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[423] = BinaryenConst(the_module, BinaryenLiteralVec128(t121)); + } + expressions[424] = BinaryenBinary(the_module, 122, expressions[423], expressions[422]); + { + uint8_t t122[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[425] = BinaryenConst(the_module, BinaryenLiteralVec128(t122)); + } + { + uint8_t t123[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[426] = BinaryenConst(the_module, BinaryenLiteralVec128(t123)); + } + expressions[427] = BinaryenBinary(the_module, 123, expressions[426], expressions[425]); + { + uint8_t t124[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[428] = BinaryenConst(the_module, BinaryenLiteralVec128(t124)); + } + { + uint8_t t125[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[429] = BinaryenConst(the_module, BinaryenLiteralVec128(t125)); + } + expressions[430] = BinaryenBinary(the_module, 124, expressions[429], expressions[428]); + { + uint8_t t126[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[431] = BinaryenConst(the_module, BinaryenLiteralVec128(t126)); + } + { + uint8_t t127[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[432] = BinaryenConst(the_module, BinaryenLiteralVec128(t127)); + } + expressions[433] = BinaryenBinary(the_module, 125, expressions[432], expressions[431]); + { + uint8_t t128[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[434] = BinaryenConst(the_module, BinaryenLiteralVec128(t128)); + } + { + uint8_t t129[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[435] = BinaryenConst(the_module, BinaryenLiteralVec128(t129)); + } + expressions[436] = BinaryenBinary(the_module, 126, expressions[435], expressions[434]); + { + uint8_t t130[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[437] = BinaryenConst(the_module, BinaryenLiteralVec128(t130)); + } + { + uint8_t t131[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[438] = BinaryenConst(the_module, BinaryenLiteralVec128(t131)); + } + expressions[439] = BinaryenBinary(the_module, 127, expressions[438], expressions[437]); + { + uint8_t t132[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[440] = BinaryenConst(the_module, BinaryenLiteralVec128(t132)); + } + { + uint8_t t133[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[441] = BinaryenConst(the_module, BinaryenLiteralVec128(t133)); + } + expressions[442] = BinaryenBinary(the_module, 128, expressions[441], expressions[440]); + { + uint8_t t134[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[443] = BinaryenConst(the_module, BinaryenLiteralVec128(t134)); + } + { + uint8_t t135[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[444] = BinaryenConst(the_module, BinaryenLiteralVec128(t135)); + } + expressions[445] = BinaryenBinary(the_module, 129, expressions[444], expressions[443]); + { + uint8_t t136[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[446] = BinaryenConst(the_module, BinaryenLiteralVec128(t136)); + } + { + uint8_t t137[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[447] = BinaryenConst(the_module, BinaryenLiteralVec128(t137)); + } + expressions[448] = BinaryenBinary(the_module, 130, expressions[447], expressions[446]); + { + uint8_t t138[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[449] = BinaryenConst(the_module, BinaryenLiteralVec128(t138)); + } + { + uint8_t t139[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[450] = BinaryenConst(the_module, BinaryenLiteralVec128(t139)); + } + expressions[451] = BinaryenBinary(the_module, 131, expressions[450], expressions[449]); + { + uint8_t t140[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[452] = BinaryenConst(the_module, BinaryenLiteralVec128(t140)); + } + { + uint8_t t141[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[453] = BinaryenConst(the_module, BinaryenLiteralVec128(t141)); + } + expressions[454] = BinaryenBinary(the_module, 132, expressions[453], expressions[452]); + { + uint8_t t142[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[455] = BinaryenConst(the_module, BinaryenLiteralVec128(t142)); + } + { + uint8_t t143[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[456] = BinaryenConst(the_module, BinaryenLiteralVec128(t143)); + } + expressions[457] = BinaryenBinary(the_module, 133, expressions[456], expressions[455]); + { + uint8_t t144[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[458] = BinaryenConst(the_module, BinaryenLiteralVec128(t144)); + } + { + uint8_t t145[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[459] = BinaryenConst(the_module, BinaryenLiteralVec128(t145)); + } + expressions[460] = BinaryenBinary(the_module, 134, expressions[459], expressions[458]); + { + uint8_t t146[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[461] = BinaryenConst(the_module, BinaryenLiteralVec128(t146)); + } + { + uint8_t t147[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[462] = BinaryenConst(the_module, BinaryenLiteralVec128(t147)); + } + expressions[463] = BinaryenBinary(the_module, 135, expressions[462], expressions[461]); + { + uint8_t t148[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[464] = BinaryenConst(the_module, BinaryenLiteralVec128(t148)); + } + { + uint8_t t149[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[465] = BinaryenConst(the_module, BinaryenLiteralVec128(t149)); + } + expressions[466] = BinaryenBinary(the_module, 136, expressions[465], expressions[464]); + { + uint8_t t150[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[467] = BinaryenConst(the_module, BinaryenLiteralVec128(t150)); + } + { + uint8_t t151[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[468] = BinaryenConst(the_module, BinaryenLiteralVec128(t151)); + } + expressions[469] = BinaryenBinary(the_module, 137, expressions[468], expressions[467]); + { + uint8_t t152[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[470] = BinaryenConst(the_module, BinaryenLiteralVec128(t152)); + } + { + uint8_t t153[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[471] = BinaryenConst(the_module, BinaryenLiteralVec128(t153)); + } + expressions[472] = BinaryenBinary(the_module, 138, expressions[471], expressions[470]); + { + uint8_t t154[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[473] = BinaryenConst(the_module, BinaryenLiteralVec128(t154)); + } + { + uint8_t t155[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[474] = BinaryenConst(the_module, BinaryenLiteralVec128(t155)); + } + expressions[475] = BinaryenBinary(the_module, 139, expressions[474], expressions[473]); + { + uint8_t t156[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[476] = BinaryenConst(the_module, BinaryenLiteralVec128(t156)); + } + { + uint8_t t157[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[477] = BinaryenConst(the_module, BinaryenLiteralVec128(t157)); + } + expressions[478] = BinaryenBinary(the_module, 140, expressions[477], expressions[476]); + { + uint8_t t158[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[479] = BinaryenConst(the_module, BinaryenLiteralVec128(t158)); + } + { + uint8_t t159[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[480] = BinaryenConst(the_module, BinaryenLiteralVec128(t159)); + } + expressions[481] = BinaryenBinary(the_module, 141, expressions[480], expressions[479]); + { + uint8_t t160[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[482] = BinaryenConst(the_module, BinaryenLiteralVec128(t160)); + } + { + uint8_t t161[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[483] = BinaryenConst(the_module, BinaryenLiteralVec128(t161)); + } + expressions[484] = BinaryenBinary(the_module, 142, expressions[483], expressions[482]); + { + uint8_t t162[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[485] = BinaryenConst(the_module, BinaryenLiteralVec128(t162)); + } + { + uint8_t t163[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[486] = BinaryenConst(the_module, BinaryenLiteralVec128(t163)); + } + expressions[487] = BinaryenBinary(the_module, 143, expressions[486], expressions[485]); + { + uint8_t t164[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[488] = BinaryenConst(the_module, BinaryenLiteralVec128(t164)); + } + { + uint8_t t165[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[489] = BinaryenConst(the_module, BinaryenLiteralVec128(t165)); + } + expressions[490] = BinaryenBinary(the_module, 144, expressions[489], expressions[488]); + { + uint8_t t166[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[491] = BinaryenConst(the_module, BinaryenLiteralVec128(t166)); + } + { + uint8_t t167[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[492] = BinaryenConst(the_module, BinaryenLiteralVec128(t167)); + } + expressions[493] = BinaryenBinary(the_module, 145, expressions[492], expressions[491]); + { + uint8_t t168[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[494] = BinaryenConst(the_module, BinaryenLiteralVec128(t168)); + } + { + uint8_t t169[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[495] = BinaryenConst(the_module, BinaryenLiteralVec128(t169)); + } + expressions[496] = BinaryenBinary(the_module, 146, expressions[495], expressions[494]); + { + uint8_t t170[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[497] = BinaryenConst(the_module, BinaryenLiteralVec128(t170)); + } + { + uint8_t t171[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[498] = BinaryenConst(the_module, BinaryenLiteralVec128(t171)); + } + expressions[499] = BinaryenBinary(the_module, 147, expressions[498], expressions[497]); + { + uint8_t t172[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[500] = BinaryenConst(the_module, BinaryenLiteralVec128(t172)); + } + { + uint8_t t173[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[501] = BinaryenConst(the_module, BinaryenLiteralVec128(t173)); + } + expressions[502] = BinaryenBinary(the_module, 148, expressions[501], expressions[500]); + { + uint8_t t174[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[503] = BinaryenConst(the_module, BinaryenLiteralVec128(t174)); + } + { + uint8_t t175[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[504] = BinaryenConst(the_module, BinaryenLiteralVec128(t175)); + } + expressions[505] = BinaryenBinary(the_module, 149, expressions[504], expressions[503]); + { + uint8_t t176[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[506] = BinaryenConst(the_module, BinaryenLiteralVec128(t176)); + } + { + uint8_t t177[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[507] = BinaryenConst(the_module, BinaryenLiteralVec128(t177)); + } + expressions[508] = BinaryenBinary(the_module, 150, expressions[507], expressions[506]); + { + uint8_t t178[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[509] = BinaryenConst(the_module, BinaryenLiteralVec128(t178)); + } + { + uint8_t t179[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[510] = BinaryenConst(the_module, BinaryenLiteralVec128(t179)); + } + expressions[511] = BinaryenBinary(the_module, 151, expressions[510], expressions[509]); + { + uint8_t t180[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[512] = BinaryenConst(the_module, BinaryenLiteralVec128(t180)); + } + expressions[513] = BinaryenSIMDExtract(the_module, 0, expressions[512], 0); + { + uint8_t t181[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[514] = BinaryenConst(the_module, BinaryenLiteralVec128(t181)); + } + expressions[515] = BinaryenSIMDExtract(the_module, 1, expressions[514], 0); + { + uint8_t t182[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[516] = BinaryenConst(the_module, BinaryenLiteralVec128(t182)); + } + expressions[517] = BinaryenSIMDExtract(the_module, 2, expressions[516], 0); + { + uint8_t t183[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[518] = BinaryenConst(the_module, BinaryenLiteralVec128(t183)); + } + expressions[519] = BinaryenSIMDExtract(the_module, 3, expressions[518], 0); + { + uint8_t t184[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[520] = BinaryenConst(the_module, BinaryenLiteralVec128(t184)); + } + expressions[521] = BinaryenSIMDExtract(the_module, 4, expressions[520], 0); + { + uint8_t t185[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[522] = BinaryenConst(the_module, BinaryenLiteralVec128(t185)); + } + expressions[523] = BinaryenSIMDExtract(the_module, 5, expressions[522], 0); + { + uint8_t t186[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[524] = BinaryenConst(the_module, BinaryenLiteralVec128(t186)); + } + expressions[525] = BinaryenSIMDExtract(the_module, 6, expressions[524], 0); + { + uint8_t t187[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[526] = BinaryenConst(the_module, BinaryenLiteralVec128(t187)); + } + expressions[527] = BinaryenSIMDExtract(the_module, 7, expressions[526], 0); + expressions[528] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + { + uint8_t t188[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[529] = BinaryenConst(the_module, BinaryenLiteralVec128(t188)); + } + expressions[530] = BinaryenSIMDReplace(the_module, 0, expressions[529], 0, expressions[528]); + expressions[531] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + { + uint8_t t189[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[532] = BinaryenConst(the_module, BinaryenLiteralVec128(t189)); + } + expressions[533] = BinaryenSIMDReplace(the_module, 1, expressions[532], 0, expressions[531]); + expressions[534] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + { + uint8_t t190[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[535] = BinaryenConst(the_module, BinaryenLiteralVec128(t190)); + } + expressions[536] = BinaryenSIMDReplace(the_module, 2, expressions[535], 0, expressions[534]); + expressions[537] = BinaryenConst(the_module, BinaryenLiteralInt64(42)); + { + uint8_t t191[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[538] = BinaryenConst(the_module, BinaryenLiteralVec128(t191)); + } + expressions[539] = BinaryenSIMDReplace(the_module, 3, expressions[538], 0, expressions[537]); + expressions[540] = BinaryenConst(the_module, BinaryenLiteralFloat32(42)); + { + uint8_t t192[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[541] = BinaryenConst(the_module, BinaryenLiteralVec128(t192)); + } + expressions[542] = BinaryenSIMDReplace(the_module, 4, expressions[541], 0, expressions[540]); + expressions[543] = BinaryenConst(the_module, BinaryenLiteralFloat64(42)); + { + uint8_t t193[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[544] = BinaryenConst(the_module, BinaryenLiteralVec128(t193)); + } + expressions[545] = BinaryenSIMDReplace(the_module, 5, expressions[544], 0, expressions[543]); + expressions[546] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t194[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[547] = BinaryenConst(the_module, BinaryenLiteralVec128(t194)); + } + expressions[548] = BinaryenSIMDShift(the_module, 0, expressions[547], expressions[546]); + expressions[549] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t195[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[550] = BinaryenConst(the_module, BinaryenLiteralVec128(t195)); + } + expressions[551] = BinaryenSIMDShift(the_module, 1, expressions[550], expressions[549]); + expressions[552] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t196[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[553] = BinaryenConst(the_module, BinaryenLiteralVec128(t196)); + } + expressions[554] = BinaryenSIMDShift(the_module, 2, expressions[553], expressions[552]); + expressions[555] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t197[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[556] = BinaryenConst(the_module, BinaryenLiteralVec128(t197)); + } + expressions[557] = BinaryenSIMDShift(the_module, 3, expressions[556], expressions[555]); + expressions[558] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t198[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[559] = BinaryenConst(the_module, BinaryenLiteralVec128(t198)); + } + expressions[560] = BinaryenSIMDShift(the_module, 4, expressions[559], expressions[558]); + expressions[561] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t199[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[562] = BinaryenConst(the_module, BinaryenLiteralVec128(t199)); + } + expressions[563] = BinaryenSIMDShift(the_module, 5, expressions[562], expressions[561]); + expressions[564] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t200[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[565] = BinaryenConst(the_module, BinaryenLiteralVec128(t200)); + } + expressions[566] = BinaryenSIMDShift(the_module, 128, expressions[565], expressions[564]); + expressions[567] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t201[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[568] = BinaryenConst(the_module, BinaryenLiteralVec128(t201)); + } + expressions[569] = BinaryenSIMDShift(the_module, 6, expressions[568], expressions[567]); + expressions[570] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t202[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[571] = BinaryenConst(the_module, BinaryenLiteralVec128(t202)); + } + expressions[572] = BinaryenSIMDShift(the_module, 7, expressions[571], expressions[570]); + expressions[573] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t203[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[574] = BinaryenConst(the_module, BinaryenLiteralVec128(t203)); + } + expressions[575] = BinaryenSIMDShift(the_module, 8, expressions[574], expressions[573]); + expressions[576] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t204[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[577] = BinaryenConst(the_module, BinaryenLiteralVec128(t204)); + } + expressions[578] = BinaryenSIMDShift(the_module, 9, expressions[577], expressions[576]); + expressions[579] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t205[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[580] = BinaryenConst(the_module, BinaryenLiteralVec128(t205)); + } + expressions[581] = BinaryenSIMDShift(the_module, 10, expressions[580], expressions[579]); + expressions[582] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + { + uint8_t t206[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[583] = BinaryenConst(the_module, BinaryenLiteralVec128(t206)); + } + expressions[584] = BinaryenSIMDShift(the_module, 11, expressions[583], expressions[582]); + { + uint8_t t207[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[585] = BinaryenConst(the_module, BinaryenLiteralVec128(t207)); + } + { + uint8_t t208[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[586] = BinaryenConst(the_module, BinaryenLiteralVec128(t208)); + } + { + uint8_t mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + expressions[587] = BinaryenSIMDShuffle(the_module, expressions[586], expressions[585], mask); + } + { + uint8_t t209[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[588] = BinaryenConst(the_module, BinaryenLiteralVec128(t209)); + } + { + uint8_t t210[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[589] = BinaryenConst(the_module, BinaryenLiteralVec128(t210)); + } + { + uint8_t t211[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[590] = BinaryenConst(the_module, BinaryenLiteralVec128(t211)); + } + expressions[591] = BinaryenSIMDBitselect(the_module, expressions[590], expressions[589], expressions[588]); + { + BinaryenExpressionRef children[] = { 0 }; + expressions[592] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto()); + } + expressions[593] = BinaryenIf(the_module, expressions[18], expressions[19], expressions[20]); + expressions[594] = BinaryenIf(the_module, expressions[21], expressions[22], expressions[0]); + expressions[595] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[596] = BinaryenLoop(the_module, "in", expressions[595]); + expressions[597] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[598] = BinaryenLoop(the_module, NULL, expressions[597]); + expressions[599] = BinaryenBreak(the_module, "the-value", expressions[23], expressions[24]); + expressions[600] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[601] = BinaryenBreak(the_module, "the-nothing", expressions[600], expressions[0]); + expressions[602] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[603] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[602]); + expressions[604] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]); + { + const char* names[] = { "the-value" }; + expressions[605] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[25], expressions[26]); + } + expressions[606] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + { + const char* names[] = { "the-nothing" }; + expressions[607] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[606], expressions[0]); + } + { + BinaryenExpressionRef operands[] = { expressions[10], expressions[11], expressions[12], expressions[13] }; + expressions[608] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); + } + expressions[609] = BinaryenUnary(the_module, 20, expressions[608]); + { + BinaryenExpressionRef operands[] = { expressions[8], expressions[9] }; + expressions[610] = BinaryenCall(the_module, "an-imported", operands, 2, 3); + } + expressions[611] = BinaryenUnary(the_module, 25, expressions[610]); + expressions[612] = BinaryenUnary(the_module, 20, expressions[611]); + expressions[613] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); + { + BinaryenExpressionRef operands[] = { expressions[14], expressions[15], expressions[16], expressions[17] }; + expressions[614] = BinaryenCallIndirect(the_module, expressions[613], operands, 4, "iiIfF"); + } + expressions[615] = BinaryenUnary(the_module, 20, expressions[614]); + expressions[616] = BinaryenGetLocal(the_module, 0, 1); + expressions[617] = BinaryenDrop(the_module, expressions[616]); + expressions[618] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); + expressions[619] = BinaryenSetLocal(the_module, 0, expressions[618]); + expressions[620] = BinaryenConst(the_module, BinaryenLiteralInt32(102)); + expressions[621] = BinaryenTeeLocal(the_module, 0, expressions[620]); + expressions[622] = BinaryenDrop(the_module, expressions[621]); + expressions[623] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[624] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[623]); + expressions[625] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); + expressions[626] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[625]); + expressions[627] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[628] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[627]); + expressions[629] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); + expressions[630] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[629]); + expressions[631] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 1); + expressions[632] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 2); + expressions[633] = BinaryenSelect(the_module, expressions[27], expressions[28], expressions[29]); + expressions[634] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); + expressions[635] = BinaryenReturn(the_module, expressions[634]); + expressions[636] = BinaryenNop(the_module); + expressions[637] = BinaryenUnreachable(the_module); + BinaryenExpressionPrint(expressions[41]); +(f32.neg + (f32.const -33.61199951171875) +) + { + BinaryenExpressionRef children[] = { expressions[35], expressions[37], expressions[39], expressions[41], expressions[43], + expressions[45], expressions[47], expressions[49], expressions[51], expressions[53], expressions[55], + expressions[57], expressions[59], expressions[61], expressions[63], expressions[65], expressions[67], + expressions[69], expressions[71], expressions[73], expressions[75], expressions[77], expressions[79], + expressions[81], expressions[83], expressions[85], expressions[87], expressions[89], expressions[91], + expressions[93], expressions[95], expressions[97], expressions[99], expressions[101], expressions[103], + expressions[105], expressions[107], expressions[109], expressions[111], expressions[113], expressions[115], + expressions[117], expressions[119], expressions[121], expressions[123], expressions[125], expressions[127], + expressions[129], expressions[131], expressions[133], expressions[135], expressions[137], expressions[139], + expressions[141], expressions[143], expressions[145], expressions[147], expressions[149], expressions[151], + expressions[153], expressions[155], expressions[157], expressions[159], expressions[161], expressions[163], + expressions[165], expressions[167], expressions[169], expressions[171], expressions[173], expressions[175], + expressions[177], expressions[179], expressions[181], expressions[183], expressions[185], expressions[187], + expressions[190], expressions[193], expressions[196], expressions[199], expressions[202], expressions[205], + expressions[208], expressions[211], expressions[214], expressions[217], expressions[220], expressions[223], + expressions[226], expressions[229], expressions[232], expressions[235], expressions[238], expressions[241], + expressions[244], expressions[247], expressions[250], expressions[253], expressions[256], expressions[259], + expressions[262], expressions[265], expressions[268], expressions[271], expressions[274], expressions[277], + expressions[280], expressions[283], expressions[286], expressions[289], expressions[292], expressions[295], + expressions[298], expressions[301], expressions[304], expressions[307], expressions[310], expressions[313], + expressions[316], expressions[319], expressions[322], expressions[325], expressions[328], expressions[331], + expressions[334], expressions[337], expressions[340], expressions[343], expressions[346], expressions[349], + expressions[352], expressions[355], expressions[358], expressions[361], expressions[364], expressions[367], + expressions[370], expressions[373], expressions[376], expressions[379], expressions[382], expressions[385], + expressions[388], expressions[391], expressions[394], expressions[397], expressions[400], expressions[403], + expressions[406], expressions[409], expressions[412], expressions[415], expressions[418], expressions[421], + expressions[424], expressions[427], expressions[430], expressions[433], expressions[436], expressions[439], + expressions[442], expressions[445], expressions[448], expressions[451], expressions[454], expressions[457], + expressions[460], expressions[463], expressions[466], expressions[469], expressions[472], expressions[475], + expressions[478], expressions[481], expressions[484], expressions[487], expressions[490], expressions[493], + expressions[496], expressions[499], expressions[502], expressions[505], expressions[508], expressions[511], + expressions[513], expressions[515], expressions[517], expressions[519], expressions[521], expressions[523], + expressions[525], expressions[527], expressions[530], expressions[533], expressions[536], expressions[539], + expressions[542], expressions[545], expressions[548], expressions[551], expressions[554], expressions[557], + expressions[560], expressions[563], expressions[566], expressions[569], expressions[572], expressions[575], + expressions[578], expressions[581], expressions[584], expressions[587], expressions[591], expressions[592], + expressions[593], expressions[594], expressions[596], expressions[598], expressions[599], expressions[601], + expressions[603], expressions[604], expressions[605], expressions[607], expressions[609], expressions[612], + expressions[615], expressions[617], expressions[619], expressions[622], expressions[624], expressions[626], + expressions[628], expressions[630], expressions[631], expressions[632], expressions[633], expressions[635], + expressions[636], expressions[637] }; + expressions[638] = BinaryenBlock(the_module, "the-value", children, 241, BinaryenTypeAuto()); + } + expressions[639] = BinaryenDrop(the_module, expressions[638]); + { + BinaryenExpressionRef children[] = { expressions[639] }; + expressions[640] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto()); + } + expressions[641] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + { + BinaryenExpressionRef children[] = { expressions[640], expressions[641] }; + expressions[642] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); + } + { + BinaryenType varTypes[] = { 1 }; + functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[642]); + } + expressions[643] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); + BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[643]); + expressions[644] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); + BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[644]); + { + BinaryenType paramTypes[] = { 1, 4 }; + functionTypes[1] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); + } + BinaryenAddFunctionImport(the_module, "an-imported", "module", "base", functionTypes[1]); + exports[0] = BinaryenAddFunctionExport(the_module, "kitchen()sinker", "kitchen_sinker"); + BinaryenFunctionGetName(functions[0]); + { + const char* funcNames[] = { "kitchen()sinker" }; + BinaryenSetFunctionTable(the_module, 1, 1, funcNames, 1); + } + expressions[645] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + { + const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; + const char* segments[] = { segment0 }; + BinaryenExpressionRef segmentOffsets[] = { expressions[645] }; + BinaryenIndex segmentSizes[] = { 12 }; + BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0); + } + { + BinaryenType paramTypes[] = { 0 }; + functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); + } + expressions[646] = BinaryenNop(the_module); + { + BinaryenType varTypes[] = { 0 }; + functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[646]); + } + BinaryenSetStart(the_module, functions[1]); + { + BinaryenType paramTypes[] = { 0 }; + functionTypes[3] = BinaryenAddFunctionType(the_module, NULL, 0, paramTypes, 0); + } + BinaryenModuleAutoDrop(the_module); + BinaryenModuleValidate(the_module); + BinaryenModulePrint(the_module); +(module + (type $iiIfF (func (param i32 i64 f32 f64) (result i32))) + (type $fiF (func (param i32 f64) (result f32))) + (type $v (func)) + (type $3 (func)) + (import "module" "base" (func $an-imported (param i32 f64) (result f32))) + (memory $0 1 256) + (data (i32.const 10) "hello, world") + (table $0 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") + (global $a-global i32 (i32.const 7)) + (global $a-mutable-global (mut f32) (f32.const 7.5)) + (export "kitchen_sinker" (func "$kitchen()sinker")) + (export "mem" (memory $0)) + (start $starter) + (func "$kitchen()sinker" (; 1 ;) (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) + (local $4 i32) + (block $the-body (result i32) + (block $the-nothing (drop - (i32.const 20) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - ) - ) - (func $if (; 8 ;) (type $v) - (local $0 i32) - (block $block$3$break - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (call $check - (i32.const 1) - ) - (block - (br $block$3$break) - ) - ) - (br $block$3$break) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - (func $if-plus-code (; 9 ;) (type $v) - (local $0 i32) - (block $block$3$break - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (drop - (i32.const -1) - ) - (block - (call $check - (i32.const 1) + (block $the-value (result i32) + (drop + (i32.clz + (i32.const -10) + ) + ) + (drop + (i64.ctz + (i64.const -22) + ) + ) + (drop + (i32.popcnt + (i32.const -10) + ) + ) + (drop + (f32.neg + (f32.const -33.61199951171875) + ) + ) + (drop + (f64.abs + (f64.const -9005.841) + ) + ) + (drop + (f32.ceil + (f32.const -33.61199951171875) + ) + ) + (drop + (f64.floor + (f64.const -9005.841) + ) + ) + (drop + (f32.trunc + (f32.const -33.61199951171875) + ) + ) + (drop + (f32.nearest + (f32.const -33.61199951171875) + ) + ) + (drop + (f64.sqrt + (f64.const -9005.841) + ) + ) + (drop + (i32.eqz + (i32.const -10) + ) + ) + (drop + (i64.extend_s/i32 + (i32.const -10) + ) + ) + (drop + (i64.extend_u/i32 + (i32.const -10) + ) + ) + (drop + (i32.wrap/i64 + (i64.const -22) + ) + ) + (drop + (i32.trunc_s/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_s/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_u/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_u/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_s/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_s/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.trunc_u/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_u/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.trunc_s:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_s:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_u:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_u:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_s:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_s:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.trunc_u:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_u:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.reinterpret/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.reinterpret/f64 + (f64.const -9005.841) + ) + ) + (drop + (f32.convert_s/i32 + (i32.const -10) + ) + ) + (drop + (f64.convert_s/i32 + (i32.const -10) + ) + ) + (drop + (f32.convert_u/i32 + (i32.const -10) + ) + ) + (drop + (f64.convert_u/i32 + (i32.const -10) + ) + ) + (drop + (f32.convert_s/i64 + (i64.const -22) + ) + ) + (drop + (f64.convert_s/i64 + (i64.const -22) + ) + ) + (drop + (f32.convert_u/i64 + (i64.const -22) + ) + ) + (drop + (f64.convert_u/i64 + (i64.const -22) + ) + ) + (drop + (f64.promote/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (f32.demote/f64 + (f64.const -9005.841) + ) + ) + (drop + (f32.reinterpret/i32 + (i32.const -10) + ) + ) + (drop + (f64.reinterpret/i64 + (i64.const -22) + ) + ) + (drop + (i8x16.splat + (i32.const -10) + ) + ) + (drop + (i16x8.splat + (i32.const -10) + ) + ) + (drop + (i32x4.splat + (i32.const -10) + ) + ) + (drop + (i64x2.splat + (i64.const -22) + ) + ) + (drop + (f32x4.splat + (f32.const -33.61199951171875) + ) + ) + (drop + (f64x2.splat + (f64.const -9005.841) + ) + ) + (drop + (v128.not + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_s/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_u/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_s/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_u/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_s/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_u/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_s/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_u/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32.add + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (f64.sub + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (i32.div_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.div_u + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (i64.rem_s + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (i32.rem_u + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i32.and + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.or + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (i32.xor + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.shl + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (i64.shr_u + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (i32.shr_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i32.rotl + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.rotr + (i64.const -22) + (i64.const -23) + ) ) - (block - (drop - (i32.const -3) + (drop + (f32.div + (f32.const -33.61199951171875) + (f32.const -62.5) ) - (br $block$3$break) ) - ) - ) - (block - (drop - (i32.const -2) - ) - (br $block$3$break) - ) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - (func $if-else (; 10 ;) (type $v) - (local $0 i32) - (block $block$4$break - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (call $check - (i32.const 1) - ) - (block - (br $block$4$break) - ) - ) - (block - (call $check - (i32.const 2) - ) - (block - (br $block$4$break) - ) - ) - ) - ) - (block - (call $check - (i32.const 3) - ) - ) - ) - (func $loop-tail (; 11 ;) (type $v) - (local $0 i32) - (block $block$3$break - (loop $shape$0$continue - (block - (call $check - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - ) - (if - (i32.const 10) - (br $shape$0$continue) - (br $block$3$break) - ) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - (func $nontrivial-loop-plus-phi-to-head (; 12 ;) (type $v) - (local $0 i32) - (block $block$2$break - (call $check - (i32.const 0) - ) - (block - (drop - (i32.const 10) - ) - (br $block$2$break) - ) - ) - (block - (block $block$7$break - (block $block$4$break - (loop $shape$1$continue - (block $block$3$break - (call $check - (i32.const 1) + (drop + (f64.copysign + (f64.const -9005.841) + (f64.const -9007.333) ) - (if - (i32.const -2) - (br $block$3$break) - (block - (drop - (i32.const 20) - ) - (br $block$7$break) - ) + ) + (drop + (f32.min + (f32.const -33.61199951171875) + (f32.const -62.5) ) ) - (block - (call $check - (i32.const 2) + (drop + (f64.max + (f64.const -9005.841) + (f64.const -9007.333) ) - (if - (i32.const -6) - (br $block$4$break) - (block - (drop - (i32.const 30) - ) - (br $shape$1$continue) - ) + ) + (drop + (i32.eq + (i32.const -10) + (i32.const -11) ) ) - ) - ) - (block - (block $block$6$break - (call $check - (i32.const 3) + (drop + (f32.ne + (f32.const -33.61199951171875) + (f32.const -62.5) + ) ) - (if - (i32.const -10) - (block - (call $check - (i32.const 4) - ) - (block - (br $block$6$break) - ) + (drop + (i32.lt_s + (i32.const -10) + (i32.const -11) ) - (br $block$6$break) ) - ) - (block - (call $check - (i32.const 5) + (drop + (i64.lt_u + (i64.const -22) + (i64.const -23) + ) ) - (block - (drop - (i32.const 40) + (drop + (i64.le_s + (i64.const -22) + (i64.const -23) ) - (br $block$7$break) ) - ) - ) - ) - (block - (call $check - (i32.const 6) - ) - ) - ) - ) - (func $switch (; 13 ;) (type $v) - (local $0 i32) - (call $check - (i32.const 0) - ) - (block $switch$1$leave - (block $switch$1$default - (block $switch$1$case$3 - (block $switch$1$case$2 - (br_table $switch$1$default $switch$1$default $switch$1$case$2 $switch$1$default $switch$1$case$3 $switch$1$case$2 $switch$1$default - (i32.const -99) + (drop + (i32.le_u + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.gt_s + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (i32.gt_u + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i32.ge_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.ge_u + (i64.const -22) + (i64.const -23) + ) + ) + (drop + (f32.lt + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + ) + (drop + (f64.le + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (f64.gt + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (f32.ge + (f32.const -33.61199951171875) + (f32.const -62.5) + ) ) - ) - (block - (block - (call $check - (i32.const 1) + (drop + (i8x16.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - ) - (br $switch$1$leave) - ) - (block - (drop - (i32.const 55) - ) - (block - (call $check - (i32.const 2) + (drop + (i8x16.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - ) - ) - (br $switch$1$leave) - ) - (block - (block - (call $check - (i32.const 3) - ) - ) - ) - (br $switch$1$leave) - ) - ) - (func $duffs-device (; 14 ;) (type $v) - (local $0 i32) - (local $1 i32) - (local $2 i64) - (local $3 i32) - (local $4 f32) - (local $5 f64) - (local $6 i32) - (block - (block $block$3$break - (block $block$2$break - (call $check - (i32.const 0) - ) - (if - (i32.const 10) - (block - (set_local $3 - (i32.const 2) + (drop + (i8x16.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$2$break) ) - (block - (set_local $3 - (i32.const 3) + (drop + (i8x16.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$3$break) ) - ) - ) - ) - ) - (loop $shape$1$continue - (if - (i32.eq - (get_local $3) - (i32.const 2) - ) - (block - (set_local $3 - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - (block - (set_local $3 - (i32.const 3) + (drop + (i8x16.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br $shape$1$continue) - ) - ) - (if - (i32.eq - (get_local $3) - (i32.const 3) - ) - (block - (set_local $3 - (i32.const 0) + (drop + (i8x16.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (call $check - (i32.const 2) + (drop + (i8x16.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (block - (set_local $3 - (i32.const 2) + (drop + (i8x16.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $shape$1$continue) ) - ) - ) - ) - ) - ) - (func $return (; 15 ;) (type $i) (result i32) - (local $0 i32) - (block - (call $check - (i32.const 42) - ) - (return - (i32.const 1337) - ) - ) - ) -) -optimized: -(module -) -module loaded from binary form: -(module - (type $0 (func (param i32 i32) (result i32))) - (func $adder (; 0 ;) (type $0) (param $0 i32) (param $1 i32) (result i32) - (i32.add - (get_local $0) - (get_local $1) - ) - ) -) -(module - (type $vi (func (param i32))) - (type $v (func)) - (import "spectest" "print" (func $print-i32 (param i32))) - (start $starter) - (func $starter (; 1 ;) (type $v) - (call $print-i32 - (i32.const 1234) - ) - ) -) -(i32.const 1234) -(module - (type $v (func)) - (func $func (; 0 ;) (type $v) - (local $0 i32) - (set_local $0 - (i64.const 1234) - ) - ) -) -validation: 0 -// beginning a Binaryen API trace -#include -#include -#include "src/binaryen-c.h" -int main() { - std::map functionTypes; - std::map expressions; - std::map functions; - std::map globals; - std::map exports; - std::map relooperBlocks; - BinaryenModuleRef the_module = NULL; - RelooperRef the_relooper = NULL; - the_module = BinaryenModuleCreate(); - expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); - expressions[1] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt64(2)); - expressions[3] = BinaryenConst(the_module, BinaryenLiteralFloat32(3.14)); - expressions[4] = BinaryenConst(the_module, BinaryenLiteralFloat64(2.1828)); - expressions[5] = BinaryenConst(the_module, BinaryenLiteralFloat32(NAN)); - expressions[6] = BinaryenConst(the_module, BinaryenLiteralFloat64(NAN)); - expressions[7] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); - expressions[8] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); - expressions[9] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); - expressions[10] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); - expressions[11] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); - expressions[12] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); - expressions[13] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); - expressions[14] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); - expressions[15] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); - expressions[16] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); - { - BinaryenType paramTypes[] = { 1, 2, 3, 4 }; - functionTypes[0] = BinaryenAddFunctionType(the_module, "iiIfF", 1, paramTypes, 4); - } - expressions[17] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[18] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[19] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[20] = BinaryenConst(the_module, BinaryenLiteralInt32(4)); - expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); - expressions[22] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[23] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[24] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[25] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[26] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[27] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[28] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); - expressions[29] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); - expressions[30] = BinaryenConst(the_module, BinaryenLiteralInt32(11)); - expressions[31] = BinaryenConst(the_module, BinaryenLiteralInt32(110)); - expressions[32] = BinaryenConst(the_module, BinaryenLiteralInt64(111)); - expressions[33] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[34] = BinaryenUnary(the_module, 0, expressions[33]); - expressions[35] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[36] = BinaryenUnary(the_module, 3, expressions[35]); - expressions[37] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[38] = BinaryenUnary(the_module, 4, expressions[37]); - expressions[39] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[40] = BinaryenUnary(the_module, 6, expressions[39]); - expressions[41] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[42] = BinaryenUnary(the_module, 9, expressions[41]); - expressions[43] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[44] = BinaryenUnary(the_module, 10, expressions[43]); - expressions[45] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[46] = BinaryenUnary(the_module, 13, expressions[45]); - expressions[47] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[48] = BinaryenUnary(the_module, 14, expressions[47]); - expressions[49] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[50] = BinaryenUnary(the_module, 16, expressions[49]); - expressions[51] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[52] = BinaryenUnary(the_module, 19, expressions[51]); - expressions[53] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[54] = BinaryenUnary(the_module, 20, expressions[53]); - expressions[55] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[56] = BinaryenUnary(the_module, 22, expressions[55]); - expressions[57] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[58] = BinaryenUnary(the_module, 23, expressions[57]); - expressions[59] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[60] = BinaryenUnary(the_module, 24, expressions[59]); - expressions[61] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[62] = BinaryenUnary(the_module, 25, expressions[61]); - expressions[63] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[64] = BinaryenUnary(the_module, 26, expressions[63]); - expressions[65] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[66] = BinaryenUnary(the_module, 27, expressions[65]); - expressions[67] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[68] = BinaryenUnary(the_module, 28, expressions[67]); - expressions[69] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[70] = BinaryenUnary(the_module, 29, expressions[69]); - expressions[71] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[72] = BinaryenUnary(the_module, 30, expressions[71]); - expressions[73] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[74] = BinaryenUnary(the_module, 31, expressions[73]); - expressions[75] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[76] = BinaryenUnary(the_module, 32, expressions[75]); - expressions[77] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[78] = BinaryenUnary(the_module, 52, expressions[77]); - expressions[79] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[80] = BinaryenUnary(the_module, 56, expressions[79]); - expressions[81] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[82] = BinaryenUnary(the_module, 53, expressions[81]); - expressions[83] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[84] = BinaryenUnary(the_module, 57, expressions[83]); - expressions[85] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[86] = BinaryenUnary(the_module, 54, expressions[85]); - expressions[87] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[88] = BinaryenUnary(the_module, 58, expressions[87]); - expressions[89] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[90] = BinaryenUnary(the_module, 55, expressions[89]); - expressions[91] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[92] = BinaryenUnary(the_module, 59, expressions[91]); - expressions[93] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[94] = BinaryenUnary(the_module, 33, expressions[93]); - expressions[95] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[96] = BinaryenUnary(the_module, 34, expressions[95]); - expressions[97] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[98] = BinaryenUnary(the_module, 35, expressions[97]); - expressions[99] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[100] = BinaryenUnary(the_module, 36, expressions[99]); - expressions[101] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[102] = BinaryenUnary(the_module, 37, expressions[101]); - expressions[103] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[104] = BinaryenUnary(the_module, 38, expressions[103]); - expressions[105] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[106] = BinaryenUnary(the_module, 39, expressions[105]); - expressions[107] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[108] = BinaryenUnary(the_module, 40, expressions[107]); - expressions[109] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[110] = BinaryenUnary(the_module, 41, expressions[109]); - expressions[111] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[112] = BinaryenUnary(the_module, 42, expressions[111]); - expressions[113] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[114] = BinaryenUnary(the_module, 43, expressions[113]); - expressions[115] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[116] = BinaryenUnary(the_module, 44, expressions[115]); - expressions[117] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[118] = BinaryenUnary(the_module, 45, expressions[117]); - expressions[119] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[120] = BinaryenUnary(the_module, 46, expressions[119]); - expressions[121] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[122] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[123] = BinaryenBinary(the_module, 0, expressions[122], expressions[121]); - expressions[124] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[125] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[126] = BinaryenBinary(the_module, 64, expressions[125], expressions[124]); - expressions[127] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[128] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[129] = BinaryenBinary(the_module, 3, expressions[128], expressions[127]); - expressions[130] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[131] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[132] = BinaryenBinary(the_module, 29, expressions[131], expressions[130]); - expressions[133] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[134] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[135] = BinaryenBinary(the_module, 30, expressions[134], expressions[133]); - expressions[136] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[137] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[138] = BinaryenBinary(the_module, 6, expressions[137], expressions[136]); - expressions[139] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[140] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[141] = BinaryenBinary(the_module, 7, expressions[140], expressions[139]); - expressions[142] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[143] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[144] = BinaryenBinary(the_module, 33, expressions[143], expressions[142]); - expressions[145] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[146] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[147] = BinaryenBinary(the_module, 9, expressions[146], expressions[145]); - expressions[148] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[149] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[150] = BinaryenBinary(the_module, 35, expressions[149], expressions[148]); - expressions[151] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[152] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[153] = BinaryenBinary(the_module, 36, expressions[152], expressions[151]); - expressions[154] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[155] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[156] = BinaryenBinary(the_module, 12, expressions[155], expressions[154]); - expressions[157] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[158] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[159] = BinaryenBinary(the_module, 13, expressions[158], expressions[157]); - expressions[160] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[161] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[162] = BinaryenBinary(the_module, 39, expressions[161], expressions[160]); - expressions[163] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[164] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[165] = BinaryenBinary(the_module, 53, expressions[164], expressions[163]); - expressions[166] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[167] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[168] = BinaryenBinary(the_module, 67, expressions[167], expressions[166]); - expressions[169] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[170] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[171] = BinaryenBinary(the_module, 55, expressions[170], expressions[169]); - expressions[172] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[173] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[174] = BinaryenBinary(the_module, 69, expressions[173], expressions[172]); - expressions[175] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[176] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[177] = BinaryenBinary(the_module, 15, expressions[176], expressions[175]); - expressions[178] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[179] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[180] = BinaryenBinary(the_module, 58, expressions[179], expressions[178]); - expressions[181] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[182] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[183] = BinaryenBinary(the_module, 17, expressions[182], expressions[181]); - expressions[184] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[185] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[186] = BinaryenBinary(the_module, 43, expressions[185], expressions[184]); - expressions[187] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[188] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[189] = BinaryenBinary(the_module, 44, expressions[188], expressions[187]); - expressions[190] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[191] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[192] = BinaryenBinary(the_module, 20, expressions[191], expressions[190]); - expressions[193] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[194] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[195] = BinaryenBinary(the_module, 46, expressions[194], expressions[193]); - expressions[196] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[197] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[198] = BinaryenBinary(the_module, 22, expressions[197], expressions[196]); - expressions[199] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[200] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[201] = BinaryenBinary(the_module, 23, expressions[200], expressions[199]); - expressions[202] = BinaryenConst(the_module, BinaryenLiteralInt64(-23)); - expressions[203] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[204] = BinaryenBinary(the_module, 49, expressions[203], expressions[202]); - expressions[205] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[206] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[207] = BinaryenBinary(the_module, 59, expressions[206], expressions[205]); - expressions[208] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[209] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[210] = BinaryenBinary(the_module, 73, expressions[209], expressions[208]); - expressions[211] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[212] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[213] = BinaryenBinary(the_module, 74, expressions[212], expressions[211]); - expressions[214] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[215] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[216] = BinaryenBinary(the_module, 62, expressions[215], expressions[214]); - { - BinaryenExpressionRef children[] = { 0 }; - expressions[217] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto()); - } - expressions[218] = BinaryenIf(the_module, expressions[17], expressions[18], expressions[19]); - expressions[219] = BinaryenIf(the_module, expressions[20], expressions[21], expressions[0]); - expressions[220] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[221] = BinaryenLoop(the_module, "in", expressions[220]); - expressions[222] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[223] = BinaryenLoop(the_module, NULL, expressions[222]); - expressions[224] = BinaryenBreak(the_module, "the-value", expressions[22], expressions[23]); - expressions[225] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[226] = BinaryenBreak(the_module, "the-nothing", expressions[225], expressions[0]); - expressions[227] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[228] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[227]); - expressions[229] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]); - { - const char* names[] = { "the-value" }; - expressions[230] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[24], expressions[25]); - } - expressions[231] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - { - const char* names[] = { "the-nothing" }; - expressions[232] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[231], expressions[0]); - } - { - BinaryenExpressionRef operands[] = { expressions[9], expressions[10], expressions[11], expressions[12] }; - expressions[233] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); - } - expressions[234] = BinaryenUnary(the_module, 20, expressions[233]); - { - BinaryenExpressionRef operands[] = { expressions[7], expressions[8] }; - expressions[235] = BinaryenCall(the_module, "an-imported", operands, 2, 3); - } - expressions[236] = BinaryenUnary(the_module, 25, expressions[235]); - expressions[237] = BinaryenUnary(the_module, 20, expressions[236]); - expressions[238] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); - { - BinaryenExpressionRef operands[] = { expressions[13], expressions[14], expressions[15], expressions[16] }; - expressions[239] = BinaryenCallIndirect(the_module, expressions[238], operands, 4, "iiIfF"); - } - expressions[240] = BinaryenUnary(the_module, 20, expressions[239]); - expressions[241] = BinaryenGetLocal(the_module, 0, 1); - expressions[242] = BinaryenDrop(the_module, expressions[241]); - expressions[243] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); - expressions[244] = BinaryenSetLocal(the_module, 0, expressions[243]); - expressions[245] = BinaryenConst(the_module, BinaryenLiteralInt32(102)); - expressions[246] = BinaryenTeeLocal(the_module, 0, expressions[245]); - expressions[247] = BinaryenDrop(the_module, expressions[246]); - expressions[248] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[249] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[248]); - expressions[250] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); - expressions[251] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[250]); - expressions[252] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[253] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[252]); - expressions[254] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); - expressions[255] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[254]); - expressions[256] = BinaryenStore(the_module, 4, 0, 0, expressions[29], expressions[30], 1); - expressions[257] = BinaryenStore(the_module, 8, 2, 4, expressions[31], expressions[32], 2); - expressions[258] = BinaryenSelect(the_module, expressions[26], expressions[27], expressions[28]); - expressions[259] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); - expressions[260] = BinaryenReturn(the_module, expressions[259]); - expressions[261] = BinaryenNop(the_module); - expressions[262] = BinaryenUnreachable(the_module); - BinaryenExpressionPrint(expressions[40]); -(f32.neg - (f32.const -33.61199951171875) -) - { - BinaryenExpressionRef children[] = { expressions[34], expressions[36], expressions[38], expressions[40], expressions[42], - expressions[44], expressions[46], expressions[48], expressions[50], expressions[52], expressions[54], - expressions[56], expressions[58], expressions[60], expressions[62], expressions[64], expressions[66], - expressions[68], expressions[70], expressions[72], expressions[74], expressions[76], expressions[78], - expressions[80], expressions[82], expressions[84], expressions[86], expressions[88], expressions[90], - expressions[92], expressions[94], expressions[96], expressions[98], expressions[100], expressions[102], - expressions[104], expressions[106], expressions[108], expressions[110], expressions[112], expressions[114], - expressions[116], expressions[118], expressions[120], expressions[123], expressions[126], expressions[129], - expressions[132], expressions[135], expressions[138], expressions[141], expressions[144], expressions[147], - expressions[150], expressions[153], expressions[156], expressions[159], expressions[162], expressions[165], - expressions[168], expressions[171], expressions[174], expressions[177], expressions[180], expressions[183], - expressions[186], expressions[189], expressions[192], expressions[195], expressions[198], expressions[201], - expressions[204], expressions[207], expressions[210], expressions[213], expressions[216], expressions[217], - expressions[218], expressions[219], expressions[221], expressions[223], expressions[224], expressions[226], - expressions[228], expressions[229], expressions[230], expressions[232], expressions[234], expressions[237], - expressions[240], expressions[242], expressions[244], expressions[247], expressions[249], expressions[251], - expressions[253], expressions[255], expressions[256], expressions[257], expressions[258], expressions[260], - expressions[261], expressions[262] }; - expressions[263] = BinaryenBlock(the_module, "the-value", children, 103, BinaryenTypeAuto()); - } - expressions[264] = BinaryenDrop(the_module, expressions[263]); - { - BinaryenExpressionRef children[] = { expressions[264] }; - expressions[265] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto()); - } - expressions[266] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); - { - BinaryenExpressionRef children[] = { expressions[265], expressions[266] }; - expressions[267] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); - } - { - BinaryenType varTypes[] = { 1 }; - functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[267]); - } - expressions[268] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); - BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[268]); - expressions[269] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); - BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[269]); - { - BinaryenType paramTypes[] = { 1, 4 }; - functionTypes[1] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); - } - BinaryenAddFunctionImport(the_module, "an-imported", "module", "base", functionTypes[1]); - exports[0] = BinaryenAddFunctionExport(the_module, "kitchen()sinker", "kitchen_sinker"); - BinaryenFunctionGetName(functions[0]); - { - const char* funcNames[] = { "kitchen()sinker" }; - BinaryenSetFunctionTable(the_module, 1, 1, funcNames, 1); - } - expressions[270] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); - { - const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; - const char* segments[] = { segment0 }; - BinaryenExpressionRef segmentOffsets[] = { expressions[270] }; - BinaryenIndex segmentSizes[] = { 12 }; - BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0); - } - { - BinaryenType paramTypes[] = { 0 }; - functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); - } - expressions[271] = BinaryenNop(the_module); - { - BinaryenType varTypes[] = { 0 }; - functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[271]); - } - BinaryenSetStart(the_module, functions[1]); - { - BinaryenType paramTypes[] = { 0 }; - functionTypes[3] = BinaryenAddFunctionType(the_module, NULL, 0, paramTypes, 0); - } - BinaryenModuleAutoDrop(the_module); - BinaryenModuleValidate(the_module); - BinaryenModulePrint(the_module); -(module - (type $iiIfF (func (param i32 i64 f32 f64) (result i32))) - (type $fiF (func (param i32 f64) (result f32))) - (type $v (func)) - (type $3 (func)) - (import "module" "base" (func $an-imported (param i32 f64) (result f32))) - (memory $0 1 256) - (data (i32.const 10) "hello, world") - (table $0 1 1 anyfunc) - (elem (i32.const 0) "$kitchen()sinker") - (global $a-global i32 (i32.const 7)) - (global $a-mutable-global (mut f32) (f32.const 7.5)) - (export "kitchen_sinker" (func "$kitchen()sinker")) - (export "mem" (memory $0)) - (start $starter) - (func "$kitchen()sinker" (; 1 ;) (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) - (local $4 i32) - (block $the-body (result i32) - (block $the-nothing - (drop - (block $the-value (result i32) (drop - (i32.clz - (i32.const -10) + (i16x8.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.ctz - (i64.const -22) + (i16x8.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.popcnt - (i32.const -10) + (i16x8.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.neg - (f32.const -33.61199951171875) + (i16x8.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.abs - (f64.const -9005.841) + (i16x8.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.ceil - (f32.const -33.61199951171875) + (i16x8.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.floor - (f64.const -9005.841) + (i16x8.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.trunc - (f32.const -33.61199951171875) + (i16x8.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.nearest - (f32.const -33.61199951171875) + (i16x8.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.sqrt - (f64.const -9005.841) + (i16x8.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eqz - (i32.const -10) + (i32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.extend_s/i32 - (i32.const -10) + (i32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.extend_u/i32 - (i32.const -10) + (i32x4.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.wrap/i64 - (i64.const -22) + (i32x4.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s/f32 - (f32.const -33.61199951171875) + (i32x4.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s/f32 - (f32.const -33.61199951171875) + (i32x4.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u/f32 - (f32.const -33.61199951171875) + (i32x4.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u/f32 - (f32.const -33.61199951171875) + (i32x4.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s/f64 - (f64.const -9005.841) + (i32x4.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s/f64 - (f64.const -9005.841) + (i32x4.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u/f64 - (f64.const -9005.841) + (f32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u/f64 - (f64.const -9005.841) + (f32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s:sat/f32 - (f32.const -33.61199951171875) + (f32x4.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s:sat/f32 - (f32.const -33.61199951171875) + (f32x4.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u:sat/f32 - (f32.const -33.61199951171875) + (f32x4.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u:sat/f32 - (f32.const -33.61199951171875) + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s:sat/f64 - (f64.const -9005.841) + (f64x2.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s:sat/f64 - (f64.const -9005.841) + (f64x2.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u:sat/f64 - (f64.const -9005.841) + (f64x2.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u:sat/f64 - (f64.const -9005.841) + (f64x2.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.reinterpret/f32 - (f32.const -33.61199951171875) + (f64x2.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.reinterpret/f64 - (f64.const -9005.841) + (f64x2.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_s/i32 - (i32.const -10) + (v128.and + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_s/i32 - (i32.const -10) + (v128.or + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_u/i32 - (i32.const -10) + (v128.xor + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_u/i32 - (i32.const -10) + (i8x16.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_s/i64 - (i64.const -22) + (i8x16.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_s/i64 - (i64.const -22) + (i8x16.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_u/i64 - (i64.const -22) + (i8x16.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_u/i64 - (i64.const -22) + (i8x16.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.promote/f32 - (f32.const -33.61199951171875) + (i8x16.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.demote/f64 - (f64.const -9005.841) + (i8x16.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.reinterpret/i32 - (i32.const -10) + (i16x8.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.reinterpret/i64 - (i64.const -22) + (i16x8.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.add - (i32.const -10) - (i32.const -11) + (i16x8.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.sub - (f64.const -9005.841) - (f64.const -9007.333) + (i16x8.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.div_s - (i32.const -10) - (i32.const -11) + (i16x8.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.div_u - (i64.const -22) - (i64.const -23) + (i16x8.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.rem_s - (i64.const -22) - (i64.const -23) + (i16x8.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.rem_u - (i32.const -10) - (i32.const -11) + (i32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.and - (i32.const -10) - (i32.const -11) + (i32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.or - (i64.const -22) - (i64.const -23) + (i32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.xor - (i32.const -10) - (i32.const -11) + (i64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.shl - (i64.const -22) - (i64.const -23) + (i64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.shr_u - (i64.const -22) - (i64.const -23) + (f32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.shr_s - (i32.const -10) - (i32.const -11) + (f32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.rotl - (i32.const -10) - (i32.const -11) + (f32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.rotr - (i64.const -22) - (i64.const -23) + (f32x4.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.div - (f32.const -33.61199951171875) - (f32.const -62.5) + (f32x4.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.copysign - (f64.const -9005.841) - (f64.const -9007.333) + (f32x4.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.min - (f32.const -33.61199951171875) - (f32.const -62.5) + (f64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.max - (f64.const -9005.841) - (f64.const -9007.333) + (f64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eq - (i32.const -10) - (i32.const -11) + (f64x2.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.ne - (f32.const -33.61199951171875) - (f32.const -62.5) + (f64x2.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.lt_s - (i32.const -10) - (i32.const -11) + (f64x2.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.lt_u - (i64.const -22) - (i64.const -23) + (f64x2.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.le_s - (i64.const -22) - (i64.const -23) + (i8x16.extract_lane_s 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.le_u - (i32.const -10) - (i32.const -11) + (i8x16.extract_lane_u 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.gt_s - (i64.const -22) - (i64.const -23) + (i16x8.extract_lane_s 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.gt_u - (i32.const -10) - (i32.const -11) + (i16x8.extract_lane_u 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.ge_s - (i32.const -10) - (i32.const -11) + (i32x4.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.ge_u - (i64.const -22) - (i64.const -23) + (i64x2.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.lt - (f32.const -33.61199951171875) - (f32.const -62.5) + (f32x4.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.le - (f64.const -9005.841) - (f64.const -9007.333) + (f64x2.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.gt - (f64.const -9005.841) - (f64.const -9007.333) + (i8x16.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) ) ) (drop - (f32.ge - (f32.const -33.61199951171875) - (f32.const -62.5) + (i16x8.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i32x4.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i64x2.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i64.const 42) + ) + ) + (drop + (f32x4.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f32.const 42) + ) + ) + (drop + (f64x2.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f64.const 42) + ) + ) + (drop + (i8x16.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (v8x16.shuffle 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.bitselect + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (block diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 4cf98c32938..13213b8a78c 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -242,6 +242,171 @@ (i64.const -22) ) ) + (drop + (i8x16.splat + (i32.const -10) + ) + ) + (drop + (i16x8.splat + (i32.const -10) + ) + ) + (drop + (i32x4.splat + (i32.const -10) + ) + ) + (drop + (i64x2.splat + (i64.const -22) + ) + ) + (drop + (f32x4.splat + (f32.const -33.61199951171875) + ) + ) + (drop + (f64x2.splat + (f64.const -9005.84) + ) + ) + (drop + (v128.not + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_s/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_u/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_s/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_u/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_s/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_u/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_s/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_u/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) (drop (i32.add (i32.const -10) @@ -434,6 +599,629 @@ (f32.const -62.5) ) ) + (drop + (i8x16.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.and + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.or + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.xor + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.extract_lane_s 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.extract_lane_u 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.extract_lane_s 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.extract_lane_u 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.extract_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i16x8.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i32x4.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i64x2.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i64.const 42) + ) + ) + (drop + (f32x4.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f32.const 42) + ) + ) + (drop + (f64x2.replace_lane 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f64.const 42) + ) + ) + (drop + (i8x16.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (v8x16.shuffle 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.bitselect + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) (block ) (if diff --git a/test/simd.wast.fromBinary b/test/simd.wast.fromBinary index ed376651ec5..e3210a891bf 100644 --- a/test/simd.wast.fromBinary +++ b/test/simd.wast.fromBinary @@ -161,25 +161,25 @@ ) ) (func $i8x16.gt_s (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_s + (i8x16.gt_s (get_local $0) (get_local $1) ) ) (func $i8x16.gt_u (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_u + (i8x16.gt_u (get_local $0) (get_local $1) ) ) (func $i8x16.le_s (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_s + (i8x16.le_s (get_local $0) (get_local $1) ) ) (func $i8x16.le_u (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_u + (i8x16.le_u (get_local $0) (get_local $1) ) @@ -221,25 +221,25 @@ ) ) (func $i16x8.gt_s (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_s + (i16x8.gt_s (get_local $0) (get_local $1) ) ) (func $i16x8.gt_u (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_u + (i16x8.gt_u (get_local $0) (get_local $1) ) ) (func $i16x8.le_s (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_s + (i16x8.le_s (get_local $0) (get_local $1) ) ) (func $i16x8.le_u (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_u + (i16x8.le_u (get_local $0) (get_local $1) ) @@ -281,25 +281,25 @@ ) ) (func $i32x4.gt_s (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_s + (i32x4.gt_s (get_local $0) (get_local $1) ) ) (func $i32x4.gt_u (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_u + (i32x4.gt_u (get_local $0) (get_local $1) ) ) (func $i32x4.le_s (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_s + (i32x4.le_s (get_local $0) (get_local $1) ) ) (func $i32x4.le_u (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_u + (i32x4.le_u (get_local $0) (get_local $1) ) @@ -335,13 +335,13 @@ ) ) (func $f32x4.gt (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.le + (f32x4.gt (get_local $0) (get_local $1) ) ) (func $f32x4.le (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.gt + (f32x4.le (get_local $0) (get_local $1) ) @@ -371,13 +371,13 @@ ) ) (func $f64x2.gt (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.le + (f64x2.gt (get_local $0) (get_local $1) ) ) (func $f64x2.le (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.gt + (f64x2.le (get_local $0) (get_local $1) ) diff --git a/test/simd.wast.fromBinary.noDebugInfo b/test/simd.wast.fromBinary.noDebugInfo index 7bad89e98c5..e2d5c964770 100644 --- a/test/simd.wast.fromBinary.noDebugInfo +++ b/test/simd.wast.fromBinary.noDebugInfo @@ -161,25 +161,25 @@ ) ) (func $27 (; 27 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_s + (i8x16.gt_s (get_local $0) (get_local $1) ) ) (func $28 (; 28 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.le_u + (i8x16.gt_u (get_local $0) (get_local $1) ) ) (func $29 (; 29 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_s + (i8x16.le_s (get_local $0) (get_local $1) ) ) (func $30 (; 30 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i8x16.gt_u + (i8x16.le_u (get_local $0) (get_local $1) ) @@ -221,25 +221,25 @@ ) ) (func $37 (; 37 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_s + (i16x8.gt_s (get_local $0) (get_local $1) ) ) (func $38 (; 38 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.le_u + (i16x8.gt_u (get_local $0) (get_local $1) ) ) (func $39 (; 39 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_s + (i16x8.le_s (get_local $0) (get_local $1) ) ) (func $40 (; 40 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i16x8.gt_u + (i16x8.le_u (get_local $0) (get_local $1) ) @@ -281,25 +281,25 @@ ) ) (func $47 (; 47 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_s + (i32x4.gt_s (get_local $0) (get_local $1) ) ) (func $48 (; 48 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.le_u + (i32x4.gt_u (get_local $0) (get_local $1) ) ) (func $49 (; 49 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_s + (i32x4.le_s (get_local $0) (get_local $1) ) ) (func $50 (; 50 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (i32x4.gt_u + (i32x4.le_u (get_local $0) (get_local $1) ) @@ -335,13 +335,13 @@ ) ) (func $56 (; 56 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.le + (f32x4.gt (get_local $0) (get_local $1) ) ) (func $57 (; 57 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f32x4.gt + (f32x4.le (get_local $0) (get_local $1) ) @@ -371,13 +371,13 @@ ) ) (func $62 (; 62 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.le + (f64x2.gt (get_local $0) (get_local $1) ) ) (func $63 (; 63 ;) (type $3) (param $0 v128) (param $1 v128) (result v128) - (f64x2.gt + (f64x2.le (get_local $0) (get_local $1) ) From b4501a6dfe511b33f304f20462dfb639f3757249 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 11:29:04 -0800 Subject: [PATCH 25/36] JS API, C API accessors, and testing --- build-js.sh | 167 + src/binaryen-c.cpp | 149 + src/binaryen-c.h | 102 +- src/js/binaryen.js-post.js | 643 +++- src/literal.h | 1 + src/wasm.h | 1 + src/wasm/literal.cpp | 16 +- test/binaryen.js/kitchen-sink.js | 146 + test/binaryen.js/kitchen-sink.js.txt | 4552 ++++++++++++++++++++------ 9 files changed, 4701 insertions(+), 1076 deletions(-) diff --git a/build-js.sh b/build-js.sh index 201970c0a7b..fb3babdf4c2 100755 --- a/build-js.sh +++ b/build-js.sh @@ -231,6 +231,7 @@ export_function "_BinaryenLiteralInt32" export_function "_BinaryenLiteralInt64" export_function "_BinaryenLiteralFloat32" export_function "_BinaryenLiteralFloat64" +export_function "_BinaryenLiteralVec128" export_function "_BinaryenLiteralFloat32Bits" export_function "_BinaryenLiteralFloat64Bits" @@ -379,6 +380,141 @@ export_function "_BinaryenAtomicRMWAnd" export_function "_BinaryenAtomicRMWOr" export_function "_BinaryenAtomicRMWXor" export_function "_BinaryenAtomicRMWXchg" +export_function "_BinaryenSplatVecI8x16" +export_function "_BinaryenExtractLaneSVecI8x16" +export_function "_BinaryenExtractLaneUVecI8x16" +export_function "_BinaryenReplaceLaneVecI8x16" +export_function "_BinaryenSplatVecI16x8" +export_function "_BinaryenExtractLaneSVecI16x8" +export_function "_BinaryenExtractLaneUVecI16x8" +export_function "_BinaryenReplaceLaneVecI16x8" +export_function "_BinaryenSplatVecI32x4" +export_function "_BinaryenExtractLaneVecI32x4" +export_function "_BinaryenReplaceLaneVecI32x4" +export_function "_BinaryenSplatVecI64x2" +export_function "_BinaryenExtractLaneVecI64x2" +export_function "_BinaryenReplaceLaneVecI64x2" +export_function "_BinaryenSplatVecF32x4" +export_function "_BinaryenExtractLaneVecF32x4" +export_function "_BinaryenReplaceLaneVecF32x4" +export_function "_BinaryenSplatVecF64x2" +export_function "_BinaryenExtractLaneVecF64x2" +export_function "_BinaryenReplaceLaneVecF64x2" +export_function "_BinaryenEqVecI8x16" +export_function "_BinaryenNeVecI8x16" +export_function "_BinaryenLtSVecI8x16" +export_function "_BinaryenLtUVecI8x16" +export_function "_BinaryenGtSVecI8x16" +export_function "_BinaryenGtUVecI8x16" +export_function "_BinaryenLeSVecI8x16" +export_function "_BinaryenLeUVecI8x16" +export_function "_BinaryenGeSVecI8x16" +export_function "_BinaryenGeUVecI8x16" +export_function "_BinaryenEqVecI16x8" +export_function "_BinaryenNeVecI16x8" +export_function "_BinaryenLtSVecI16x8" +export_function "_BinaryenLtUVecI16x8" +export_function "_BinaryenGtSVecI16x8" +export_function "_BinaryenGtUVecI16x8" +export_function "_BinaryenLeSVecI16x8" +export_function "_BinaryenLeUVecI16x8" +export_function "_BinaryenGeSVecI16x8" +export_function "_BinaryenGeUVecI16x8" +export_function "_BinaryenEqVecI32x4" +export_function "_BinaryenNeVecI32x4" +export_function "_BinaryenLtSVecI32x4" +export_function "_BinaryenLtUVecI32x4" +export_function "_BinaryenGtSVecI32x4" +export_function "_BinaryenGtUVecI32x4" +export_function "_BinaryenLeSVecI32x4" +export_function "_BinaryenLeUVecI32x4" +export_function "_BinaryenGeSVecI32x4" +export_function "_BinaryenGeUVecI32x4" +export_function "_BinaryenEqVecF32x4" +export_function "_BinaryenNeVecF32x4" +export_function "_BinaryenLtVecF32x4" +export_function "_BinaryenGtVecF32x4" +export_function "_BinaryenLeVecF32x4" +export_function "_BinaryenGeVecF32x4" +export_function "_BinaryenEqVecF64x2" +export_function "_BinaryenNeVecF64x2" +export_function "_BinaryenLtVecF64x2" +export_function "_BinaryenGtVecF64x2" +export_function "_BinaryenLeVecF64x2" +export_function "_BinaryenGeVecF64x2" +export_function "_BinaryenNotVec128" +export_function "_BinaryenAndVec128" +export_function "_BinaryenOrVec128" +export_function "_BinaryenXorVec128" +export_function "_BinaryenNegVecI8x16" +export_function "_BinaryenAnyTrueVecI8x16" +export_function "_BinaryenAllTrueVecI8x16" +export_function "_BinaryenShlVecI8x16" +export_function "_BinaryenShrSVecI8x16" +export_function "_BinaryenShrUVecI8x16" +export_function "_BinaryenAddVecI8x16" +export_function "_BinaryenAddSatSVecI8x16" +export_function "_BinaryenAddSatUVecI8x16" +export_function "_BinaryenSubVecI8x16" +export_function "_BinaryenSubSatSVecI8x16" +export_function "_BinaryenSubSatUVecI8x16" +export_function "_BinaryenMulVecI8x16" +export_function "_BinaryenNegVecI16x8" +export_function "_BinaryenAnyTrueVecI16x8" +export_function "_BinaryenAllTrueVecI16x8" +export_function "_BinaryenShlVecI16x8" +export_function "_BinaryenShrSVecI16x8" +export_function "_BinaryenShrUVecI16x8" +export_function "_BinaryenAddVecI16x8" +export_function "_BinaryenAddSatSVecI16x8" +export_function "_BinaryenAddSatUVecI16x8" +export_function "_BinaryenSubVecI16x8" +export_function "_BinaryenSubSatSVecI16x8" +export_function "_BinaryenSubSatUVecI16x8" +export_function "_BinaryenMulVecI16x8" +export_function "_BinaryenNegVecI32x4" +export_function "_BinaryenAnyTrueVecI32x4" +export_function "_BinaryenAllTrueVecI32x4" +export_function "_BinaryenShlVecI32x4" +export_function "_BinaryenShrSVecI32x4" +export_function "_BinaryenShrUVecI32x4" +export_function "_BinaryenAddVecI32x4" +export_function "_BinaryenSubVecI32x4" +export_function "_BinaryenMulVecI32x4" +export_function "_BinaryenNegVecI64x2" +export_function "_BinaryenAnyTrueVecI64x2" +export_function "_BinaryenAllTrueVecI64x2" +export_function "_BinaryenShlVecI64x2" +export_function "_BinaryenShrSVecI64x2" +export_function "_BinaryenShrUVecI64x2" +export_function "_BinaryenAddVecI64x2" +export_function "_BinaryenSubVecI64x2" +export_function "_BinaryenAbsVecF32x4" +export_function "_BinaryenNegVecF32x4" +export_function "_BinaryenSqrtVecF32x4" +export_function "_BinaryenAddVecF32x4" +export_function "_BinaryenSubVecF32x4" +export_function "_BinaryenMulVecF32x4" +export_function "_BinaryenDivVecF32x4" +export_function "_BinaryenMinVecF32x4" +export_function "_BinaryenMaxVecF32x4" +export_function "_BinaryenAbsVecF64x2" +export_function "_BinaryenNegVecF64x2" +export_function "_BinaryenSqrtVecF64x2" +export_function "_BinaryenAddVecF64x2" +export_function "_BinaryenSubVecF64x2" +export_function "_BinaryenMulVecF64x2" +export_function "_BinaryenDivVecF64x2" +export_function "_BinaryenMinVecF64x2" +export_function "_BinaryenMaxVecF64x2" +export_function "_BinaryenTruncSatSVecF32x4ToVecI32x4" +export_function "_BinaryenTruncSatUVecF32x4ToVecI32x4" +export_function "_BinaryenTruncSatSVecF64x2ToVecI64x2" +export_function "_BinaryenTruncSatUVecF64x2ToVecI64x2" +export_function "_BinaryenConvertSVecI32x4ToVecF32x4" +export_function "_BinaryenConvertUVecI32x4ToVecF32x4" +export_function "_BinaryenConvertSVecI64x2ToVecF64x2" +export_function "_BinaryenConvertUVecI64x2ToVecF64x2" # Expression creation export_function "_BinaryenBlock" @@ -410,6 +546,11 @@ export_function "_BinaryenAtomicRMW" export_function "_BinaryenAtomicCmpxchg" export_function "_BinaryenAtomicWait" export_function "_BinaryenAtomicWake" +export_function "_BinaryenSIMDExtract" +export_function "_BinaryenSIMDReplace" +export_function "_BinaryenSIMDShuffle" +export_function "_BinaryenSIMDBitselect" +export_function "_BinaryenSIMDShift" # 'Expression' operations export_function "_BinaryenExpressionGetId" @@ -540,6 +681,32 @@ export_function "_BinaryenAtomicWaitGetExpectedType" export_function "_BinaryenAtomicWakeGetPtr" export_function "_BinaryenAtomicWakeGetWakeCount" +# 'SIMDExtract' expression operations +export_function "_BinaryenSIMDExtractGetOp" +export_function "_BinaryenSIMDExtractGetVec" +export_function "_BinaryenSIMDExtractGetIdx" + +# 'SIMDReplace' expression operations +export_function "_BinaryenSIMDReplaceGetOp" +export_function "_BinaryenSIMDReplaceGetVec" +export_function "_BinaryenSIMDReplaceGetIdx" +export_function "_BinaryenSIMDReplaceGetValue" + +# 'SIMDShuffle' expression operations +export_function "_BinaryenSIMDShuffleGetLeft" +export_function "_BinaryenSIMDShuffleGetRight" +export_function "_BinaryenSIMDShuffleGetMask" + +# 'SIMDBitselect' expression operations +export_function "_BinaryenSIMDBitselectGetLeft" +export_function "_BinaryenSIMDBitselectGetRight" +export_function "_BinaryenSIMDBitselectGetCond" + +# 'SIMDShift' expression operations +export_function "_BinaryenSIMDShiftGetOp" +export_function "_BinaryenSIMDShiftGetVec" +export_function "_BinaryenSIMDShiftGetShift" + # 'Module' operations export_function "_BinaryenModuleCreate" export_function "_BinaryenModuleDispose" diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 160ccc548b4..6b5481af246 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -1824,6 +1824,155 @@ BinaryenExpressionRef BinaryenAtomicWakeGetWakeCount(BinaryenExpressionRef expr) assert(expression->is()); return static_cast(expression)->wakeCount; } +// SIMDExtract +BinaryenOp BinaryenSIMDExtractGetOp(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDExtractGetOp(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->op; +} +BinaryenExpressionRef BinaryenSIMDExtractGetVec(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDExtractGetVec(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->vec; +} +uint8_t BinaryenSIMDExtractGetIdx(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDExtractGetIdx(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->idx; +} +// SIMDReplace +BinaryenOp BinaryenSIMDReplaceGetOp(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDReplaceGetOp(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->op; +} +BinaryenExpressionRef BinaryenSIMDReplaceGetVec(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDReplaceGetVec(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->vec; +} +uint8_t BinaryenSIMDReplaceGetIdx(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDReplaceGetIdx(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->idx; +} +BinaryenExpressionRef BinaryenSIMDReplaceGetValue(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDReplaceGetValue(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->value; +} +// SIMDShuffle +BinaryenExpressionRef BinaryenSIMDShuffleGetLeft(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDShuffleGetLeft(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->left; +} +BinaryenExpressionRef BinaryenSIMDShuffleGetRight(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDShuffleGetRight(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->right; +} +void BinaryenSIMDShuffleGetMask(BinaryenExpressionRef expr, uint8_t *mask) { + if (tracing) { + std::cout << " BinaryenSIMDShuffleGetMask(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + memcpy(mask, static_cast(expression)->mask.data(), 16); +} +// SIMDBitselect +BinaryenExpressionRef BinaryenSIMDBitselectGetLeft(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDBitselectGetLeft(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->left; +} +BinaryenExpressionRef BinaryenSIMDBitselectGetRight(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDBitselectGetRight(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->right; +} +BinaryenExpressionRef BinaryenSIMDBitselectGetCond(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDBitselectGetCond(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->cond; +} +// SIMDShift +BinaryenOp BinaryenSIMDShiftGetOp(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDShiftGetOp(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->op; +} +BinaryenExpressionRef BinaryenSIMDShiftGetVec(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDShiftGetVec(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->vec; +} +BinaryenExpressionRef BinaryenSIMDShiftGetShift(BinaryenExpressionRef expr) { + if (tracing) { + std::cout << " BinaryenSIMDShiftGetShift(expressions[" << expressions[expr] << "]);\n"; + } + + auto* expression = (Expression*)expr; + assert(expression->is()); + return static_cast(expression)->shift; +} // Functions diff --git a/src/binaryen-c.h b/src/binaryen-c.h index 290ab420823..9d199285142 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -541,191 +541,133 @@ BinaryenExpressionRef BinaryenSIMDShuffle(BinaryenModuleRef module, BinaryenExpr BinaryenExpressionRef BinaryenSIMDBitselect(BinaryenModuleRef module, BinaryenExpressionRef left, BinaryenExpressionRef right, BinaryenExpressionRef cond); BinaryenExpressionRef BinaryenSIMDShift(BinaryenModuleRef module, BinaryenOp op, BinaryenExpressionRef vec, BinaryenExpressionRef shift); -// Gets the id (kind) of the specified expression. BinaryenExpressionId BinaryenExpressionGetId(BinaryenExpressionRef expr); -// Gets the type of the specified expression. BinaryenType BinaryenExpressionGetType(BinaryenExpressionRef expr); -// Prints an expression to stdout. Useful for debugging. void BinaryenExpressionPrint(BinaryenExpressionRef expr); -// Gets the name of the specified `Block` expression. May be `NULL`. const char* BinaryenBlockGetName(BinaryenExpressionRef expr); -// Gets the number of nested child expressions within the specified `Block` expression. BinaryenIndex BinaryenBlockGetNumChildren(BinaryenExpressionRef expr); -// Gets the nested child expression at the specified index within the specified `Block` expression. BinaryenExpressionRef BinaryenBlockGetChild(BinaryenExpressionRef expr, BinaryenIndex index); -// Gets the nested condition expression within the specified `If` expression. BinaryenExpressionRef BinaryenIfGetCondition(BinaryenExpressionRef expr); -// Gets the nested ifTrue expression within the specified `If` expression. BinaryenExpressionRef BinaryenIfGetIfTrue(BinaryenExpressionRef expr); -// Gets the nested ifFalse expression within the specified `If` expression. BinaryenExpressionRef BinaryenIfGetIfFalse(BinaryenExpressionRef expr); -// Gets the name of the specified `Loop` expression. May be `NULL`. const char* BinaryenLoopGetName(BinaryenExpressionRef expr); -// Gets the nested body expression within the specified `Loop` expression. BinaryenExpressionRef BinaryenLoopGetBody(BinaryenExpressionRef expr); -// Gets the name of the specified `Break` expression. May be `NULL`. const char* BinaryenBreakGetName(BinaryenExpressionRef expr); -// Gets the nested condition expression within the specified `Break` expression. Returns `NULL` if this is a `br` and not a `br_if`. BinaryenExpressionRef BinaryenBreakGetCondition(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `Break` expression. May be `NULL`. BinaryenExpressionRef BinaryenBreakGetValue(BinaryenExpressionRef expr); -// Gets the number of names within the specified `Switch` expression. BinaryenIndex BinaryenSwitchGetNumNames(BinaryenExpressionRef expr); -// Gets the name at the specified index within the specified `Switch` expression. const char* BinaryenSwitchGetName(BinaryenExpressionRef expr, BinaryenIndex index); -// Gets the default name of the specified `Switch` expression. const char* BinaryenSwitchGetDefaultName(BinaryenExpressionRef expr); -// Gets the nested condition expression within the specified `Switch` expression. BinaryenExpressionRef BinaryenSwitchGetCondition(BinaryenExpressionRef expr); -// Gets the nested value expression within the specifiedd `Switch` expression. May be `NULL`. BinaryenExpressionRef BinaryenSwitchGetValue(BinaryenExpressionRef expr); -// Gets the name of the target of the specified `Call` expression. const char* BinaryenCallGetTarget(BinaryenExpressionRef expr); -// Gets the number of nested operand expressions within the specified `Call` expression. BinaryenIndex BinaryenCallGetNumOperands(BinaryenExpressionRef expr); -// Gets the nested operand expression at the specified index within the specified `Call` expression. BinaryenExpressionRef BinaryenCallGetOperand(BinaryenExpressionRef expr, BinaryenIndex index); -// Gets the nested target expression of the specified `CallIndirect` expression. BinaryenExpressionRef BinaryenCallIndirectGetTarget(BinaryenExpressionRef expr); -// Gets the number of nested operand expressions within the specified `CallIndirect` expression. BinaryenIndex BinaryenCallIndirectGetNumOperands(BinaryenExpressionRef expr); -// Gets the nested operand expression at the specified index within the specified `CallIndirect` expression. BinaryenExpressionRef BinaryenCallIndirectGetOperand(BinaryenExpressionRef expr, BinaryenIndex index); -// Gets the index of the specified `GetLocal` expression. BinaryenIndex BinaryenGetLocalGetIndex(BinaryenExpressionRef expr); -// Tests if the specified `SetLocal` expression performs a `tee_local` instead of a `set_local`. int BinaryenSetLocalIsTee(BinaryenExpressionRef expr); -// Gets the index of the specified `SetLocal` expression. BinaryenIndex BinaryenSetLocalGetIndex(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `SetLocal` expression. BinaryenExpressionRef BinaryenSetLocalGetValue(BinaryenExpressionRef expr); -// Gets the name of the specified `GetGlobal` expression. const char* BinaryenGetGlobalGetName(BinaryenExpressionRef expr); -// Gets the name of the specified `SetGlobal` expression. const char* BinaryenSetGlobalGetName(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `SetLocal` expression. BinaryenExpressionRef BinaryenSetGlobalGetValue(BinaryenExpressionRef expr); -// Gets the operator of the specified `Host` expression. BinaryenOp BinaryenHostGetOp(BinaryenExpressionRef expr); -// Gets the name operand of the specified `Host` expression. May be `NULL`. const char* BinaryenHostGetNameOperand(BinaryenExpressionRef expr); -// Gets the number of nested operand expressions within the specified `Host` expression. BinaryenIndex BinaryenHostGetNumOperands(BinaryenExpressionRef expr); -// Gets the nested operand expression at the specified index within the specified `Host` expression. BinaryenExpressionRef BinaryenHostGetOperand(BinaryenExpressionRef expr, BinaryenIndex index); -// Tests if the specified `Load` expression is atomic. int BinaryenLoadIsAtomic(BinaryenExpressionRef expr); -// Tests if the specified `Load` expression is signed. int BinaryenLoadIsSigned(BinaryenExpressionRef expr); -// Gets the offset of the specified `Load` expression. uint32_t BinaryenLoadGetOffset(BinaryenExpressionRef expr); -// Gets the byte size of the specified `Load` expression. uint32_t BinaryenLoadGetBytes(BinaryenExpressionRef expr); -// Gets the alignment of the specified `Load` expression. uint32_t BinaryenLoadGetAlign(BinaryenExpressionRef expr); -// Gets the nested pointer expression within the specified `Load` expression. BinaryenExpressionRef BinaryenLoadGetPtr(BinaryenExpressionRef expr); -// Tests if the specified `Store` expression is atomic. int BinaryenStoreIsAtomic(BinaryenExpressionRef expr); -// Gets the byte size of the specified `Store` expression. uint32_t BinaryenStoreGetBytes(BinaryenExpressionRef expr); -// Gets the offset of the specified store expression. uint32_t BinaryenStoreGetOffset(BinaryenExpressionRef expr); -// Gets the alignment of the specified `Store` expression. uint32_t BinaryenStoreGetAlign(BinaryenExpressionRef expr); -// Gets the nested pointer expression within the specified `Store` expression. BinaryenExpressionRef BinaryenStoreGetPtr(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `Store` expression. BinaryenExpressionRef BinaryenStoreGetValue(BinaryenExpressionRef expr); -// Gets the 32-bit integer value of the specified `Const` expression. int32_t BinaryenConstGetValueI32(BinaryenExpressionRef expr); -// Gets the 64-bit integer value of the specified `Const` expression. int64_t BinaryenConstGetValueI64(BinaryenExpressionRef expr); -// Gets the low 32-bits of a 64-bit integer value of the specified `Const` expression. Useful where I64 returning exports are illegal, i.e. binaryen.js. int32_t BinaryenConstGetValueI64Low(BinaryenExpressionRef expr); -// Gets the high 32-bits of a 64-bit integer value of the specified `Const` expression. Useful where I64 returning exports are illegal, i.e. binaryen.js. int32_t BinaryenConstGetValueI64High(BinaryenExpressionRef expr); -// Gets the 32-bit float value of the specified `Const` expression. float BinaryenConstGetValueF32(BinaryenExpressionRef expr); -// Gets the 64-bit float value of the specified `Const` expression. double BinaryenConstGetValueF64(BinaryenExpressionRef expr); -// Gets the operator of the specified `Unary` expression. BinaryenOp BinaryenUnaryGetOp(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `Unary` expression. BinaryenExpressionRef BinaryenUnaryGetValue(BinaryenExpressionRef expr); -// Gets the operator of the specified `Binary` expression. BinaryenOp BinaryenBinaryGetOp(BinaryenExpressionRef expr); -// Gets the nested left expression within the specified `Binary` expression. BinaryenExpressionRef BinaryenBinaryGetLeft(BinaryenExpressionRef expr); -// Gets the nested right expression within the specified `Binary` expression. BinaryenExpressionRef BinaryenBinaryGetRight(BinaryenExpressionRef expr); -// Gets the nested ifTrue expression within the specified `Select` expression. BinaryenExpressionRef BinaryenSelectGetIfTrue(BinaryenExpressionRef expr); -// Gets the nested ifFalse expression within the specified `Select` expression. BinaryenExpressionRef BinaryenSelectGetIfFalse(BinaryenExpressionRef expr); -// Gets the nested condition expression within the specified `Select` expression. BinaryenExpressionRef BinaryenSelectGetCondition(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `Drop` expression. BinaryenExpressionRef BinaryenDropGetValue(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `Return` expression. BinaryenExpressionRef BinaryenReturnGetValue(BinaryenExpressionRef expr); -// Gets the operator of the specified `AtomicRMW` expression. BinaryenOp BinaryenAtomicRMWGetOp(BinaryenExpressionRef expr); -// Gets the byte size of the specified `AtomicRMW` expression. uint32_t BinaryenAtomicRMWGetBytes(BinaryenExpressionRef expr); -// Gets the offset of the specified `AtomicRMW` expression. uint32_t BinaryenAtomicRMWGetOffset(BinaryenExpressionRef expr); -// Gets the nested pointer expression within the specified `AtomicRMW` expression. BinaryenExpressionRef BinaryenAtomicRMWGetPtr(BinaryenExpressionRef expr); -// Gets the nested value expression within the specified `AtomicRMW` expression. BinaryenExpressionRef BinaryenAtomicRMWGetValue(BinaryenExpressionRef expr); -// Gets the byte size of the specified `AtomicCmpxchg` expression. uint32_t BinaryenAtomicCmpxchgGetBytes(BinaryenExpressionRef expr); -// Gets the offset of the specified `AtomicCmpxchg` expression. uint32_t BinaryenAtomicCmpxchgGetOffset(BinaryenExpressionRef expr); -// Gets the nested pointer expression within the specified `AtomicCmpxchg` expression. BinaryenExpressionRef BinaryenAtomicCmpxchgGetPtr(BinaryenExpressionRef expr); -// Gets the nested expected value expression within the specified `AtomicCmpxchg` expression. BinaryenExpressionRef BinaryenAtomicCmpxchgGetExpected(BinaryenExpressionRef expr); -// Gets the nested replacement value expression within the specified `AtomicCmpxchg` expression. BinaryenExpressionRef BinaryenAtomicCmpxchgGetReplacement(BinaryenExpressionRef expr); -// Gets the nested pointer expression within the specified `AtomicWait` expression. BinaryenExpressionRef BinaryenAtomicWaitGetPtr(BinaryenExpressionRef expr); -// Gets the nested expected value expression within the specified `AtomicWait` expression. BinaryenExpressionRef BinaryenAtomicWaitGetExpected(BinaryenExpressionRef expr); -// Gets the nested timeout expression within the specified `AtomicWait` expression. BinaryenExpressionRef BinaryenAtomicWaitGetTimeout(BinaryenExpressionRef expr); -// Gets the expected type of the specified `AtomicWait` expression. BinaryenType BinaryenAtomicWaitGetExpectedType(BinaryenExpressionRef expr); -// Gets the nested pointer expression within the specified `AtomicWake` expression. BinaryenExpressionRef BinaryenAtomicWakeGetPtr(BinaryenExpressionRef expr); -// Gets the nested wake count expression within the specified `AtomicWake` expression. BinaryenExpressionRef BinaryenAtomicWakeGetWakeCount(BinaryenExpressionRef expr); +BinaryenOp BinaryenSIMDExtractGetOp(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDExtractGetVec(BinaryenExpressionRef expr); +uint8_t BinaryenSIMDExtractGetIdx(BinaryenExpressionRef expr); + +BinaryenOp BinaryenSIMDReplaceGetOp(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDReplaceGetVec(BinaryenExpressionRef expr); +uint8_t BinaryenSIMDReplaceGetIdx(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDReplaceGetValue(BinaryenExpressionRef expr); + +BinaryenExpressionRef BinaryenSIMDShuffleGetLeft(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDShuffleGetRight(BinaryenExpressionRef expr); +void BinaryenSIMDShuffleGetMask(BinaryenExpressionRef expr, uint8_t *mask); + +BinaryenExpressionRef BinaryenSIMDBitselectGetLeft(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDBitselectGetRight(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDBitselectGetCond(BinaryenExpressionRef expr); + +BinaryenOp BinaryenSIMDShiftGetOp(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDShiftGetVec(BinaryenExpressionRef expr); +BinaryenExpressionRef BinaryenSIMDShiftGetShift(BinaryenExpressionRef expr); + + // Functions typedef void* BinaryenFunctionRef; diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index f421ce455e8..11f721d543b 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -22,6 +22,14 @@ function i32sToStack(i32s) { return ret; } +function i8sToStack(i8s) { + var ret = stackAlloc(i8s.length); + for (var i = 0; i < i8s.length; i++) { + HEAP8[ret + i] = i8s[i]; + } + return ret; +} + // Types Module['none'] = Module['_BinaryenTypeNone'](); Module['i32'] = Module['_BinaryenTypeInt32'](); @@ -64,7 +72,7 @@ Module['SIMDExtractId'] = Module['_BinaryenSIMDExtractId'](); Module['SIMDReplaceId'] = Module['_BinaryenSIMDReplaceId'](); Module['SIMDShuffleId'] = Module['_BinaryenSIMDShuffleId'](); Module['SIMDBitselectId'] = Module['_BinaryenSIMDBitselectId'](); -Module['SIMDShift'] = Module['_BinarySIMDShiftId'](); +Module['SIMDShiftId'] = Module['_BinaryenSIMDShiftId'](); // External kinds Module['ExternalFunction'] = Module['_BinaryenExternalFunction'](); @@ -217,6 +225,141 @@ Module['AtomicRMWAnd'] = Module['_BinaryenAtomicRMWAnd'](); Module['AtomicRMWOr'] = Module['_BinaryenAtomicRMWOr'](); Module['AtomicRMWXor'] = Module['_BinaryenAtomicRMWXor'](); Module['AtomicRMWXchg'] = Module['_BinaryenAtomicRMWXchg'](); +Module['SplatVecI8x16'] = Module['_BinaryenSplatVecI8x16'](); +Module['ExtractLaneSVecI8x16'] = Module['_BinaryenExtractLaneSVecI8x16'](); +Module['ExtractLaneUVecI8x16'] = Module['_BinaryenExtractLaneUVecI8x16'](); +Module['ReplaceLaneVecI8x16'] = Module['_BinaryenReplaceLaneVecI8x16'](); +Module['SplatVecI16x8'] = Module['_BinaryenSplatVecI16x8'](); +Module['ExtractLaneSVecI16x8'] = Module['_BinaryenExtractLaneSVecI16x8'](); +Module['ExtractLaneUVecI16x8'] = Module['_BinaryenExtractLaneUVecI16x8'](); +Module['ReplaceLaneVecI16x8'] = Module['_BinaryenReplaceLaneVecI16x8'](); +Module['SplatVecI32x4'] = Module['_BinaryenSplatVecI32x4'](); +Module['ExtractLaneVecI32x4'] = Module['_BinaryenExtractLaneVecI32x4'](); +Module['ReplaceLaneVecI32x4'] = Module['_BinaryenReplaceLaneVecI32x4'](); +Module['SplatVecI64x2'] = Module['_BinaryenSplatVecI64x2'](); +Module['ExtractLaneVecI64x2'] = Module['_BinaryenExtractLaneVecI64x2'](); +Module['ReplaceLaneVecI64x2'] = Module['_BinaryenReplaceLaneVecI64x2'](); +Module['SplatVecF32x4'] = Module['_BinaryenSplatVecF32x4'](); +Module['ExtractLaneVecF32x4'] = Module['_BinaryenExtractLaneVecF32x4'](); +Module['ReplaceLaneVecF32x4'] = Module['_BinaryenReplaceLaneVecF32x4'](); +Module['SplatVecF64x2'] = Module['_BinaryenSplatVecF64x2'](); +Module['ExtractLaneVecF64x2'] = Module['_BinaryenExtractLaneVecF64x2'](); +Module['ReplaceLaneVecF64x2'] = Module['_BinaryenReplaceLaneVecF64x2'](); +Module['EqVecI8x16'] = Module['_BinaryenEqVecI8x16'](); +Module['NeVecI8x16'] = Module['_BinaryenNeVecI8x16'](); +Module['LtSVecI8x16'] = Module['_BinaryenLtSVecI8x16'](); +Module['LtUVecI8x16'] = Module['_BinaryenLtUVecI8x16'](); +Module['GtSVecI8x16'] = Module['_BinaryenGtSVecI8x16'](); +Module['GtUVecI8x16'] = Module['_BinaryenGtUVecI8x16'](); +Module['LeSVecI8x16'] = Module['_BinaryenLeSVecI8x16'](); +Module['LeUVecI8x16'] = Module['_BinaryenLeUVecI8x16'](); +Module['GeSVecI8x16'] = Module['_BinaryenGeSVecI8x16'](); +Module['GeUVecI8x16'] = Module['_BinaryenGeUVecI8x16'](); +Module['EqVecI16x8'] = Module['_BinaryenEqVecI16x8'](); +Module['NeVecI16x8'] = Module['_BinaryenNeVecI16x8'](); +Module['LtSVecI16x8'] = Module['_BinaryenLtSVecI16x8'](); +Module['LtUVecI16x8'] = Module['_BinaryenLtUVecI16x8'](); +Module['GtSVecI16x8'] = Module['_BinaryenGtSVecI16x8'](); +Module['GtUVecI16x8'] = Module['_BinaryenGtUVecI16x8'](); +Module['LeSVecI16x8'] = Module['_BinaryenLeSVecI16x8'](); +Module['LeUVecI16x8'] = Module['_BinaryenLeUVecI16x8'](); +Module['GeSVecI16x8'] = Module['_BinaryenGeSVecI16x8'](); +Module['GeUVecI16x8'] = Module['_BinaryenGeUVecI16x8'](); +Module['EqVecI32x4'] = Module['_BinaryenEqVecI32x4'](); +Module['NeVecI32x4'] = Module['_BinaryenNeVecI32x4'](); +Module['LtSVecI32x4'] = Module['_BinaryenLtSVecI32x4'](); +Module['LtUVecI32x4'] = Module['_BinaryenLtUVecI32x4'](); +Module['GtSVecI32x4'] = Module['_BinaryenGtSVecI32x4'](); +Module['GtUVecI32x4'] = Module['_BinaryenGtUVecI32x4'](); +Module['LeSVecI32x4'] = Module['_BinaryenLeSVecI32x4'](); +Module['LeUVecI32x4'] = Module['_BinaryenLeUVecI32x4'](); +Module['GeSVecI32x4'] = Module['_BinaryenGeSVecI32x4'](); +Module['GeUVecI32x4'] = Module['_BinaryenGeUVecI32x4'](); +Module['EqVecF32x4'] = Module['_BinaryenEqVecF32x4'](); +Module['NeVecF32x4'] = Module['_BinaryenNeVecF32x4'](); +Module['LtVecF32x4'] = Module['_BinaryenLtVecF32x4'](); +Module['GtVecF32x4'] = Module['_BinaryenGtVecF32x4'](); +Module['LeVecF32x4'] = Module['_BinaryenLeVecF32x4'](); +Module['GeVecF32x4'] = Module['_BinaryenGeVecF32x4'](); +Module['EqVecF64x2'] = Module['_BinaryenGeVecF32x4'](); +Module['NeVecF64x2'] = Module['_BinaryenNeVecF64x2'](); +Module['LtVecF64x2'] = Module['_BinaryenLtVecF64x2'](); +Module['GtVecF64x2'] = Module['_BinaryenGtVecF64x2'](); +Module['LeVecF64x2'] = Module['_BinaryenLeVecF64x2'](); +Module['GeVecF64x2'] = Module['_BinaryenGeVecF64x2'](); +Module['NotVec128'] = Module['_BinaryenNotVec128'](); +Module['AndVec128'] = Module['_BinaryenAndVec128'](); +Module['OrVec128'] = Module['_BinaryenOrVec128'](); +Module['XorVec128'] = Module['_BinaryenXorVec128'](); +Module['NegVecI8x16'] = Module['_BinaryenNegVecI8x16'](); +Module['AnyTrueVecI8x16'] = Module['_BinaryenAnyTrueVecI8x16'](); +Module['AllTrueVecI8x16'] = Module['_BinaryenAllTrueVecI8x16'](); +Module['ShlVecI8x16'] = Module['_BinaryenShlVecI8x16'](); +Module['ShrSVecI8x16'] = Module['_BinaryenShrSVecI8x16'](); +Module['ShrUVecI8x16'] = Module['_BinaryenShrUVecI8x16'](); +Module['AddVecI8x16'] = Module['_BinaryenAddVecI8x16'](); +Module['AddSatSVecI8x16'] = Module['_BinaryenAddSatSVecI8x16'](); +Module['AddSatUVecI8x16'] = Module['_BinaryenAddSatUVecI8x16'](); +Module['SubVecI8x16'] = Module['_BinaryenSubVecI8x16'](); +Module['SubSatSVecI8x16'] = Module['_BinaryenSubSatSVecI8x16'](); +Module['SubSatUVecI8x16'] = Module['_BinaryenSubSatUVecI8x16'](); +Module['MulVecI8x16'] = Module['_BinaryenMulVecI8x16'](); +Module['NegVecI16x8'] = Module['_BinaryenNegVecI16x8'](); +Module['AnyTrueVecI16x8'] = Module['_BinaryenAnyTrueVecI16x8'](); +Module['AllTrueVecI16x8'] = Module['_BinaryenAllTrueVecI16x8'](); +Module['ShlVecI16x8'] = Module['_BinaryenShlVecI16x8'](); +Module['ShrSVecI16x8'] = Module['_BinaryenShrSVecI16x8'](); +Module['ShrUVecI16x8'] = Module['_BinaryenShrUVecI16x8'](); +Module['AddVecI16x8'] = Module['_BinaryenAddVecI16x8'](); +Module['AddSatSVecI16x8'] = Module['_BinaryenAddSatSVecI16x8'](); +Module['AddSatUVecI16x8'] = Module['_BinaryenAddSatUVecI16x8'](); +Module['SubVecI16x8'] = Module['_BinaryenSubVecI16x8'](); +Module['SubSatSVecI16x8'] = Module['_BinaryenSubSatSVecI16x8'](); +Module['SubSatUVecI16x8'] = Module['_BinaryenSubSatUVecI16x8'](); +Module['MulVecI16x8'] = Module['_BinaryenMulVecI16x8'](); +Module['NegVecI32x4'] = Module['_BinaryenNegVecI32x4'](); +Module['AnyTrueVecI32x4'] = Module['_BinaryenAnyTrueVecI32x4'](); +Module['AllTrueVecI32x4'] = Module['_BinaryenAllTrueVecI32x4'](); +Module['ShlVecI32x4'] = Module['_BinaryenShlVecI32x4'](); +Module['ShrSVecI32x4'] = Module['_BinaryenShrSVecI32x4'](); +Module['ShrUVecI32x4'] = Module['_BinaryenShrUVecI32x4'](); +Module['AddVecI32x4'] = Module['_BinaryenAddVecI32x4'](); +Module['SubVecI32x4'] = Module['_BinaryenSubVecI32x4'](); +Module['MulVecI32x4'] = Module['_BinaryenMulVecI32x4'](); +Module['NegVecI64x2'] = Module['_BinaryenNegVecI64x2'](); +Module['AnyTrueVecI64x2'] = Module['_BinaryenAnyTrueVecI64x2'](); +Module['AllTrueVecI64x2'] = Module['_BinaryenAllTrueVecI64x2'](); +Module['ShlVecI64x2'] = Module['_BinaryenShlVecI64x2'](); +Module['ShrSVecI64x2'] = Module['_BinaryenShrSVecI64x2'](); +Module['ShrUVecI64x2'] = Module['_BinaryenShrUVecI64x2'](); +Module['AddVecI64x2'] = Module['_BinaryenAddVecI64x2'](); +Module['SubVecI64x2'] = Module['_BinaryenSubVecI64x2'](); +Module['AbsVecF32x4'] = Module['_BinaryenAbsVecF32x4'](); +Module['NegVecF32x4'] = Module['_BinaryenNegVecF32x4'](); +Module['SqrtVecF32x4'] = Module['_BinaryenSqrtVecF32x4'](); +Module['AddVecF32x4'] = Module['_BinaryenAddVecF32x4'](); +Module['SubVecF32x4'] = Module['_BinaryenSubVecF32x4'](); +Module['MulVecF32x4'] = Module['_BinaryenMulVecF32x4'](); +Module['DivVecF32x4'] = Module['_BinaryenDivVecF32x4'](); +Module['MinVecF32x4'] = Module['_BinaryenMinVecF32x4'](); +Module['MaxVecF32x4'] = Module['_BinaryenMaxVecF32x4'](); +Module['AbsVecF64x2'] = Module['_BinaryenAbsVecF64x2'](); +Module['NegVecF64x2'] = Module['_BinaryenNegVecF64x2'](); +Module['SqrtVecF64x2'] = Module['_BinaryenSqrtVecF64x2'](); +Module['AddVecF64x2'] = Module['_BinaryenAddVecF64x2'](); +Module['SubVecF64x2'] = Module['_BinaryenSubVecF64x2'](); +Module['MulVecF64x2'] = Module['_BinaryenMulVecF64x2'](); +Module['DivVecF64x2'] = Module['_BinaryenDivVecF64x2'](); +Module['MinVecF64x2'] = Module['_BinaryenMinVecF64x2'](); +Module['MaxVecF64x2'] = Module['_BinaryenMaxVecF64x2'](); +Module['TruncSatSVecF32x4ToVecI32x4'] = Module['_BinaryenTruncSatSVecF32x4ToVecI32x4'](); +Module['TruncSatUVecF32x4ToVecI32x4'] = Module['_BinaryenTruncSatUVecF32x4ToVecI32x4'](); +Module['TruncSatSVecF64x2ToVecI64x2'] = Module['_BinaryenTruncSatSVecF64x2ToVecI64x2'](); +Module['TruncSatUVecF64x2ToVecI64x2'] = Module['_BinaryenTruncSatUVecF64x2ToVecI64x2'](); +Module['ConvertSVecI32x4ToVecF32x4'] = Module['_BinaryenConvertSVecI32x4ToVecF32x4'](); +Module['ConvertUVecI32x4ToVecF32x4'] = Module['_BinaryenConvertUVecI32x4ToVecF32x4'](); +Module['ConvertSVecI64x2ToVecF64x2'] = Module['_BinaryenConvertSVecI64x2ToVecF64x2'](); +Module['ConvertUVecI64x2ToVecF64x2'] = Module['_BinaryenConvertUVecI64x2ToVecF64x2'](); // 'Module' interface Module['Module'] = function(module) { @@ -1060,6 +1203,455 @@ function wrapModule(module, self) { }, }; + self['v128'] = { + 'load': function(offset, align, ptr) { + return Module['_BinaryenLoad'](module, 16, false, offset, align, Module['v128'], ptr); + }, + 'store': function(offset, align, ptr, value) { + return Module['_BinaryenStore'](module, 16, offset, align, ptr, value, Module['v128']); + }, + 'const': function(i8s) { + return preserveStack(function() { + Module['_BinaryenLiteralVec128'](temp, i8sToStack(i8s)); + return Module['_BinaryenConst'](module, temp); + }); + }, + 'not': function(value) { + return Module['_BinaryenUnary'](module, Module['NotVec128'], value); + }, + 'and': function(value) { + return Module['_BinaryenUnary'](module, Module['AndVec128'], value); + }, + 'or': function(value) { + return Module['_BinaryenUnary'](module, Module['OrVec128'], value); + }, + 'xor': function(value) { + return Module['_BinaryenUnary'](module, Module['XorVec128'], value); + }, + 'bitselect': function(left, right, cond) { + return Module['_BinaryenSIMDBitselect'](module, left, right, cond); + } + }; + + self['v8x16'] = { + 'shuffle': function(left, right, mask) { + return preserveStack(function() { + return Module['_BinaryenSIMDShuffle'](module, left, right, i8sToStack(mask)); + }); + }, + }; + + self['i8x16'] = { + 'splat': function(value) { + return Module['_BinaryenUnary'](module, Module['SplatVecI8x16'], value); + }, + 'extract_lane_s': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneSVecI8x16'], vec, idx); + }, + 'extract_lane_u': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneUVecI8x16'], vec, idx); + }, + 'replace_lane': function(vec, idx, value) { + return Module['_BinaryenSIMDReplace'](module, Module['ReplaceLaneVecI8x16'], vec, idx, value); + }, + 'eq': function(left, right) { + return Module['_BinaryenBinary'](module, Module['EqVecI8x16'], left, right); + }, + 'ne': function(left, right) { + return Module['_BinaryenBinary'](module, Module['NeVecI8x16'], left, right); + }, + 'lt_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtSVecI8x16'], left, right); + }, + 'lt_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtUVecI8x16'], left, right); + }, + 'gt_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtSVecI8x16'], left, right); + }, + 'gt_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtUVecI8x16'], left, right); + }, + 'le_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeSVecI8x16'], left, right); + }, + 'le_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeUVecI8x16'], left, right); + }, + 'ge_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeSVecI8x16'], left, right); + }, + 'ge_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeUVecI8x16'], left, right); + }, + 'neg': function(value) { + return Module['_BinaryenUnary'](module, Module['NegVecI8x16'], value); + }, + 'any_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AnyTrueVecI8x16'], value); + }, + 'all_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AllTrueVecI8x16'], value); + }, + 'shl': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShlVecI8x16'], vec, shift); + }, + 'shr_s': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrSVecI8x16'], vec, shift); + }, + 'shr_u': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrUVecI8x16'], vec, shift); + }, + 'add': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddVecI8x16'], left, right); + }, + 'add_saturate_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddSatSVecI8x16'], left, right); + }, + 'add_saturate_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddSatUVecI8x16'], left, right); + }, + 'sub': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubVecI8x16'], left, right); + }, + 'sub_saturate_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubSatSVecI8x16'], left, right); + }, + 'sub_saturate_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubSatUVecI8x16'], left, right); + }, + 'mul': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MulVecI8x16'], left, right); + }, + }; + + self['i16x8'] = { + 'splat': function(value) { + return Module['_BinaryenUnary'](module, Module['SplatVecI16x8'], value); + }, + 'extract_lane_s': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneSVecI16x8'], vec, idx); + }, + 'extract_lane_u': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneUVecI16x8'], vec, idx); + }, + 'replace_lane': function(vec, idx, value) { + return Module['_BinaryenSIMDReplace'](module, Module['ReplaceLaneVecI16x8'], vec, idx, value); + }, + 'eq': function(left, right) { + return Module['_BinaryenBinary'](module, Module['EqVecI16x8'], left, right); + }, + 'ne': function(left, right) { + return Module['_BinaryenBinary'](module, Module['NeVecI16x8'], left, right); + }, + 'lt_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtSVecI16x8'], left, right); + }, + 'lt_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtUVecI16x8'], left, right); + }, + 'gt_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtSVecI16x8'], left, right); + }, + 'gt_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtUVecI16x8'], left, right); + }, + 'le_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeSVecI16x8'], left, right); + }, + 'le_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeUVecI16x8'], left, right); + }, + 'ge_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeSVecI16x8'], left, right); + }, + 'ge_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeUVecI16x8'], left, right); + }, + 'neg': function(value) { + return Module['_BinaryenUnary'](module, Module['NegVecI16x8'], value); + }, + 'any_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AnyTrueVecI16x8'], value); + }, + 'all_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AllTrueVecI16x8'], value); + }, + 'shl': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShlVecI16x8'], vec, shift); + }, + 'shr_s': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrSVecI16x8'], vec, shift); + }, + 'shr_u': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrUVecI16x8'], vec, shift); + }, + 'add': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddVecI16x8'], left, right); + }, + 'add_saturate_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddSatSVecI16x8'], left, right); + }, + 'add_saturate_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddSatUVecI16x8'], left, right); + }, + 'sub': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubVecI16x8'], left, right); + }, + 'sub_saturate_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubSatSVecI16x8'], left, right); + }, + 'sub_saturate_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubSatUVecI16x8'], left, right); + }, + 'mul': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MulVecI16x8'], left, right); + }, + }; + + self['i32x4'] = { + 'splat': function(value) { + return Module['_BinaryenUnary'](module, Module['SplatVecI32x4'], value); + }, + 'extract_lane': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneVecI32x4'], vec, idx); + }, + 'replace_lane': function(vec, idx, value) { + return Module['_BinaryenSIMDReplace'](module, Module['ReplaceLaneVecI32x4'], vec, idx, value); + }, + 'eq': function(left, right) { + return Module['_BinaryenBinary'](module, Module['EqVecI32x4'], left, right); + }, + 'ne': function(left, right) { + return Module['_BinaryenBinary'](module, Module['NeVecI32x4'], left, right); + }, + 'lt_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtSVecI32x4'], left, right); + }, + 'lt_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtUVecI32x4'], left, right); + }, + 'gt_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtSVecI32x4'], left, right); + }, + 'gt_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtUVecI32x4'], left, right); + }, + 'le_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeSVecI32x4'], left, right); + }, + 'le_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeUVecI32x4'], left, right); + }, + 'ge_s': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeSVecI32x4'], left, right); + }, + 'ge_u': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeUVecI32x4'], left, right); + }, + 'neg': function(value) { + return Module['_BinaryenUnary'](module, Module['NegVecI32x4'], value); + }, + 'any_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AnyTrueVecI32x4'], value); + }, + 'all_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AllTrueVecI32x4'], value); + }, + 'shl': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShlVecI32x4'], vec, shift); + }, + 'shr_s': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrSVecI32x4'], vec, shift); + }, + 'shr_u': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrUVecI32x4'], vec, shift); + }, + 'add': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddVecI32x4'], left, right); + }, + 'sub': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubVecI32x4'], left, right); + }, + 'mul': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MulVecI32x4'], left, right); + }, + 'trunc_s/f32x4:sat': function(value) { + return Module['_BinaryenUnary'](module, Module['TruncSatSVecF32x4ToVecI32x4'], value); + }, + 'trunc_u/f32x4:sat': function(value) { + return Module['_BinaryenUnary'](module, Module['TruncSatUVecF32x4ToVecI32x4'], value); + }, + }; + + self['i64x2'] = { + 'splat': function(value) { + return Module['_BinaryenUnary'](module, Module['SplatVecI64x2'], value); + }, + 'extract_lane': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneVecI64x2'], vec, idx); + }, + 'replace_lane': function(vec, idx, value) { + return Module['_BinaryenSIMDReplace'](module, Module['ReplaceLaneVecI64x2'], vec, idx, value); + }, + 'neg': function(value) { + return Module['_BinaryenUnary'](module, Module['NegVecI64x2'], value); + }, + 'any_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AnyTrueVecI64x2'], value); + }, + 'all_true': function(value) { + return Module['_BinaryenUnary'](module, Module['AllTrueVecI64x2'], value); + }, + 'shl': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShlVecI64x2'], vec, shift); + }, + 'shr_s': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrSVecI64x2'], vec, shift); + }, + 'shr_u': function(vec, shift) { + return Module['_BinaryenSIMDShift'](module, Module['ShrUVecI64x2'], vec, shift); + }, + 'add': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddVecI64x2'], left, right); + }, + 'sub': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubVecI64x2'], left, right); + }, + 'trunc_s/f64x2:sat': function(value) { + return Module['_BinaryenUnary'](module, Module['TruncSatSVecF64x2ToVecI64x2'], value); + }, + 'trunc_u/f64x2:sat': function(value) { + return Module['_BinaryenUnary'](module, Module['TruncSatUVecF64x2ToVecI64x2'], value); + }, + }; + + self['f32x4'] = { + 'splat': function(value) { + return Module['_BinaryenUnary'](module, Module['SplatVecF32x4'], value); + }, + 'extract_lane': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneVecF32x4'], vec, idx); + }, + 'replace_lane': function(vec, idx, value) { + return Module['_BinaryenSIMDReplace'](module, Module['ReplaceLaneVecF32x4'], vec, idx, value); + }, + 'eq': function(left, right) { + return Module['_BinaryenBinary'](module, Module['EqVecF32x4'], left, right); + }, + 'ne': function(left, right) { + return Module['_BinaryenBinary'](module, Module['NeVecF32x4'], left, right); + }, + 'lt': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtVecF32x4'], left, right); + }, + 'gt': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtVecF32x4'], left, right); + }, + 'le': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeVecF32x4'], left, right); + }, + 'ge': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeVecF32x4'], left, right); + }, + 'abs': function(value) { + return Module['_BinaryenUnary'](module, Module['AbsVecF32x4'], value); + }, + 'neg': function(value) { + return Module['_BinaryenUnary'](module, Module['NegVecF32x4'], value); + }, + 'sqrt': function(value) { + return Module['_BinaryenUnary'](module, Module['SqrtVecF32x4'], value); + }, + 'add': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddVecF32x4'], left, right); + }, + 'sub': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubVecF32x4'], left, right); + }, + 'mul': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MulVecF32x4'], left, right); + }, + 'div': function(left, right) { + return Module['_BinaryenBinary'](module, Module['DivVecF32x4'], left, right); + }, + 'min': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MinVecF32x4'], left, right); + }, + 'max': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MaxVecF32x4'], left, right); + }, + 'convert_s/i32x4': function(value) { + return Module['_BinaryenUnary'](module, Module['ConvertSVecI32x4ToVecF32x4'], value); + }, + 'convert_u/i32x4': function(value) { + return Module['_BinaryenUnary'](module, Module['ConvertUVecI32x4ToVecF32x4'], value); + }, + }; + + self['f64x2'] = { + 'splat': function(value) { + return Module['_BinaryenUnary'](module, Module['SplatVecF64x2'], value); + }, + 'extract_lane': function(vec, idx) { + return Module['_BinaryenSIMDExtract'](module, Module['ExtractLaneVecF64x2'], vec, idx); + }, + 'replace_lane': function(vec, idx, value) { + return Module['_BinaryenSIMDReplace'](module, Module['ReplaceLaneVecF64x2'], vec, idx, value); + }, + 'eq': function(left, right) { + return Module['_BinaryenBinary'](module, Module['EqVecF64x2'], left, right); + }, + 'ne': function(left, right) { + return Module['_BinaryenBinary'](module, Module['NeVecF64x2'], left, right); + }, + 'lt': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LtVecF64x2'], left, right); + }, + 'gt': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GtVecF64x2'], left, right); + }, + 'le': function(left, right) { + return Module['_BinaryenBinary'](module, Module['LeVecF64x2'], left, right); + }, + 'ge': function(left, right) { + return Module['_BinaryenBinary'](module, Module['GeVecF64x2'], left, right); + }, + 'abs': function(value) { + return Module['_BinaryenUnary'](module, Module['AbsVecF64x2'], value); + }, + 'neg': function(value) { + return Module['_BinaryenUnary'](module, Module['NegVecF64x2'], value); + }, + 'sqrt': function(value) { + return Module['_BinaryenUnary'](module, Module['SqrtVecF64x2'], value); + }, + 'add': function(left, right) { + return Module['_BinaryenBinary'](module, Module['AddVecF64x2'], left, right); + }, + 'sub': function(left, right) { + return Module['_BinaryenBinary'](module, Module['SubVecF64x2'], left, right); + }, + 'mul': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MulVecF64x2'], left, right); + }, + 'div': function(left, right) { + return Module['_BinaryenBinary'](module, Module['DivVecF64x2'], left, right); + }, + 'min': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MinVecF64x2'], left, right); + }, + 'max': function(left, right) { + return Module['_BinaryenBinary'](module, Module['MaxVecF64x2'], left, right); + }, + 'convert_s/i64x2': function(value) { + return Module['_BinaryenUnary'](module, Module['ConvertSVecI64x2ToVecF64x2'], value); + }, + 'convert_u/i64x2': function(value) { + return Module['_BinaryenUnary'](module, Module['ConvertUVecI64x2ToVecF64x2'], value); + }, + }; + self['select'] = function(condition, ifTrue, ifFalse) { return Module['_BinaryenSelect'](module, condition, ifTrue, ifFalse); }; @@ -1556,6 +2148,55 @@ Module['getExpressionInfo'] = function(expr) { 'ptr': Module['_BinaryenAtomicWakeGetPtr'](expr), 'wakeCount': Module['_BinaryenAtomicWakeGetWakeCount'](expr) }; + case Module['SIMDExtractId']: + return { + 'id': id, + 'type': type, + 'op': Module['_BinaryenSIMDExtractGetOp'](expr), + 'vec': Module['_BinaryenSIMDExtractGetVec'](expr), + 'idx': Module['_BinaryenSIMDExtractGetIdx'](expr) + }; + case Module['SIMDReplaceId']: + return { + 'id': id, + 'type': type, + 'op': Module['_BinaryenSIMDReplaceGetOp'](expr), + 'vec': Module['_BinaryenSIMDReplaceGetVec'](expr), + 'idx': Module['_BinaryenSIMDReplaceGetIdx'](expr), + 'value': Module['_BinaryenSIMDReplaceGetValue'](expr) + }; + case Module['SIMDShuffleId']: + return preserveStack(function() { + var ret = stackAlloc(16); + Module['_BinaryenSIMDShuffleGetMask'](expr, ret); + var mask = []; + for (var i = 0 ; i < 16; i++) { + mask[i] = HEAP8[ret + i]; + } + return { + 'id': id, + 'type': type, + 'left': Module['_BinaryenSIMDShuffleGetLeft'](expr), + 'right': Module['_BinaryenSIMDShuffleGetRight'](expr), + 'mask': mask + }; + }); + case Module['SIMDBitselectId']: + return { + 'id': id, + 'type': type, + 'left': Module['_BinaryenSIMDBitselectGetLeft'](expr), + 'right': Module['_BinaryenSIMDBitselectGetRight'](expr), + 'cond': Module['_BinaryenSIMDBitselectGetCond'](expr) + }; + case Module['SIMDShiftId']: + return { + 'id': id, + 'type': type, + 'op': Module['_BinaryenSIMDShiftGetOp'](expr), + 'vec': Module['_BinaryenSIMDShiftGetVec'](expr), + 'shift': Module['_BinaryenSIMDShiftGetShift'](expr) + }; default: throw Error('unexpected id: ' + id); } diff --git a/src/literal.h b/src/literal.h index c545e3df571..094fe2a83c9 100644 --- a/src/literal.h +++ b/src/literal.h @@ -18,6 +18,7 @@ #define wasm_literal_h #include +#include #include "support/hash.h" #include "support/utilities.h" diff --git a/src/wasm.h b/src/wasm.h index 124ad9ada6b..1cdf57c9f00 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -25,6 +25,7 @@ #define wasm_wasm_h #include +#include #include #include #include diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index d1b021a5185..755f8837428 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -532,7 +532,7 @@ static T sat_add(T a, T b) { template static T add_sat_s(T a, T b) { - static_assert(std::is_signed::value); + static_assert(std::is_signed::value, "Trying to instantiate add_sat_s with unsigned type"); using UT = typename std::make_unsigned::type; UT ua = static_cast(a); UT ub = static_cast(b); @@ -548,7 +548,7 @@ static T add_sat_s(T a, T b) { template static T sub_sat_s(T a, T b) { - static_assert(std::is_signed::value); + static_assert(std::is_signed::value, "Trying to instantiate sub_sat_s with unsigned type"); using UT = typename std::make_unsigned::type; UT ua = static_cast(a); UT ub = static_cast(b); @@ -564,7 +564,7 @@ static T sub_sat_s(T a, T b) { template static T add_sat_u(T a, T b) { - static_assert(std::is_unsigned::value); + static_assert(std::is_unsigned::value, "Trying to instantiate add_sat_u with signed type"); T res = a + b; // overflow if result is less than arguments return (res < a) ? std::numeric_limits::max() : res; @@ -572,7 +572,7 @@ static T add_sat_u(T a, T b) { template static T sub_sat_u(T a, T b) { - static_assert(std::is_unsigned::value); + static_assert(std::is_unsigned::value, "Trying to instantiate sub_sat_u with signed type"); T res = a - b; // overflow if result is greater than a return (res > a) ? 0 : res; @@ -1165,12 +1165,12 @@ Literal Literal::allTrueI64x2() const { template (Literal::*IntoLanes)() const, Literal (Literal::*ShiftOp)(const Literal&) const> -static Literal shift(const Literal& val, const Literal& other) { - assert(other.type == Type::i32); +static Literal shift(const Literal& vec, const Literal& shift) { + assert(shift.type == Type::i32); size_t lane_bits = 128 / Lanes; - LaneArray lanes = (val.*IntoLanes)(); + LaneArray lanes = (vec.*IntoLanes)(); for (size_t i = 0; i < Lanes; ++i) { - lanes[i] = (lanes[i].*ShiftOp)(Literal(other.geti32() % lane_bits)); + lanes[i] = (lanes[i].*ShiftOp)(Literal(int32_t(shift.geti32() % lane_bits))); } return Literal(lanes); } diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 6f2b79e83f3..27eba3a8c8d 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -14,6 +14,8 @@ var module; // helpers +var v128_bytes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + function assert(x) { if (!x) throw 'error!'; } @@ -34,6 +36,10 @@ function makeFloat64(x) { return module.f64.const(x); } +function makeVec128(i8s) { + return module.v128.const(i8s) +} + function makeSomething() { return makeInt32(1337); } @@ -161,6 +167,39 @@ function test_core() { module.f32.demote(module.f64.const(-9005.841)), module.f32.reinterpret(module.i32.const(-10)), module.f64.reinterpret(module.i64.const(-22, -1)), + module.i8x16.splat(module.i32.const(42)), + module.i16x8.splat(module.i32.const(42)), + module.i32x4.splat(module.i32.const(42)), + module.i64x2.splat(module.i64.const(123, 456)), + module.f32x4.splat(module.f32.const(42.0)), + module.f64x2.splat(module.f64.const(42.0)), + module.v128.not(module.v128.const(v128_bytes)), + module.i8x16.neg(module.v128.const(v128_bytes)), + module.i8x16.any_true(module.v128.const(v128_bytes)), + module.i8x16.all_true(module.v128.const(v128_bytes)), + module.i16x8.neg(module.v128.const(v128_bytes)), + module.i16x8.any_true(module.v128.const(v128_bytes)), + module.i16x8.all_true(module.v128.const(v128_bytes)), + module.i32x4.neg(module.v128.const(v128_bytes)), + module.i32x4.any_true(module.v128.const(v128_bytes)), + module.i32x4.all_true(module.v128.const(v128_bytes)), + module.i64x2.neg(module.v128.const(v128_bytes)), + module.i64x2.any_true(module.v128.const(v128_bytes)), + module.i64x2.all_true(module.v128.const(v128_bytes)), + module.f32x4.abs(module.v128.const(v128_bytes)), + module.f32x4.neg(module.v128.const(v128_bytes)), + module.f32x4.sqrt(module.v128.const(v128_bytes)), + module.f64x2.abs(module.v128.const(v128_bytes)), + module.f64x2.neg(module.v128.const(v128_bytes)), + module.f64x2.sqrt(module.v128.const(v128_bytes)), + module.i32x4['trunc_s/f32x4:sat'](module.v128.const(v128_bytes)), + module.i32x4['trunc_u/f32x4:sat'](module.v128.const(v128_bytes)), + module.i64x2['trunc_s/f64x2:sat'](module.v128.const(v128_bytes)), + module.i64x2['trunc_u/f64x2:sat'](module.v128.const(v128_bytes)), + module.f32x4['convert_s/i32x4'](module.v128.const(v128_bytes)), + module.f32x4['convert_u/i32x4'](module.v128.const(v128_bytes)), + module.f64x2['convert_s/i64x2'](module.v128.const(v128_bytes)), + module.f64x2['convert_u/i64x2'](module.v128.const(v128_bytes)), // Binary module.i32.add(module.i32.const(-10), module.i32.const(-11)), module.f64.sub(module.f64.const(-9005.841), module.f64.const(-9007.333)), @@ -194,6 +233,113 @@ function test_core() { module.f64.le(module.f64.const(-9005.841), module.f64.const(-9007.333)), module.f64.gt(module.f64.const(-9005.841), module.f64.const(-9007.333)), module.f32.ge(module.f32.const(-33.612), module.f32.const(-62.5)), + module.i8x16.eq(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.ne(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.lt_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.lt_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.gt_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.gt_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.le_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.le_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.ge_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.ge_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.eq(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.ne(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.lt_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.lt_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.gt_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.gt_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.le_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.le_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.ge_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.ge_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.eq(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.ne(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.lt_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.lt_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.gt_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.gt_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.le_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.le_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.ge_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.ge_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.eq(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.ne(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.lt(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.gt(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.le(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.ge(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.eq(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.ne(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.lt(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.gt(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.le(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.ge(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.v128.and(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.v128.or(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.v128.xor(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.add(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.add_saturate_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.add_saturate_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.sub(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.sub_saturate_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.sub_saturate_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i8x16.mul(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.add(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.add_saturate_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.add_saturate_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.sub(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.sub_saturate_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.sub_saturate_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i16x8.mul(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.add(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.sub(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i32x4.mul(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i64x2.add(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.i64x2.sub(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.add(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.sub(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.mul(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.div(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.min(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.max(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.add(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.sub(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.mul(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.div(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.min(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.max(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + // SIMD lane manipulation + module.i8x16.extract_lane_s(module.v128.const(v128_bytes), 1), + module.i8x16.extract_lane_u(module.v128.const(v128_bytes), 1), + module.i16x8.extract_lane_s(module.v128.const(v128_bytes), 1), + module.i16x8.extract_lane_u(module.v128.const(v128_bytes), 1), + module.i32x4.extract_lane(module.v128.const(v128_bytes), 1), + module.i64x2.extract_lane(module.v128.const(v128_bytes), 1), + module.f32x4.extract_lane(module.v128.const(v128_bytes), 1), + module.f64x2.extract_lane(module.v128.const(v128_bytes), 1), + module.i16x8.replace_lane(module.v128.const(v128_bytes), 1, module.i32.const(42)), + module.i8x16.replace_lane(module.v128.const(v128_bytes), 1, module.i32.const(42)), + module.i32x4.replace_lane(module.v128.const(v128_bytes), 1, module.i32.const(42)), + module.i64x2.replace_lane(module.v128.const(v128_bytes), 1, module.i64.const(42, 43)), + module.f32x4.replace_lane(module.v128.const(v128_bytes), 1, module.f32.const(42)), + module.f64x2.replace_lane(module.v128.const(v128_bytes), 1, module.f64.const(42)), + // // SIMD shift + module.i8x16.shl(module.v128.const(v128_bytes), module.i32.const(1)), + module.i8x16.shr_s(module.v128.const(v128_bytes), module.i32.const(1)), + module.i8x16.shr_u(module.v128.const(v128_bytes), module.i32.const(1)), + module.i16x8.shl(module.v128.const(v128_bytes), module.i32.const(1)), + module.i16x8.shr_s(module.v128.const(v128_bytes), module.i32.const(1)), + module.i16x8.shr_u(module.v128.const(v128_bytes), module.i32.const(1)), + module.i32x4.shl(module.v128.const(v128_bytes), module.i32.const(1)), + module.i32x4.shr_s(module.v128.const(v128_bytes), module.i32.const(1)), + module.i32x4.shr_u(module.v128.const(v128_bytes), module.i32.const(1)), + module.i64x2.shl(module.v128.const(v128_bytes), module.i32.const(1)), + module.i64x2.shr_s(module.v128.const(v128_bytes), module.i32.const(1)), + module.i64x2.shr_u(module.v128.const(v128_bytes), module.i32.const(1)), + // Other SIMD + module.v8x16.shuffle(module.v128.const(v128_bytes), module.v128.const(v128_bytes), v128_bytes), + module.v128.bitselect(module.v128.const(v128_bytes), module.v128.const(v128_bytes), module.v128.const(v128_bytes)), // All the rest module.block('', []), // block with no name module.if(temp1, temp2, temp3), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 1bf43df0279..1a9097cafc9 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -33,6 +33,11 @@ BinaryenAtomicCmpxchgId: 24 BinaryenAtomicRMWId: 23 BinaryenAtomicWaitId: 25 BinaryenAtomicWakeId: 26 +BinaryenSIMDExtractId: 27 +BinaryenSIMDReplaceId: 28 +BinaryenSIMDShuffleId: 29 +BinaryenSIMDBitselectId: 30 +BinaryenSIMDShiftId: 31 getExpressionInfo={"id":15,"type":3,"op":6} (f32.neg (f32.const -33.61199951171875) @@ -281,6 +286,171 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (i64.const -22) ) ) + (drop + (i8x16.splat + (i32.const 42) + ) + ) + (drop + (i16x8.splat + (i32.const 42) + ) + ) + (drop + (i32x4.splat + (i32.const 42) + ) + ) + (drop + (i64x2.splat + (i64.const 1958505087099) + ) + ) + (drop + (f32x4.splat + (f32.const 42) + ) + ) + (drop + (f64x2.splat + (f64.const 42) + ) + ) + (drop + (v128.not + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_s/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_u/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_s/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_u/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_s/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_u/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_s/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_u/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) (drop (i32.add (i32.const -10) @@ -473,703 +643,1311 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (f32.const -62.5) ) ) - (block + (drop + (i8x16.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (if - (i32.const 1) - (drop - (i32.const 2) + (drop + (i8x16.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (drop - (i32.const 3) + ) + (drop + (i8x16.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (if - (i32.const 4) - (drop - (i32.const 5) + (drop + (i8x16.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (loop $in (result i32) - (i32.const 0) + (i8x16.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (loop (result i32) - (i32.const 0) + (i8x16.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (br_if $the-value - (i32.const 1) - (i32.const 0) + (i8x16.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (br_if $the-nothing - (i32.const 2) + (drop + (i8x16.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br $the-value - (i32.const 3) + (drop + (i8x16.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br $the-nothing) - (br_table $the-value $the-value - (i32.const 1) - (i32.const 0) + (drop + (i8x16.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br_table $the-nothing $the-nothing - (i32.const 2) + (drop + (i16x8.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) (drop - (i32.eqz - (call "$kitchen()sinker" - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) + (i16x8.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eqz - (i32.trunc_s/f32 - (call $an-imported - (i32.const 13) - (f64.const 3.7) - ) - ) + (i16x8.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eqz - (call_indirect (type $iiIfF) - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - (i32.const 2449) - ) + (i16x8.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (get_local $0) + (i16x8.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (set_local $0 - (i32.const 101) + (drop + (i16x8.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) (drop - (tee_local $0 - (i32.const 102) + (i16x8.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.load - (i32.const 1) + (i16x8.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.load16_s offset=2 align=1 - (i32.const 8) + (i16x8.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.load - (i32.const 2) + (i16x8.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.load offset=2 - (i32.const 9) + (i32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (i32.store - (i32.const 10) - (i32.const 11) + (drop + (i32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (i64.store offset=2 align=4 - (i32.const 110) - (i64.const 111) + (drop + (i32x4.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) (drop - (select - (i32.const 3) - (i32.const 5) - (i32.const 1) + (i32x4.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (return - (i32.const 1337) + (drop + (i32x4.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (nop) - (unreachable) - ) - ) - ) - (i32.const 42) - ) - ) - (func $starter (; 2 ;) (type $v) - (nop) - ) -) - -raw: -(module - (type $v (func)) - (type $vi (func (param i32))) - (type $i (func (result i32))) - (import "module" "check" (func $check (param i32))) - (func $just-one-block (; 1 ;) (type $v) - (local $0 i32) - (call $check - (i32.const 1337) - ) - ) - (func $two-blocks (; 2 ;) (type $v) - (local $0 i32) - (block - (call $check - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - ) - ) - (func $two-blocks-plus-code (; 3 ;) (type $v) - (local $0 i32) - (block - (block - (call $check - (i32.const 0) - ) - (drop - (i32.const 77) - ) - ) - (call $check - (i32.const 1) - ) - ) - ) - (func $loop (; 4 ;) (type $v) - (local $0 i32) - (loop $shape$0$continue - (block - (call $check - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - ) - (block - (br $shape$0$continue) - ) - ) - ) - (func $loop-plus-code (; 5 ;) (type $v) - (local $0 i32) - (loop $shape$0$continue - (block - (block - (call $check - (i32.const 0) - ) - (drop - (i32.const 33) - ) - ) - (call $check - (i32.const 1) - ) - ) - (block - (drop - (i32.const -66) - ) - (br $shape$0$continue) - ) - ) - ) - (func $split (; 6 ;) (type $v) - (local $0 i32) - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (call $check - (i32.const 1) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - ) - (func $split-plus-code (; 7 ;) (type $v) - (local $0 i32) - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (drop - (i32.const 10) - ) - (block - (call $check - (i32.const 1) - ) - ) - ) - (block - (drop - (i32.const 20) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - ) - ) - (func $if (; 8 ;) (type $v) - (local $0 i32) - (block $block$3$break - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (call $check - (i32.const 1) - ) - (block - (br $block$3$break) - ) - ) - (br $block$3$break) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - (func $if-plus-code (; 9 ;) (type $v) - (local $0 i32) - (block $block$3$break - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (drop - (i32.const -1) - ) - (block - (call $check - (i32.const 1) + (drop + (i32x4.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (block - (drop - (i32.const -3) + (drop + (i32x4.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$3$break) ) - ) - ) - (block - (drop - (i32.const -2) - ) - (br $block$3$break) - ) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - (func $if-else (; 10 ;) (type $v) - (local $0 i32) - (block $block$4$break - (call $check - (i32.const 0) - ) - (if - (i32.const 55) - (block - (call $check - (i32.const 1) - ) - (block - (br $block$4$break) - ) - ) - (block - (call $check - (i32.const 2) - ) - (block - (br $block$4$break) - ) - ) - ) - ) - (block - (call $check - (i32.const 3) - ) - ) - ) - (func $loop-tail (; 11 ;) (type $v) - (local $0 i32) - (block $block$3$break - (loop $shape$0$continue - (block - (call $check - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - ) - (if - (i32.const 10) - (br $shape$0$continue) - (br $block$3$break) - ) - ) - ) - (block - (call $check - (i32.const 2) - ) - ) - ) - (func $nontrivial-loop-plus-phi-to-head (; 12 ;) (type $v) - (local $0 i32) - (block $block$2$break - (call $check - (i32.const 0) - ) - (block - (drop - (i32.const 10) - ) - (br $block$2$break) - ) - ) - (block - (block $block$7$break - (block $block$4$break - (loop $shape$1$continue - (block $block$3$break - (call $check - (i32.const 1) + (drop + (i32x4.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (if - (i32.const -2) - (br $block$3$break) - (block - (drop - (i32.const 20) - ) - (br $block$7$break) - ) + ) + (drop + (i32x4.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - (block - (call $check - (i32.const 2) + (drop + (i32x4.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (if - (i32.const -6) - (br $block$4$break) - (block - (drop - (i32.const 30) - ) - (br $shape$1$continue) - ) + ) + (drop + (f32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - ) - ) - (block - (block $block$6$break - (call $check - (i32.const 3) + (drop + (f32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (if - (i32.const -10) - (block - (call $check - (i32.const 4) - ) - (block - (br $block$6$break) - ) + (drop + (f32x4.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$6$break) ) - ) - (block - (call $check - (i32.const 5) + (drop + (f32x4.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (block - (drop - (i32.const 40) + (drop + (f32x4.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$7$break) ) - ) - ) - ) - (block - (call $check - (i32.const 6) - ) - ) - ) - ) - (func $switch (; 13 ;) (type $v) - (local $0 i32) - (call $check - (i32.const 0) - ) - (block $switch$1$leave - (block $switch$1$default - (block $switch$1$case$3 - (block $switch$1$case$2 - (br_table $switch$1$default $switch$1$default $switch$1$case$2 $switch$1$default $switch$1$case$3 $switch$1$case$2 $switch$1$default - (i32.const -99) + (drop + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - ) - (block - (block - (call $check - (i32.const 1) + (drop + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) - ) - (br $switch$1$leave) - ) - (block - (drop - (i32.const 55) - ) - (block - (call $check - (i32.const 2) + (drop + (f64x2.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - ) - ) - (br $switch$1$leave) - ) - (block - (block - (call $check - (i32.const 3) - ) - ) - ) - (br $switch$1$leave) - ) - ) - (func $duffs-device (; 14 ;) (type $v) - (local $0 i32) - (local $1 i32) - (local $2 i64) - (local $3 i32) - (local $4 f32) - (local $5 f64) - (local $6 i32) - (block - (block $block$3$break - (block $block$2$break - (call $check - (i32.const 0) - ) - (if - (i32.const 10) - (block - (set_local $3 - (i32.const 2) + (drop + (f64x2.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$2$break) ) - (block - (set_local $3 - (i32.const 3) + (drop + (f64x2.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $block$3$break) ) - ) - ) - ) - ) - (loop $shape$1$continue - (if - (i32.eq - (get_local $3) - (i32.const 2) - ) - (block - (set_local $3 - (i32.const 0) - ) - (call $check - (i32.const 1) - ) - (block - (set_local $3 - (i32.const 3) + (drop + (f64x2.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (br $shape$1$continue) - ) - ) - (if - (i32.eq - (get_local $3) - (i32.const 3) - ) - (block - (set_local $3 - (i32.const 0) + (drop + (f64x2.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) ) - (call $check - (i32.const 2) + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (block - (set_local $3 - (i32.const 2) + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + (drop + (i8x16.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) - (br $shape$1$continue) ) - ) - ) - ) - ) - ) - (func $return (; 15 ;) (type $i) (result i32) - (local $0 i32) - (block - (call $check - (i32.const 42) - ) - (return - (i32.const 1337) - ) - ) - ) -) - -optimized: -(module -) - -module loaded from binary form: -(module - (type $0 (func (param i32 i32) (result i32))) - (func $adder (; 0 ;) (type $0) (param $0 i32) (param $1 i32) (result i32) - (i32.add - (get_local $0) - (get_local $1) - ) - ) -) - -(module - (type $vi (func (param i32))) - (type $v (func)) - (import "spectest" "print" (func $print-i32 (param i32))) - (start $starter) - (func $starter (; 1 ;) (type $v) - (call $print-i32 - (i32.const 1234) - ) - ) -) - -(i32.const 1234) -(module - (type $v (func)) - (func $func (; 0 ;) (type $v) - (local $0 i32) - (set_local $0 - (i64.const 1234) - ) - ) -) - -[wasm-validator error in function $func] 1 != 2: set_local type must match function, on -[none] (set_local $0 - [i64] (i64.const 1234) -) -validation: 0 -// beginning a Binaryen API trace -#include -#include -#include "src/binaryen-c.h" -int main() { - std::map functionTypes; - std::map expressions; - std::map functions; - std::map globals; - std::map exports; - std::map relooperBlocks; - BinaryenModuleRef the_module = NULL; - RelooperRef the_relooper = NULL; - the_module = BinaryenModuleCreate(); - expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); - expressions[1] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt64(2)); - expressions[3] = BinaryenConst(the_module, BinaryenLiteralFloat32(3.14)); - expressions[4] = BinaryenConst(the_module, BinaryenLiteralFloat64(2.1828)); - expressions[5] = BinaryenConst(the_module, BinaryenLiteralFloat32(NAN)); - expressions[6] = BinaryenConst(the_module, BinaryenLiteralFloat64(NAN)); - { - BinaryenType paramTypes[] = { 1, 2, 3, 4 }; - functionTypes[0] = BinaryenAddFunctionType(the_module, "iiIfF", 1, paramTypes, 4); - } - expressions[7] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[8] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[9] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[10] = BinaryenConst(the_module, BinaryenLiteralInt32(4)); - expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); - expressions[12] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[13] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[14] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[15] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[16] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[17] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[18] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); - expressions[19] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); - expressions[20] = BinaryenConst(the_module, BinaryenLiteralInt32(11)); - expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(110)); - expressions[22] = BinaryenConst(the_module, BinaryenLiteralInt64(111)); - expressions[23] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[24] = BinaryenUnary(the_module, 0, expressions[23]); - expressions[25] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); - expressions[26] = BinaryenUnary(the_module, 3, expressions[25]); - expressions[27] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[28] = BinaryenUnary(the_module, 4, expressions[27]); - expressions[29] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + (drop + (i8x16.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.extract_lane_s 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.extract_lane_u 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.extract_lane_s 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.extract_lane_u 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i8x16.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i32x4.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i64x2.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i64.const 184683593770) + ) + ) + (drop + (f32x4.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f32.const 42) + ) + ) + (drop + (f64x2.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f64.const 42) + ) + ) + (drop + (i8x16.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (v8x16.shuffle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.bitselect + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (block + ) + (if + (i32.const 1) + (drop + (i32.const 2) + ) + (drop + (i32.const 3) + ) + ) + (if + (i32.const 4) + (drop + (i32.const 5) + ) + ) + (drop + (loop $in (result i32) + (i32.const 0) + ) + ) + (drop + (loop (result i32) + (i32.const 0) + ) + ) + (drop + (br_if $the-value + (i32.const 1) + (i32.const 0) + ) + ) + (br_if $the-nothing + (i32.const 2) + ) + (br $the-value + (i32.const 3) + ) + (br $the-nothing) + (br_table $the-value $the-value + (i32.const 1) + (i32.const 0) + ) + (br_table $the-nothing $the-nothing + (i32.const 2) + ) + (drop + (i32.eqz + (call "$kitchen()sinker" + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + ) + ) + ) + (drop + (i32.eqz + (i32.trunc_s/f32 + (call $an-imported + (i32.const 13) + (f64.const 3.7) + ) + ) + ) + ) + (drop + (i32.eqz + (call_indirect (type $iiIfF) + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + (i32.const 2449) + ) + ) + ) + (drop + (get_local $0) + ) + (set_local $0 + (i32.const 101) + ) + (drop + (tee_local $0 + (i32.const 102) + ) + ) + (drop + (i32.load + (i32.const 1) + ) + ) + (drop + (i64.load16_s offset=2 align=1 + (i32.const 8) + ) + ) + (drop + (f32.load + (i32.const 2) + ) + ) + (drop + (f64.load offset=2 + (i32.const 9) + ) + ) + (i32.store + (i32.const 10) + (i32.const 11) + ) + (i64.store offset=2 align=4 + (i32.const 110) + (i64.const 111) + ) + (drop + (select + (i32.const 3) + (i32.const 5) + (i32.const 1) + ) + ) + (return + (i32.const 1337) + ) + (nop) + (unreachable) + ) + ) + ) + (i32.const 42) + ) + ) + (func $starter (; 2 ;) (type $v) + (nop) + ) +) + +raw: +(module + (type $v (func)) + (type $vi (func (param i32))) + (type $i (func (result i32))) + (import "module" "check" (func $check (param i32))) + (func $just-one-block (; 1 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 1337) + ) + ) + (func $two-blocks (; 2 ;) (type $v) + (local $0 i32) + (block + (call $check + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + ) + ) + (func $two-blocks-plus-code (; 3 ;) (type $v) + (local $0 i32) + (block + (block + (call $check + (i32.const 0) + ) + (drop + (i32.const 77) + ) + ) + (call $check + (i32.const 1) + ) + ) + ) + (func $loop (; 4 ;) (type $v) + (local $0 i32) + (loop $shape$0$continue + (block + (call $check + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + ) + (block + (br $shape$0$continue) + ) + ) + ) + (func $loop-plus-code (; 5 ;) (type $v) + (local $0 i32) + (loop $shape$0$continue + (block + (block + (call $check + (i32.const 0) + ) + (drop + (i32.const 33) + ) + ) + (call $check + (i32.const 1) + ) + ) + (block + (drop + (i32.const -66) + ) + (br $shape$0$continue) + ) + ) + ) + (func $split (; 6 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (call $check + (i32.const 1) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + ) + (func $split-plus-code (; 7 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (drop + (i32.const 10) + ) + (block + (call $check + (i32.const 1) + ) + ) + ) + (block + (drop + (i32.const 20) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + ) + ) + (func $if (; 8 ;) (type $v) + (local $0 i32) + (block $block$3$break + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (call $check + (i32.const 1) + ) + (block + (br $block$3$break) + ) + ) + (br $block$3$break) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + (func $if-plus-code (; 9 ;) (type $v) + (local $0 i32) + (block $block$3$break + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (drop + (i32.const -1) + ) + (block + (call $check + (i32.const 1) + ) + (block + (drop + (i32.const -3) + ) + (br $block$3$break) + ) + ) + ) + (block + (drop + (i32.const -2) + ) + (br $block$3$break) + ) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + (func $if-else (; 10 ;) (type $v) + (local $0 i32) + (block $block$4$break + (call $check + (i32.const 0) + ) + (if + (i32.const 55) + (block + (call $check + (i32.const 1) + ) + (block + (br $block$4$break) + ) + ) + (block + (call $check + (i32.const 2) + ) + (block + (br $block$4$break) + ) + ) + ) + ) + (block + (call $check + (i32.const 3) + ) + ) + ) + (func $loop-tail (; 11 ;) (type $v) + (local $0 i32) + (block $block$3$break + (loop $shape$0$continue + (block + (call $check + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + ) + (if + (i32.const 10) + (br $shape$0$continue) + (br $block$3$break) + ) + ) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + (func $nontrivial-loop-plus-phi-to-head (; 12 ;) (type $v) + (local $0 i32) + (block $block$2$break + (call $check + (i32.const 0) + ) + (block + (drop + (i32.const 10) + ) + (br $block$2$break) + ) + ) + (block + (block $block$7$break + (block $block$4$break + (loop $shape$1$continue + (block $block$3$break + (call $check + (i32.const 1) + ) + (if + (i32.const -2) + (br $block$3$break) + (block + (drop + (i32.const 20) + ) + (br $block$7$break) + ) + ) + ) + (block + (call $check + (i32.const 2) + ) + (if + (i32.const -6) + (br $block$4$break) + (block + (drop + (i32.const 30) + ) + (br $shape$1$continue) + ) + ) + ) + ) + ) + (block + (block $block$6$break + (call $check + (i32.const 3) + ) + (if + (i32.const -10) + (block + (call $check + (i32.const 4) + ) + (block + (br $block$6$break) + ) + ) + (br $block$6$break) + ) + ) + (block + (call $check + (i32.const 5) + ) + (block + (drop + (i32.const 40) + ) + (br $block$7$break) + ) + ) + ) + ) + (block + (call $check + (i32.const 6) + ) + ) + ) + ) + (func $switch (; 13 ;) (type $v) + (local $0 i32) + (call $check + (i32.const 0) + ) + (block $switch$1$leave + (block $switch$1$default + (block $switch$1$case$3 + (block $switch$1$case$2 + (br_table $switch$1$default $switch$1$default $switch$1$case$2 $switch$1$default $switch$1$case$3 $switch$1$case$2 $switch$1$default + (i32.const -99) + ) + ) + (block + (block + (call $check + (i32.const 1) + ) + ) + ) + (br $switch$1$leave) + ) + (block + (drop + (i32.const 55) + ) + (block + (call $check + (i32.const 2) + ) + ) + ) + (br $switch$1$leave) + ) + (block + (block + (call $check + (i32.const 3) + ) + ) + ) + (br $switch$1$leave) + ) + ) + (func $duffs-device (; 14 ;) (type $v) + (local $0 i32) + (local $1 i32) + (local $2 i64) + (local $3 i32) + (local $4 f32) + (local $5 f64) + (local $6 i32) + (block + (block $block$3$break + (block $block$2$break + (call $check + (i32.const 0) + ) + (if + (i32.const 10) + (block + (set_local $3 + (i32.const 2) + ) + (br $block$2$break) + ) + (block + (set_local $3 + (i32.const 3) + ) + (br $block$3$break) + ) + ) + ) + ) + ) + (loop $shape$1$continue + (if + (i32.eq + (get_local $3) + (i32.const 2) + ) + (block + (set_local $3 + (i32.const 0) + ) + (call $check + (i32.const 1) + ) + (block + (set_local $3 + (i32.const 3) + ) + (br $shape$1$continue) + ) + ) + (if + (i32.eq + (get_local $3) + (i32.const 3) + ) + (block + (set_local $3 + (i32.const 0) + ) + (call $check + (i32.const 2) + ) + (block + (set_local $3 + (i32.const 2) + ) + (br $shape$1$continue) + ) + ) + ) + ) + ) + ) + (func $return (; 15 ;) (type $i) (result i32) + (local $0 i32) + (block + (call $check + (i32.const 42) + ) + (return + (i32.const 1337) + ) + ) + ) +) + +optimized: +(module +) + +module loaded from binary form: +(module + (type $0 (func (param i32 i32) (result i32))) + (func $adder (; 0 ;) (type $0) (param $0 i32) (param $1 i32) (result i32) + (i32.add + (get_local $0) + (get_local $1) + ) + ) +) + +(module + (type $vi (func (param i32))) + (type $v (func)) + (import "spectest" "print" (func $print-i32 (param i32))) + (start $starter) + (func $starter (; 1 ;) (type $v) + (call $print-i32 + (i32.const 1234) + ) + ) +) + +(i32.const 1234) +(module + (type $v (func)) + (func $func (; 0 ;) (type $v) + (local $0 i32) + (set_local $0 + (i64.const 1234) + ) + ) +) + +[wasm-validator error in function $func] 1 != 2: set_local type must match function, on +[none] (set_local $0 + [i64] (i64.const 1234) +) +validation: 0 +// beginning a Binaryen API trace +#include +#include +#include "src/binaryen-c.h" +int main() { + std::map functionTypes; + std::map expressions; + std::map functions; + std::map globals; + std::map exports; + std::map relooperBlocks; + BinaryenModuleRef the_module = NULL; + RelooperRef the_relooper = NULL; + the_module = BinaryenModuleCreate(); + expressions[size_t(NULL)] = BinaryenExpressionRef(NULL); + expressions[1] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt64(2)); + expressions[3] = BinaryenConst(the_module, BinaryenLiteralFloat32(3.14)); + expressions[4] = BinaryenConst(the_module, BinaryenLiteralFloat64(2.1828)); + expressions[5] = BinaryenConst(the_module, BinaryenLiteralFloat32(NAN)); + expressions[6] = BinaryenConst(the_module, BinaryenLiteralFloat64(NAN)); + { + BinaryenType paramTypes[] = { 1, 2, 3, 4 }; + functionTypes[0] = BinaryenAddFunctionType(the_module, "iiIfF", 1, paramTypes, 4); + } + expressions[7] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[8] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[9] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[10] = BinaryenConst(the_module, BinaryenLiteralInt32(4)); + expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); + expressions[12] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[13] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[14] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[15] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[16] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[17] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[18] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); + expressions[19] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + expressions[20] = BinaryenConst(the_module, BinaryenLiteralInt32(11)); + expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(110)); + expressions[22] = BinaryenConst(the_module, BinaryenLiteralInt64(111)); + expressions[23] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[24] = BinaryenUnary(the_module, 0, expressions[23]); + expressions[25] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); + expressions[26] = BinaryenUnary(the_module, 3, expressions[25]); + expressions[27] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[28] = BinaryenUnary(the_module, 4, expressions[27]); + expressions[29] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); expressions[30] = BinaryenUnary(the_module, 6, expressions[29]); expressions[31] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); expressions[32] = BinaryenUnary(the_module, 9, expressions[31]); @@ -1251,176 +2029,1180 @@ int main() { expressions[108] = BinaryenUnary(the_module, 45, expressions[107]); expressions[109] = BinaryenConst(the_module, BinaryenLiteralInt64(-22)); expressions[110] = BinaryenUnary(the_module, 46, expressions[109]); - expressions[111] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[112] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[113] = BinaryenBinary(the_module, 0, expressions[111], expressions[112]); - expressions[114] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[115] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[116] = BinaryenBinary(the_module, 64, expressions[114], expressions[115]); - expressions[117] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[118] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[119] = BinaryenBinary(the_module, 3, expressions[117], expressions[118]); - expressions[120] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[121] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[122] = BinaryenBinary(the_module, 29, expressions[120], expressions[121]); - expressions[123] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[124] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[125] = BinaryenBinary(the_module, 30, expressions[123], expressions[124]); - expressions[126] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[127] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[128] = BinaryenBinary(the_module, 6, expressions[126], expressions[127]); - expressions[129] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[130] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[131] = BinaryenBinary(the_module, 7, expressions[129], expressions[130]); - expressions[132] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[133] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[134] = BinaryenBinary(the_module, 33, expressions[132], expressions[133]); - expressions[135] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[136] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[137] = BinaryenBinary(the_module, 9, expressions[135], expressions[136]); - expressions[138] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[139] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[140] = BinaryenBinary(the_module, 35, expressions[138], expressions[139]); - expressions[141] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[142] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[143] = BinaryenBinary(the_module, 36, expressions[141], expressions[142]); - expressions[144] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[145] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[146] = BinaryenBinary(the_module, 12, expressions[144], expressions[145]); - expressions[147] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[148] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[149] = BinaryenBinary(the_module, 13, expressions[147], expressions[148]); - expressions[150] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[151] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[152] = BinaryenBinary(the_module, 39, expressions[150], expressions[151]); - expressions[153] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[154] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[155] = BinaryenBinary(the_module, 53, expressions[153], expressions[154]); - expressions[156] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[157] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[158] = BinaryenBinary(the_module, 67, expressions[156], expressions[157]); - expressions[159] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[160] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[161] = BinaryenBinary(the_module, 55, expressions[159], expressions[160]); - expressions[162] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[163] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[164] = BinaryenBinary(the_module, 69, expressions[162], expressions[163]); - expressions[165] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[166] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[167] = BinaryenBinary(the_module, 15, expressions[165], expressions[166]); - expressions[168] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[169] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[170] = BinaryenBinary(the_module, 58, expressions[168], expressions[169]); - expressions[171] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[172] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[173] = BinaryenBinary(the_module, 17, expressions[171], expressions[172]); - expressions[174] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[175] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[176] = BinaryenBinary(the_module, 43, expressions[174], expressions[175]); - expressions[177] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[178] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[179] = BinaryenBinary(the_module, 44, expressions[177], expressions[178]); - expressions[180] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[181] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[182] = BinaryenBinary(the_module, 20, expressions[180], expressions[181]); - expressions[183] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[184] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[185] = BinaryenBinary(the_module, 46, expressions[183], expressions[184]); - expressions[186] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[187] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[188] = BinaryenBinary(the_module, 22, expressions[186], expressions[187]); - expressions[189] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); - expressions[190] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); - expressions[191] = BinaryenBinary(the_module, 23, expressions[189], expressions[190]); - expressions[192] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); - expressions[193] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); - expressions[194] = BinaryenBinary(the_module, 49, expressions[192], expressions[193]); - expressions[195] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[196] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[197] = BinaryenBinary(the_module, 59, expressions[195], expressions[196]); - expressions[198] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[199] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[200] = BinaryenBinary(the_module, 73, expressions[198], expressions[199]); - expressions[201] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); - expressions[202] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); - expressions[203] = BinaryenBinary(the_module, 74, expressions[201], expressions[202]); - expressions[204] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); - expressions[205] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); - expressions[206] = BinaryenBinary(the_module, 62, expressions[204], expressions[205]); + expressions[111] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[112] = BinaryenUnary(the_module, 60, expressions[111]); + expressions[113] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[114] = BinaryenUnary(the_module, 61, expressions[113]); + expressions[115] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[116] = BinaryenUnary(the_module, 62, expressions[115]); + expressions[117] = BinaryenConst(the_module, BinaryenLiteralInt64(1958505087099)); + expressions[118] = BinaryenUnary(the_module, 63, expressions[117]); + expressions[119] = BinaryenConst(the_module, BinaryenLiteralFloat32(42)); + expressions[120] = BinaryenUnary(the_module, 64, expressions[119]); + expressions[121] = BinaryenConst(the_module, BinaryenLiteralFloat64(42)); + expressions[122] = BinaryenUnary(the_module, 65, expressions[121]); + { + uint8_t t0[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[123] = BinaryenConst(the_module, BinaryenLiteralVec128(t0)); + } + expressions[124] = BinaryenUnary(the_module, 66, expressions[123]); + { + uint8_t t1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[125] = BinaryenConst(the_module, BinaryenLiteralVec128(t1)); + } + expressions[126] = BinaryenUnary(the_module, 67, expressions[125]); + { + uint8_t t2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[127] = BinaryenConst(the_module, BinaryenLiteralVec128(t2)); + } + expressions[128] = BinaryenUnary(the_module, 68, expressions[127]); + { + uint8_t t3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[129] = BinaryenConst(the_module, BinaryenLiteralVec128(t3)); + } + expressions[130] = BinaryenUnary(the_module, 69, expressions[129]); + { + uint8_t t4[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[131] = BinaryenConst(the_module, BinaryenLiteralVec128(t4)); + } + expressions[132] = BinaryenUnary(the_module, 70, expressions[131]); + { + uint8_t t5[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[133] = BinaryenConst(the_module, BinaryenLiteralVec128(t5)); + } + expressions[134] = BinaryenUnary(the_module, 71, expressions[133]); + { + uint8_t t6[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[135] = BinaryenConst(the_module, BinaryenLiteralVec128(t6)); + } + expressions[136] = BinaryenUnary(the_module, 72, expressions[135]); + { + uint8_t t7[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[137] = BinaryenConst(the_module, BinaryenLiteralVec128(t7)); + } + expressions[138] = BinaryenUnary(the_module, 73, expressions[137]); + { + uint8_t t8[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[139] = BinaryenConst(the_module, BinaryenLiteralVec128(t8)); + } + expressions[140] = BinaryenUnary(the_module, 74, expressions[139]); + { + uint8_t t9[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[141] = BinaryenConst(the_module, BinaryenLiteralVec128(t9)); + } + expressions[142] = BinaryenUnary(the_module, 75, expressions[141]); + { + uint8_t t10[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[143] = BinaryenConst(the_module, BinaryenLiteralVec128(t10)); + } + expressions[144] = BinaryenUnary(the_module, 76, expressions[143]); + { + uint8_t t11[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[145] = BinaryenConst(the_module, BinaryenLiteralVec128(t11)); + } + expressions[146] = BinaryenUnary(the_module, 77, expressions[145]); + { + uint8_t t12[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[147] = BinaryenConst(the_module, BinaryenLiteralVec128(t12)); + } + expressions[148] = BinaryenUnary(the_module, 78, expressions[147]); + { + uint8_t t13[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[149] = BinaryenConst(the_module, BinaryenLiteralVec128(t13)); + } + expressions[150] = BinaryenUnary(the_module, 79, expressions[149]); + { + uint8_t t14[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[151] = BinaryenConst(the_module, BinaryenLiteralVec128(t14)); + } + expressions[152] = BinaryenUnary(the_module, 80, expressions[151]); + { + uint8_t t15[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[153] = BinaryenConst(the_module, BinaryenLiteralVec128(t15)); + } + expressions[154] = BinaryenUnary(the_module, 81, expressions[153]); + { + uint8_t t16[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[155] = BinaryenConst(the_module, BinaryenLiteralVec128(t16)); + } + expressions[156] = BinaryenUnary(the_module, 82, expressions[155]); + { + uint8_t t17[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[157] = BinaryenConst(the_module, BinaryenLiteralVec128(t17)); + } + expressions[158] = BinaryenUnary(the_module, 83, expressions[157]); + { + uint8_t t18[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[159] = BinaryenConst(the_module, BinaryenLiteralVec128(t18)); + } + expressions[160] = BinaryenUnary(the_module, 84, expressions[159]); + { + uint8_t t19[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[161] = BinaryenConst(the_module, BinaryenLiteralVec128(t19)); + } + expressions[162] = BinaryenUnary(the_module, 85, expressions[161]); + { + uint8_t t20[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[163] = BinaryenConst(the_module, BinaryenLiteralVec128(t20)); + } + expressions[164] = BinaryenUnary(the_module, 86, expressions[163]); + { + uint8_t t21[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[165] = BinaryenConst(the_module, BinaryenLiteralVec128(t21)); + } + expressions[166] = BinaryenUnary(the_module, 87, expressions[165]); + { + uint8_t t22[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[167] = BinaryenConst(the_module, BinaryenLiteralVec128(t22)); + } + expressions[168] = BinaryenUnary(the_module, 88, expressions[167]); + { + uint8_t t23[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[169] = BinaryenConst(the_module, BinaryenLiteralVec128(t23)); + } + expressions[170] = BinaryenUnary(the_module, 89, expressions[169]); + { + uint8_t t24[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[171] = BinaryenConst(the_module, BinaryenLiteralVec128(t24)); + } + expressions[172] = BinaryenUnary(the_module, 90, expressions[171]); + { + uint8_t t25[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[173] = BinaryenConst(the_module, BinaryenLiteralVec128(t25)); + } + expressions[174] = BinaryenUnary(the_module, 91, expressions[173]); + { + uint8_t t26[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[175] = BinaryenConst(the_module, BinaryenLiteralVec128(t26)); + } + expressions[176] = BinaryenUnary(the_module, 92, expressions[175]); + expressions[177] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[178] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[179] = BinaryenBinary(the_module, 0, expressions[177], expressions[178]); + expressions[180] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[181] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[182] = BinaryenBinary(the_module, 64, expressions[180], expressions[181]); + expressions[183] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[184] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[185] = BinaryenBinary(the_module, 3, expressions[183], expressions[184]); + expressions[186] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[187] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[188] = BinaryenBinary(the_module, 29, expressions[186], expressions[187]); + expressions[189] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[190] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[191] = BinaryenBinary(the_module, 30, expressions[189], expressions[190]); + expressions[192] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[193] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[194] = BinaryenBinary(the_module, 6, expressions[192], expressions[193]); + expressions[195] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[196] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[197] = BinaryenBinary(the_module, 7, expressions[195], expressions[196]); + expressions[198] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[199] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[200] = BinaryenBinary(the_module, 33, expressions[198], expressions[199]); + expressions[201] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[202] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[203] = BinaryenBinary(the_module, 9, expressions[201], expressions[202]); + expressions[204] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[205] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[206] = BinaryenBinary(the_module, 35, expressions[204], expressions[205]); + expressions[207] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[208] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[209] = BinaryenBinary(the_module, 36, expressions[207], expressions[208]); + expressions[210] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[211] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[212] = BinaryenBinary(the_module, 12, expressions[210], expressions[211]); + expressions[213] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[214] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[215] = BinaryenBinary(the_module, 13, expressions[213], expressions[214]); + expressions[216] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[217] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[218] = BinaryenBinary(the_module, 39, expressions[216], expressions[217]); + expressions[219] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[220] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[221] = BinaryenBinary(the_module, 53, expressions[219], expressions[220]); + expressions[222] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[223] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[224] = BinaryenBinary(the_module, 67, expressions[222], expressions[223]); + expressions[225] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[226] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[227] = BinaryenBinary(the_module, 55, expressions[225], expressions[226]); + expressions[228] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[229] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[230] = BinaryenBinary(the_module, 69, expressions[228], expressions[229]); + expressions[231] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[232] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[233] = BinaryenBinary(the_module, 15, expressions[231], expressions[232]); + expressions[234] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[235] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[236] = BinaryenBinary(the_module, 58, expressions[234], expressions[235]); + expressions[237] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[238] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[239] = BinaryenBinary(the_module, 17, expressions[237], expressions[238]); + expressions[240] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[241] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[242] = BinaryenBinary(the_module, 43, expressions[240], expressions[241]); + expressions[243] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[244] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[245] = BinaryenBinary(the_module, 44, expressions[243], expressions[244]); + expressions[246] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[247] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[248] = BinaryenBinary(the_module, 20, expressions[246], expressions[247]); + expressions[249] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[250] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[251] = BinaryenBinary(the_module, 46, expressions[249], expressions[250]); + expressions[252] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[253] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[254] = BinaryenBinary(the_module, 22, expressions[252], expressions[253]); + expressions[255] = BinaryenConst(the_module, BinaryenLiteralInt32(-10)); + expressions[256] = BinaryenConst(the_module, BinaryenLiteralInt32(-11)); + expressions[257] = BinaryenBinary(the_module, 23, expressions[255], expressions[256]); + expressions[258] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967274)); + expressions[259] = BinaryenConst(the_module, BinaryenLiteralInt64(4294967273)); + expressions[260] = BinaryenBinary(the_module, 49, expressions[258], expressions[259]); + expressions[261] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[262] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[263] = BinaryenBinary(the_module, 59, expressions[261], expressions[262]); + expressions[264] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[265] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[266] = BinaryenBinary(the_module, 73, expressions[264], expressions[265]); + expressions[267] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9005.84)); + expressions[268] = BinaryenConst(the_module, BinaryenLiteralFloat64(-9007.33)); + expressions[269] = BinaryenBinary(the_module, 74, expressions[267], expressions[268]); + expressions[270] = BinaryenConst(the_module, BinaryenLiteralFloat32(-33.612)); + expressions[271] = BinaryenConst(the_module, BinaryenLiteralFloat32(-62.5)); + expressions[272] = BinaryenBinary(the_module, 62, expressions[270], expressions[271]); + { + uint8_t t27[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[273] = BinaryenConst(the_module, BinaryenLiteralVec128(t27)); + } + { + uint8_t t28[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[274] = BinaryenConst(the_module, BinaryenLiteralVec128(t28)); + } + expressions[275] = BinaryenBinary(the_module, 76, expressions[273], expressions[274]); + { + uint8_t t29[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[276] = BinaryenConst(the_module, BinaryenLiteralVec128(t29)); + } + { + uint8_t t30[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[277] = BinaryenConst(the_module, BinaryenLiteralVec128(t30)); + } + expressions[278] = BinaryenBinary(the_module, 77, expressions[276], expressions[277]); + { + uint8_t t31[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[279] = BinaryenConst(the_module, BinaryenLiteralVec128(t31)); + } + { + uint8_t t32[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[280] = BinaryenConst(the_module, BinaryenLiteralVec128(t32)); + } + expressions[281] = BinaryenBinary(the_module, 78, expressions[279], expressions[280]); + { + uint8_t t33[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[282] = BinaryenConst(the_module, BinaryenLiteralVec128(t33)); + } + { + uint8_t t34[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[283] = BinaryenConst(the_module, BinaryenLiteralVec128(t34)); + } + expressions[284] = BinaryenBinary(the_module, 79, expressions[282], expressions[283]); + { + uint8_t t35[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[285] = BinaryenConst(the_module, BinaryenLiteralVec128(t35)); + } + { + uint8_t t36[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[286] = BinaryenConst(the_module, BinaryenLiteralVec128(t36)); + } + expressions[287] = BinaryenBinary(the_module, 80, expressions[285], expressions[286]); + { + uint8_t t37[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[288] = BinaryenConst(the_module, BinaryenLiteralVec128(t37)); + } + { + uint8_t t38[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[289] = BinaryenConst(the_module, BinaryenLiteralVec128(t38)); + } + expressions[290] = BinaryenBinary(the_module, 81, expressions[288], expressions[289]); + { + uint8_t t39[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[291] = BinaryenConst(the_module, BinaryenLiteralVec128(t39)); + } + { + uint8_t t40[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[292] = BinaryenConst(the_module, BinaryenLiteralVec128(t40)); + } + expressions[293] = BinaryenBinary(the_module, 82, expressions[291], expressions[292]); + { + uint8_t t41[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[294] = BinaryenConst(the_module, BinaryenLiteralVec128(t41)); + } + { + uint8_t t42[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[295] = BinaryenConst(the_module, BinaryenLiteralVec128(t42)); + } + expressions[296] = BinaryenBinary(the_module, 83, expressions[294], expressions[295]); + { + uint8_t t43[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[297] = BinaryenConst(the_module, BinaryenLiteralVec128(t43)); + } + { + uint8_t t44[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[298] = BinaryenConst(the_module, BinaryenLiteralVec128(t44)); + } + expressions[299] = BinaryenBinary(the_module, 84, expressions[297], expressions[298]); + { + uint8_t t45[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[300] = BinaryenConst(the_module, BinaryenLiteralVec128(t45)); + } + { + uint8_t t46[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[301] = BinaryenConst(the_module, BinaryenLiteralVec128(t46)); + } + expressions[302] = BinaryenBinary(the_module, 85, expressions[300], expressions[301]); + { + uint8_t t47[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[303] = BinaryenConst(the_module, BinaryenLiteralVec128(t47)); + } + { + uint8_t t48[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[304] = BinaryenConst(the_module, BinaryenLiteralVec128(t48)); + } + expressions[305] = BinaryenBinary(the_module, 86, expressions[303], expressions[304]); + { + uint8_t t49[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[306] = BinaryenConst(the_module, BinaryenLiteralVec128(t49)); + } + { + uint8_t t50[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[307] = BinaryenConst(the_module, BinaryenLiteralVec128(t50)); + } + expressions[308] = BinaryenBinary(the_module, 87, expressions[306], expressions[307]); + { + uint8_t t51[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[309] = BinaryenConst(the_module, BinaryenLiteralVec128(t51)); + } + { + uint8_t t52[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[310] = BinaryenConst(the_module, BinaryenLiteralVec128(t52)); + } + expressions[311] = BinaryenBinary(the_module, 88, expressions[309], expressions[310]); + { + uint8_t t53[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[312] = BinaryenConst(the_module, BinaryenLiteralVec128(t53)); + } + { + uint8_t t54[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[313] = BinaryenConst(the_module, BinaryenLiteralVec128(t54)); + } + expressions[314] = BinaryenBinary(the_module, 89, expressions[312], expressions[313]); + { + uint8_t t55[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[315] = BinaryenConst(the_module, BinaryenLiteralVec128(t55)); + } + { + uint8_t t56[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[316] = BinaryenConst(the_module, BinaryenLiteralVec128(t56)); + } + expressions[317] = BinaryenBinary(the_module, 90, expressions[315], expressions[316]); + { + uint8_t t57[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[318] = BinaryenConst(the_module, BinaryenLiteralVec128(t57)); + } + { + uint8_t t58[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[319] = BinaryenConst(the_module, BinaryenLiteralVec128(t58)); + } + expressions[320] = BinaryenBinary(the_module, 91, expressions[318], expressions[319]); + { + uint8_t t59[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[321] = BinaryenConst(the_module, BinaryenLiteralVec128(t59)); + } + { + uint8_t t60[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[322] = BinaryenConst(the_module, BinaryenLiteralVec128(t60)); + } + expressions[323] = BinaryenBinary(the_module, 92, expressions[321], expressions[322]); + { + uint8_t t61[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[324] = BinaryenConst(the_module, BinaryenLiteralVec128(t61)); + } + { + uint8_t t62[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[325] = BinaryenConst(the_module, BinaryenLiteralVec128(t62)); + } + expressions[326] = BinaryenBinary(the_module, 93, expressions[324], expressions[325]); + { + uint8_t t63[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[327] = BinaryenConst(the_module, BinaryenLiteralVec128(t63)); + } + { + uint8_t t64[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[328] = BinaryenConst(the_module, BinaryenLiteralVec128(t64)); + } + expressions[329] = BinaryenBinary(the_module, 94, expressions[327], expressions[328]); + { + uint8_t t65[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[330] = BinaryenConst(the_module, BinaryenLiteralVec128(t65)); + } + { + uint8_t t66[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[331] = BinaryenConst(the_module, BinaryenLiteralVec128(t66)); + } + expressions[332] = BinaryenBinary(the_module, 95, expressions[330], expressions[331]); + { + uint8_t t67[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[333] = BinaryenConst(the_module, BinaryenLiteralVec128(t67)); + } + { + uint8_t t68[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[334] = BinaryenConst(the_module, BinaryenLiteralVec128(t68)); + } + expressions[335] = BinaryenBinary(the_module, 96, expressions[333], expressions[334]); + { + uint8_t t69[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[336] = BinaryenConst(the_module, BinaryenLiteralVec128(t69)); + } + { + uint8_t t70[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[337] = BinaryenConst(the_module, BinaryenLiteralVec128(t70)); + } + expressions[338] = BinaryenBinary(the_module, 97, expressions[336], expressions[337]); + { + uint8_t t71[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[339] = BinaryenConst(the_module, BinaryenLiteralVec128(t71)); + } + { + uint8_t t72[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[340] = BinaryenConst(the_module, BinaryenLiteralVec128(t72)); + } + expressions[341] = BinaryenBinary(the_module, 98, expressions[339], expressions[340]); + { + uint8_t t73[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[342] = BinaryenConst(the_module, BinaryenLiteralVec128(t73)); + } + { + uint8_t t74[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[343] = BinaryenConst(the_module, BinaryenLiteralVec128(t74)); + } + expressions[344] = BinaryenBinary(the_module, 99, expressions[342], expressions[343]); + { + uint8_t t75[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[345] = BinaryenConst(the_module, BinaryenLiteralVec128(t75)); + } + { + uint8_t t76[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[346] = BinaryenConst(the_module, BinaryenLiteralVec128(t76)); + } + expressions[347] = BinaryenBinary(the_module, 100, expressions[345], expressions[346]); + { + uint8_t t77[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[348] = BinaryenConst(the_module, BinaryenLiteralVec128(t77)); + } + { + uint8_t t78[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[349] = BinaryenConst(the_module, BinaryenLiteralVec128(t78)); + } + expressions[350] = BinaryenBinary(the_module, 101, expressions[348], expressions[349]); + { + uint8_t t79[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[351] = BinaryenConst(the_module, BinaryenLiteralVec128(t79)); + } + { + uint8_t t80[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[352] = BinaryenConst(the_module, BinaryenLiteralVec128(t80)); + } + expressions[353] = BinaryenBinary(the_module, 102, expressions[351], expressions[352]); + { + uint8_t t81[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[354] = BinaryenConst(the_module, BinaryenLiteralVec128(t81)); + } + { + uint8_t t82[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[355] = BinaryenConst(the_module, BinaryenLiteralVec128(t82)); + } + expressions[356] = BinaryenBinary(the_module, 103, expressions[354], expressions[355]); + { + uint8_t t83[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[357] = BinaryenConst(the_module, BinaryenLiteralVec128(t83)); + } + { + uint8_t t84[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[358] = BinaryenConst(the_module, BinaryenLiteralVec128(t84)); + } + expressions[359] = BinaryenBinary(the_module, 104, expressions[357], expressions[358]); + { + uint8_t t85[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[360] = BinaryenConst(the_module, BinaryenLiteralVec128(t85)); + } + { + uint8_t t86[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[361] = BinaryenConst(the_module, BinaryenLiteralVec128(t86)); + } + expressions[362] = BinaryenBinary(the_module, 105, expressions[360], expressions[361]); + { + uint8_t t87[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[363] = BinaryenConst(the_module, BinaryenLiteralVec128(t87)); + } + { + uint8_t t88[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[364] = BinaryenConst(the_module, BinaryenLiteralVec128(t88)); + } + expressions[365] = BinaryenBinary(the_module, 106, expressions[363], expressions[364]); + { + uint8_t t89[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[366] = BinaryenConst(the_module, BinaryenLiteralVec128(t89)); + } + { + uint8_t t90[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[367] = BinaryenConst(the_module, BinaryenLiteralVec128(t90)); + } + expressions[368] = BinaryenBinary(the_module, 107, expressions[366], expressions[367]); + { + uint8_t t91[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[369] = BinaryenConst(the_module, BinaryenLiteralVec128(t91)); + } + { + uint8_t t92[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[370] = BinaryenConst(the_module, BinaryenLiteralVec128(t92)); + } + expressions[371] = BinaryenBinary(the_module, 108, expressions[369], expressions[370]); + { + uint8_t t93[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[372] = BinaryenConst(the_module, BinaryenLiteralVec128(t93)); + } + { + uint8_t t94[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[373] = BinaryenConst(the_module, BinaryenLiteralVec128(t94)); + } + expressions[374] = BinaryenBinary(the_module, 109, expressions[372], expressions[373]); + { + uint8_t t95[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[375] = BinaryenConst(the_module, BinaryenLiteralVec128(t95)); + } + { + uint8_t t96[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[376] = BinaryenConst(the_module, BinaryenLiteralVec128(t96)); + } + expressions[377] = BinaryenBinary(the_module, 110, expressions[375], expressions[376]); + { + uint8_t t97[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[378] = BinaryenConst(the_module, BinaryenLiteralVec128(t97)); + } + { + uint8_t t98[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[379] = BinaryenConst(the_module, BinaryenLiteralVec128(t98)); + } + expressions[380] = BinaryenBinary(the_module, 111, expressions[378], expressions[379]); + { + uint8_t t99[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[381] = BinaryenConst(the_module, BinaryenLiteralVec128(t99)); + } + { + uint8_t t100[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[382] = BinaryenConst(the_module, BinaryenLiteralVec128(t100)); + } + expressions[383] = BinaryenBinary(the_module, 111, expressions[381], expressions[382]); + { + uint8_t t101[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[384] = BinaryenConst(the_module, BinaryenLiteralVec128(t101)); + } + { + uint8_t t102[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[385] = BinaryenConst(the_module, BinaryenLiteralVec128(t102)); + } + expressions[386] = BinaryenBinary(the_module, 113, expressions[384], expressions[385]); + { + uint8_t t103[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[387] = BinaryenConst(the_module, BinaryenLiteralVec128(t103)); + } + { + uint8_t t104[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[388] = BinaryenConst(the_module, BinaryenLiteralVec128(t104)); + } + expressions[389] = BinaryenBinary(the_module, 114, expressions[387], expressions[388]); + { + uint8_t t105[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[390] = BinaryenConst(the_module, BinaryenLiteralVec128(t105)); + } + { + uint8_t t106[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[391] = BinaryenConst(the_module, BinaryenLiteralVec128(t106)); + } + expressions[392] = BinaryenBinary(the_module, 115, expressions[390], expressions[391]); + { + uint8_t t107[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[393] = BinaryenConst(the_module, BinaryenLiteralVec128(t107)); + } + { + uint8_t t108[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[394] = BinaryenConst(the_module, BinaryenLiteralVec128(t108)); + } + expressions[395] = BinaryenBinary(the_module, 116, expressions[393], expressions[394]); + { + uint8_t t109[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[396] = BinaryenConst(the_module, BinaryenLiteralVec128(t109)); + } + { + uint8_t t110[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[397] = BinaryenConst(the_module, BinaryenLiteralVec128(t110)); + } + expressions[398] = BinaryenBinary(the_module, 117, expressions[396], expressions[397]); + { + uint8_t t111[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[399] = BinaryenConst(the_module, BinaryenLiteralVec128(t111)); + } + { + uint8_t t112[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[400] = BinaryenConst(the_module, BinaryenLiteralVec128(t112)); + } + expressions[401] = BinaryenUnary(the_module, 118, expressions[399]); + { + uint8_t t113[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[402] = BinaryenConst(the_module, BinaryenLiteralVec128(t113)); + } + { + uint8_t t114[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[403] = BinaryenConst(the_module, BinaryenLiteralVec128(t114)); + } + expressions[404] = BinaryenUnary(the_module, 119, expressions[402]); + { + uint8_t t115[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[405] = BinaryenConst(the_module, BinaryenLiteralVec128(t115)); + } + { + uint8_t t116[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[406] = BinaryenConst(the_module, BinaryenLiteralVec128(t116)); + } + expressions[407] = BinaryenUnary(the_module, 120, expressions[405]); + { + uint8_t t117[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[408] = BinaryenConst(the_module, BinaryenLiteralVec128(t117)); + } + { + uint8_t t118[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[409] = BinaryenConst(the_module, BinaryenLiteralVec128(t118)); + } + expressions[410] = BinaryenBinary(the_module, 121, expressions[408], expressions[409]); + { + uint8_t t119[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[411] = BinaryenConst(the_module, BinaryenLiteralVec128(t119)); + } + { + uint8_t t120[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[412] = BinaryenConst(the_module, BinaryenLiteralVec128(t120)); + } + expressions[413] = BinaryenBinary(the_module, 122, expressions[411], expressions[412]); + { + uint8_t t121[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[414] = BinaryenConst(the_module, BinaryenLiteralVec128(t121)); + } + { + uint8_t t122[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[415] = BinaryenConst(the_module, BinaryenLiteralVec128(t122)); + } + expressions[416] = BinaryenBinary(the_module, 123, expressions[414], expressions[415]); + { + uint8_t t123[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[417] = BinaryenConst(the_module, BinaryenLiteralVec128(t123)); + } + { + uint8_t t124[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[418] = BinaryenConst(the_module, BinaryenLiteralVec128(t124)); + } + expressions[419] = BinaryenBinary(the_module, 124, expressions[417], expressions[418]); + { + uint8_t t125[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[420] = BinaryenConst(the_module, BinaryenLiteralVec128(t125)); + } + { + uint8_t t126[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[421] = BinaryenConst(the_module, BinaryenLiteralVec128(t126)); + } + expressions[422] = BinaryenBinary(the_module, 125, expressions[420], expressions[421]); + { + uint8_t t127[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[423] = BinaryenConst(the_module, BinaryenLiteralVec128(t127)); + } + { + uint8_t t128[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[424] = BinaryenConst(the_module, BinaryenLiteralVec128(t128)); + } + expressions[425] = BinaryenBinary(the_module, 126, expressions[423], expressions[424]); + { + uint8_t t129[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[426] = BinaryenConst(the_module, BinaryenLiteralVec128(t129)); + } + { + uint8_t t130[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[427] = BinaryenConst(the_module, BinaryenLiteralVec128(t130)); + } + expressions[428] = BinaryenBinary(the_module, 127, expressions[426], expressions[427]); + { + uint8_t t131[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[429] = BinaryenConst(the_module, BinaryenLiteralVec128(t131)); + } + { + uint8_t t132[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[430] = BinaryenConst(the_module, BinaryenLiteralVec128(t132)); + } + expressions[431] = BinaryenBinary(the_module, 128, expressions[429], expressions[430]); + { + uint8_t t133[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[432] = BinaryenConst(the_module, BinaryenLiteralVec128(t133)); + } + { + uint8_t t134[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[433] = BinaryenConst(the_module, BinaryenLiteralVec128(t134)); + } + expressions[434] = BinaryenBinary(the_module, 129, expressions[432], expressions[433]); + { + uint8_t t135[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[435] = BinaryenConst(the_module, BinaryenLiteralVec128(t135)); + } + { + uint8_t t136[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[436] = BinaryenConst(the_module, BinaryenLiteralVec128(t136)); + } + expressions[437] = BinaryenBinary(the_module, 130, expressions[435], expressions[436]); + { + uint8_t t137[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[438] = BinaryenConst(the_module, BinaryenLiteralVec128(t137)); + } + { + uint8_t t138[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[439] = BinaryenConst(the_module, BinaryenLiteralVec128(t138)); + } + expressions[440] = BinaryenBinary(the_module, 131, expressions[438], expressions[439]); + { + uint8_t t139[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[441] = BinaryenConst(the_module, BinaryenLiteralVec128(t139)); + } + { + uint8_t t140[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[442] = BinaryenConst(the_module, BinaryenLiteralVec128(t140)); + } + expressions[443] = BinaryenBinary(the_module, 132, expressions[441], expressions[442]); + { + uint8_t t141[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[444] = BinaryenConst(the_module, BinaryenLiteralVec128(t141)); + } + { + uint8_t t142[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[445] = BinaryenConst(the_module, BinaryenLiteralVec128(t142)); + } + expressions[446] = BinaryenBinary(the_module, 133, expressions[444], expressions[445]); + { + uint8_t t143[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[447] = BinaryenConst(the_module, BinaryenLiteralVec128(t143)); + } + { + uint8_t t144[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[448] = BinaryenConst(the_module, BinaryenLiteralVec128(t144)); + } + expressions[449] = BinaryenBinary(the_module, 134, expressions[447], expressions[448]); + { + uint8_t t145[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[450] = BinaryenConst(the_module, BinaryenLiteralVec128(t145)); + } + { + uint8_t t146[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[451] = BinaryenConst(the_module, BinaryenLiteralVec128(t146)); + } + expressions[452] = BinaryenBinary(the_module, 135, expressions[450], expressions[451]); + { + uint8_t t147[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[453] = BinaryenConst(the_module, BinaryenLiteralVec128(t147)); + } + { + uint8_t t148[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[454] = BinaryenConst(the_module, BinaryenLiteralVec128(t148)); + } + expressions[455] = BinaryenBinary(the_module, 136, expressions[453], expressions[454]); + { + uint8_t t149[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[456] = BinaryenConst(the_module, BinaryenLiteralVec128(t149)); + } + { + uint8_t t150[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[457] = BinaryenConst(the_module, BinaryenLiteralVec128(t150)); + } + expressions[458] = BinaryenBinary(the_module, 137, expressions[456], expressions[457]); + { + uint8_t t151[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[459] = BinaryenConst(the_module, BinaryenLiteralVec128(t151)); + } + { + uint8_t t152[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[460] = BinaryenConst(the_module, BinaryenLiteralVec128(t152)); + } + expressions[461] = BinaryenBinary(the_module, 138, expressions[459], expressions[460]); + { + uint8_t t153[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[462] = BinaryenConst(the_module, BinaryenLiteralVec128(t153)); + } + { + uint8_t t154[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[463] = BinaryenConst(the_module, BinaryenLiteralVec128(t154)); + } + expressions[464] = BinaryenBinary(the_module, 139, expressions[462], expressions[463]); + { + uint8_t t155[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[465] = BinaryenConst(the_module, BinaryenLiteralVec128(t155)); + } + { + uint8_t t156[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[466] = BinaryenConst(the_module, BinaryenLiteralVec128(t156)); + } + expressions[467] = BinaryenBinary(the_module, 140, expressions[465], expressions[466]); + { + uint8_t t157[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[468] = BinaryenConst(the_module, BinaryenLiteralVec128(t157)); + } + { + uint8_t t158[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[469] = BinaryenConst(the_module, BinaryenLiteralVec128(t158)); + } + expressions[470] = BinaryenBinary(the_module, 141, expressions[468], expressions[469]); + { + uint8_t t159[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[471] = BinaryenConst(the_module, BinaryenLiteralVec128(t159)); + } + { + uint8_t t160[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[472] = BinaryenConst(the_module, BinaryenLiteralVec128(t160)); + } + expressions[473] = BinaryenBinary(the_module, 142, expressions[471], expressions[472]); + { + uint8_t t161[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[474] = BinaryenConst(the_module, BinaryenLiteralVec128(t161)); + } + { + uint8_t t162[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[475] = BinaryenConst(the_module, BinaryenLiteralVec128(t162)); + } + expressions[476] = BinaryenBinary(the_module, 143, expressions[474], expressions[475]); + { + uint8_t t163[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[477] = BinaryenConst(the_module, BinaryenLiteralVec128(t163)); + } + { + uint8_t t164[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[478] = BinaryenConst(the_module, BinaryenLiteralVec128(t164)); + } + expressions[479] = BinaryenBinary(the_module, 144, expressions[477], expressions[478]); + { + uint8_t t165[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[480] = BinaryenConst(the_module, BinaryenLiteralVec128(t165)); + } + { + uint8_t t166[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[481] = BinaryenConst(the_module, BinaryenLiteralVec128(t166)); + } + expressions[482] = BinaryenBinary(the_module, 145, expressions[480], expressions[481]); + { + uint8_t t167[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[483] = BinaryenConst(the_module, BinaryenLiteralVec128(t167)); + } + { + uint8_t t168[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[484] = BinaryenConst(the_module, BinaryenLiteralVec128(t168)); + } + expressions[485] = BinaryenBinary(the_module, 146, expressions[483], expressions[484]); + { + uint8_t t169[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[486] = BinaryenConst(the_module, BinaryenLiteralVec128(t169)); + } + { + uint8_t t170[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[487] = BinaryenConst(the_module, BinaryenLiteralVec128(t170)); + } + expressions[488] = BinaryenBinary(the_module, 147, expressions[486], expressions[487]); + { + uint8_t t171[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[489] = BinaryenConst(the_module, BinaryenLiteralVec128(t171)); + } + { + uint8_t t172[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[490] = BinaryenConst(the_module, BinaryenLiteralVec128(t172)); + } + expressions[491] = BinaryenBinary(the_module, 148, expressions[489], expressions[490]); + { + uint8_t t173[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[492] = BinaryenConst(the_module, BinaryenLiteralVec128(t173)); + } + { + uint8_t t174[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[493] = BinaryenConst(the_module, BinaryenLiteralVec128(t174)); + } + expressions[494] = BinaryenBinary(the_module, 149, expressions[492], expressions[493]); + { + uint8_t t175[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[495] = BinaryenConst(the_module, BinaryenLiteralVec128(t175)); + } + { + uint8_t t176[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[496] = BinaryenConst(the_module, BinaryenLiteralVec128(t176)); + } + expressions[497] = BinaryenBinary(the_module, 150, expressions[495], expressions[496]); + { + uint8_t t177[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[498] = BinaryenConst(the_module, BinaryenLiteralVec128(t177)); + } + { + uint8_t t178[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[499] = BinaryenConst(the_module, BinaryenLiteralVec128(t178)); + } + expressions[500] = BinaryenBinary(the_module, 151, expressions[498], expressions[499]); + { + uint8_t t179[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[501] = BinaryenConst(the_module, BinaryenLiteralVec128(t179)); + } + expressions[502] = BinaryenSIMDExtract(the_module, 0, expressions[501], 1); + { + uint8_t t180[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[503] = BinaryenConst(the_module, BinaryenLiteralVec128(t180)); + } + expressions[504] = BinaryenSIMDExtract(the_module, 1, expressions[503], 1); + { + uint8_t t181[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[505] = BinaryenConst(the_module, BinaryenLiteralVec128(t181)); + } + expressions[506] = BinaryenSIMDExtract(the_module, 2, expressions[505], 1); + { + uint8_t t182[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[507] = BinaryenConst(the_module, BinaryenLiteralVec128(t182)); + } + expressions[508] = BinaryenSIMDExtract(the_module, 3, expressions[507], 1); + { + uint8_t t183[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[509] = BinaryenConst(the_module, BinaryenLiteralVec128(t183)); + } + expressions[510] = BinaryenSIMDExtract(the_module, 4, expressions[509], 1); + { + uint8_t t184[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[511] = BinaryenConst(the_module, BinaryenLiteralVec128(t184)); + } + expressions[512] = BinaryenSIMDExtract(the_module, 5, expressions[511], 1); + { + uint8_t t185[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[513] = BinaryenConst(the_module, BinaryenLiteralVec128(t185)); + } + expressions[514] = BinaryenSIMDExtract(the_module, 6, expressions[513], 1); + { + uint8_t t186[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[515] = BinaryenConst(the_module, BinaryenLiteralVec128(t186)); + } + expressions[516] = BinaryenSIMDExtract(the_module, 7, expressions[515], 1); + { + uint8_t t187[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[517] = BinaryenConst(the_module, BinaryenLiteralVec128(t187)); + } + expressions[518] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[519] = BinaryenSIMDReplace(the_module, 1, expressions[517], 1, expressions[518]); + { + uint8_t t188[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[520] = BinaryenConst(the_module, BinaryenLiteralVec128(t188)); + } + expressions[521] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[522] = BinaryenSIMDReplace(the_module, 0, expressions[520], 1, expressions[521]); + { + uint8_t t189[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[523] = BinaryenConst(the_module, BinaryenLiteralVec128(t189)); + } + expressions[524] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[525] = BinaryenSIMDReplace(the_module, 2, expressions[523], 1, expressions[524]); + { + uint8_t t190[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[526] = BinaryenConst(the_module, BinaryenLiteralVec128(t190)); + } + expressions[527] = BinaryenConst(the_module, BinaryenLiteralInt64(184683593770)); + expressions[528] = BinaryenSIMDReplace(the_module, 3, expressions[526], 1, expressions[527]); + { + uint8_t t191[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[529] = BinaryenConst(the_module, BinaryenLiteralVec128(t191)); + } + expressions[530] = BinaryenConst(the_module, BinaryenLiteralFloat32(42)); + expressions[531] = BinaryenSIMDReplace(the_module, 4, expressions[529], 1, expressions[530]); + { + uint8_t t192[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[532] = BinaryenConst(the_module, BinaryenLiteralVec128(t192)); + } + expressions[533] = BinaryenConst(the_module, BinaryenLiteralFloat64(42)); + expressions[534] = BinaryenSIMDReplace(the_module, 5, expressions[532], 1, expressions[533]); + { + uint8_t t193[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[535] = BinaryenConst(the_module, BinaryenLiteralVec128(t193)); + } + expressions[536] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[537] = BinaryenSIMDShift(the_module, 0, expressions[535], expressions[536]); + { + uint8_t t194[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[538] = BinaryenConst(the_module, BinaryenLiteralVec128(t194)); + } + expressions[539] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[540] = BinaryenSIMDShift(the_module, 1, expressions[538], expressions[539]); + { + uint8_t t195[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[541] = BinaryenConst(the_module, BinaryenLiteralVec128(t195)); + } + expressions[542] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[543] = BinaryenSIMDShift(the_module, 2, expressions[541], expressions[542]); + { + uint8_t t196[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[544] = BinaryenConst(the_module, BinaryenLiteralVec128(t196)); + } + expressions[545] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[546] = BinaryenSIMDShift(the_module, 3, expressions[544], expressions[545]); + { + uint8_t t197[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[547] = BinaryenConst(the_module, BinaryenLiteralVec128(t197)); + } + expressions[548] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[549] = BinaryenSIMDShift(the_module, 4, expressions[547], expressions[548]); + { + uint8_t t198[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[550] = BinaryenConst(the_module, BinaryenLiteralVec128(t198)); + } + expressions[551] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[552] = BinaryenSIMDShift(the_module, 5, expressions[550], expressions[551]); + { + uint8_t t199[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[553] = BinaryenConst(the_module, BinaryenLiteralVec128(t199)); + } + expressions[554] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[555] = BinaryenSIMDShift(the_module, 6, expressions[553], expressions[554]); + { + uint8_t t200[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[556] = BinaryenConst(the_module, BinaryenLiteralVec128(t200)); + } + expressions[557] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[558] = BinaryenSIMDShift(the_module, 7, expressions[556], expressions[557]); + { + uint8_t t201[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[559] = BinaryenConst(the_module, BinaryenLiteralVec128(t201)); + } + expressions[560] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[561] = BinaryenSIMDShift(the_module, 8, expressions[559], expressions[560]); + { + uint8_t t202[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[562] = BinaryenConst(the_module, BinaryenLiteralVec128(t202)); + } + expressions[563] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[564] = BinaryenSIMDShift(the_module, 9, expressions[562], expressions[563]); + { + uint8_t t203[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[565] = BinaryenConst(the_module, BinaryenLiteralVec128(t203)); + } + expressions[566] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[567] = BinaryenSIMDShift(the_module, 10, expressions[565], expressions[566]); + { + uint8_t t204[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[568] = BinaryenConst(the_module, BinaryenLiteralVec128(t204)); + } + expressions[569] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[570] = BinaryenSIMDShift(the_module, 11, expressions[568], expressions[569]); + { + uint8_t t205[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[571] = BinaryenConst(the_module, BinaryenLiteralVec128(t205)); + } + { + uint8_t t206[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[572] = BinaryenConst(the_module, BinaryenLiteralVec128(t206)); + } + { + uint8_t mask[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[573] = BinaryenSIMDShuffle(the_module, expressions[571], expressions[572], mask); + } + { + uint8_t t207[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[574] = BinaryenConst(the_module, BinaryenLiteralVec128(t207)); + } + { + uint8_t t208[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[575] = BinaryenConst(the_module, BinaryenLiteralVec128(t208)); + } + { + uint8_t t209[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[576] = BinaryenConst(the_module, BinaryenLiteralVec128(t209)); + } + expressions[577] = BinaryenSIMDBitselect(the_module, expressions[574], expressions[575], expressions[576]); { BinaryenExpressionRef children[] = { 0 }; - expressions[207] = BinaryenBlock(the_module, NULL, children, 0, 0); - } - expressions[208] = BinaryenIf(the_module, expressions[7], expressions[8], expressions[9]); - expressions[209] = BinaryenIf(the_module, expressions[10], expressions[11], expressions[0]); - expressions[210] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[211] = BinaryenLoop(the_module, "in", expressions[210]); - expressions[212] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[213] = BinaryenLoop(the_module, NULL, expressions[212]); - expressions[214] = BinaryenBreak(the_module, "the-value", expressions[12], expressions[13]); - expressions[215] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[216] = BinaryenBreak(the_module, "the-nothing", expressions[215], expressions[0]); - expressions[217] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[218] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[217]); - expressions[219] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]); + expressions[578] = BinaryenBlock(the_module, NULL, children, 0, 0); + } + expressions[579] = BinaryenIf(the_module, expressions[7], expressions[8], expressions[9]); + expressions[580] = BinaryenIf(the_module, expressions[10], expressions[11], expressions[0]); + expressions[581] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[582] = BinaryenLoop(the_module, "in", expressions[581]); + expressions[583] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[584] = BinaryenLoop(the_module, NULL, expressions[583]); + expressions[585] = BinaryenBreak(the_module, "the-value", expressions[12], expressions[13]); + expressions[586] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[587] = BinaryenBreak(the_module, "the-nothing", expressions[586], expressions[0]); + expressions[588] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[589] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[588]); + expressions[590] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]); { const char* names[] = { "the-value" }; - expressions[220] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[14], expressions[15]); + expressions[591] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[14], expressions[15]); } - expressions[221] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[592] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { const char* names[] = { "the-nothing" }; - expressions[222] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[221], expressions[0]); - } - expressions[223] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); - expressions[224] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); - expressions[225] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); - expressions[226] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); - { - BinaryenExpressionRef operands[] = { expressions[223], expressions[224], expressions[225], expressions[226] }; - expressions[227] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); - } - expressions[228] = BinaryenUnary(the_module, 20, expressions[227]); - expressions[229] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); - expressions[230] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); - { - BinaryenExpressionRef operands[] = { expressions[229], expressions[230] }; - expressions[231] = BinaryenCall(the_module, "an-imported", operands, 2, 3); - } - expressions[232] = BinaryenUnary(the_module, 25, expressions[231]); - expressions[233] = BinaryenUnary(the_module, 20, expressions[232]); - expressions[234] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); - expressions[235] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); - expressions[236] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); - expressions[237] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); - expressions[238] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); - { - BinaryenExpressionRef operands[] = { expressions[235], expressions[236], expressions[237], expressions[238] }; - expressions[239] = BinaryenCallIndirect(the_module, expressions[234], operands, 4, "iiIfF"); - } - expressions[240] = BinaryenUnary(the_module, 20, expressions[239]); - expressions[241] = BinaryenGetLocal(the_module, 0, 1); - expressions[242] = BinaryenDrop(the_module, expressions[241]); - expressions[243] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); - expressions[244] = BinaryenSetLocal(the_module, 0, expressions[243]); - expressions[245] = BinaryenConst(the_module, BinaryenLiteralInt32(102)); - expressions[246] = BinaryenTeeLocal(the_module, 0, expressions[245]); - expressions[247] = BinaryenDrop(the_module, expressions[246]); - expressions[248] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[249] = BinaryenLoad(the_module, 4, 1, 0, 0, 1, expressions[248]); - expressions[250] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); - expressions[251] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[250]); - expressions[252] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[253] = BinaryenLoad(the_module, 4, 1, 0, 0, 3, expressions[252]); - expressions[254] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); - expressions[255] = BinaryenLoad(the_module, 8, 1, 2, 8, 4, expressions[254]); - expressions[256] = BinaryenStore(the_module, 4, 0, 0, expressions[19], expressions[20], 1); - expressions[257] = BinaryenStore(the_module, 8, 2, 4, expressions[21], expressions[22], 2); - expressions[258] = BinaryenSelect(the_module, expressions[16], expressions[17], expressions[18]); - expressions[259] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); - expressions[260] = BinaryenReturn(the_module, expressions[259]); - expressions[261] = BinaryenNop(the_module); - expressions[262] = BinaryenUnreachable(the_module); + expressions[593] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[592], expressions[0]); + } + expressions[594] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); + expressions[595] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); + expressions[596] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); + expressions[597] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); + { + BinaryenExpressionRef operands[] = { expressions[594], expressions[595], expressions[596], expressions[597] }; + expressions[598] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); + } + expressions[599] = BinaryenUnary(the_module, 20, expressions[598]); + expressions[600] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); + expressions[601] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); + { + BinaryenExpressionRef operands[] = { expressions[600], expressions[601] }; + expressions[602] = BinaryenCall(the_module, "an-imported", operands, 2, 3); + } + expressions[603] = BinaryenUnary(the_module, 25, expressions[602]); + expressions[604] = BinaryenUnary(the_module, 20, expressions[603]); + expressions[605] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); + expressions[606] = BinaryenConst(the_module, BinaryenLiteralInt32(13)); + expressions[607] = BinaryenConst(the_module, BinaryenLiteralInt64(37)); + expressions[608] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3)); + expressions[609] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7)); + { + BinaryenExpressionRef operands[] = { expressions[606], expressions[607], expressions[608], expressions[609] }; + expressions[610] = BinaryenCallIndirect(the_module, expressions[605], operands, 4, "iiIfF"); + } + expressions[611] = BinaryenUnary(the_module, 20, expressions[610]); + expressions[612] = BinaryenGetLocal(the_module, 0, 1); + expressions[613] = BinaryenDrop(the_module, expressions[612]); + expressions[614] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); + expressions[615] = BinaryenSetLocal(the_module, 0, expressions[614]); + expressions[616] = BinaryenConst(the_module, BinaryenLiteralInt32(102)); + expressions[617] = BinaryenTeeLocal(the_module, 0, expressions[616]); + expressions[618] = BinaryenDrop(the_module, expressions[617]); + expressions[619] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[620] = BinaryenLoad(the_module, 4, 1, 0, 0, 1, expressions[619]); + expressions[621] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); + expressions[622] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[621]); + expressions[623] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[624] = BinaryenLoad(the_module, 4, 1, 0, 0, 3, expressions[623]); + expressions[625] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); + expressions[626] = BinaryenLoad(the_module, 8, 1, 2, 8, 4, expressions[625]); + expressions[627] = BinaryenStore(the_module, 4, 0, 0, expressions[19], expressions[20], 1); + expressions[628] = BinaryenStore(the_module, 8, 2, 4, expressions[21], expressions[22], 2); + expressions[629] = BinaryenSelect(the_module, expressions[16], expressions[17], expressions[18]); + expressions[630] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); + expressions[631] = BinaryenReturn(the_module, expressions[630]); + expressions[632] = BinaryenNop(the_module); + expressions[633] = BinaryenUnreachable(the_module); BinaryenExpressionGetId(expressions[30]); BinaryenExpressionGetType(expressions[30]); BinaryenUnaryGetOp(expressions[30]); @@ -1460,32 +3242,55 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} expressions[70], expressions[72], expressions[74], expressions[76], expressions[78], expressions[80], expressions[82], expressions[84], expressions[86], expressions[88], expressions[90], expressions[92], expressions[94], expressions[96], expressions[98], expressions[100], expressions[102], expressions[104], - expressions[106], expressions[108], expressions[110], expressions[113], expressions[116], expressions[119], - expressions[122], expressions[125], expressions[128], expressions[131], expressions[134], expressions[137], - expressions[140], expressions[143], expressions[146], expressions[149], expressions[152], expressions[155], - expressions[158], expressions[161], expressions[164], expressions[167], expressions[170], expressions[173], - expressions[176], expressions[179], expressions[182], expressions[185], expressions[188], expressions[191], - expressions[194], expressions[197], expressions[200], expressions[203], expressions[206], expressions[207], - expressions[208], expressions[209], expressions[211], expressions[213], expressions[214], expressions[216], - expressions[218], expressions[219], expressions[220], expressions[222], expressions[228], expressions[233], - expressions[240], expressions[242], expressions[244], expressions[247], expressions[249], expressions[251], - expressions[253], expressions[255], expressions[256], expressions[257], expressions[258], expressions[260], - expressions[261], expressions[262] }; - expressions[267] = BinaryenBlock(the_module, "the-value", children, 103, 0); + expressions[106], expressions[108], expressions[110], expressions[112], expressions[114], expressions[116], + expressions[118], expressions[120], expressions[122], expressions[124], expressions[126], expressions[128], + expressions[130], expressions[132], expressions[134], expressions[136], expressions[138], expressions[140], + expressions[142], expressions[144], expressions[146], expressions[148], expressions[150], expressions[152], + expressions[154], expressions[156], expressions[158], expressions[160], expressions[162], expressions[164], + expressions[166], expressions[168], expressions[170], expressions[172], expressions[174], expressions[176], + expressions[179], expressions[182], expressions[185], expressions[188], expressions[191], expressions[194], + expressions[197], expressions[200], expressions[203], expressions[206], expressions[209], expressions[212], + expressions[215], expressions[218], expressions[221], expressions[224], expressions[227], expressions[230], + expressions[233], expressions[236], expressions[239], expressions[242], expressions[245], expressions[248], + expressions[251], expressions[254], expressions[257], expressions[260], expressions[263], expressions[266], + expressions[269], expressions[272], expressions[275], expressions[278], expressions[281], expressions[284], + expressions[287], expressions[290], expressions[293], expressions[296], expressions[299], expressions[302], + expressions[305], expressions[308], expressions[311], expressions[314], expressions[317], expressions[320], + expressions[323], expressions[326], expressions[329], expressions[332], expressions[335], expressions[338], + expressions[341], expressions[344], expressions[347], expressions[350], expressions[353], expressions[356], + expressions[359], expressions[362], expressions[365], expressions[368], expressions[371], expressions[374], + expressions[377], expressions[380], expressions[383], expressions[386], expressions[389], expressions[392], + expressions[395], expressions[398], expressions[401], expressions[404], expressions[407], expressions[410], + expressions[413], expressions[416], expressions[419], expressions[422], expressions[425], expressions[428], + expressions[431], expressions[434], expressions[437], expressions[440], expressions[443], expressions[446], + expressions[449], expressions[452], expressions[455], expressions[458], expressions[461], expressions[464], + expressions[467], expressions[470], expressions[473], expressions[476], expressions[479], expressions[482], + expressions[485], expressions[488], expressions[491], expressions[494], expressions[497], expressions[500], + expressions[502], expressions[504], expressions[506], expressions[508], expressions[510], expressions[512], + expressions[514], expressions[516], expressions[519], expressions[522], expressions[525], expressions[528], + expressions[531], expressions[534], expressions[537], expressions[540], expressions[543], expressions[546], + expressions[549], expressions[552], expressions[555], expressions[558], expressions[561], expressions[564], + expressions[567], expressions[570], expressions[573], expressions[577], expressions[578], expressions[579], + expressions[580], expressions[582], expressions[584], expressions[585], expressions[587], expressions[589], + expressions[590], expressions[591], expressions[593], expressions[599], expressions[604], expressions[611], + expressions[613], expressions[615], expressions[618], expressions[620], expressions[622], expressions[624], + expressions[626], expressions[627], expressions[628], expressions[629], expressions[631], expressions[632], + expressions[633] }; + expressions[638] = BinaryenBlock(the_module, "the-value", children, 240, 0); } - expressions[268] = BinaryenDrop(the_module, expressions[267]); + expressions[639] = BinaryenDrop(the_module, expressions[638]); { - BinaryenExpressionRef children[] = { expressions[268] }; - expressions[269] = BinaryenBlock(the_module, "the-nothing", children, 1, 0); + BinaryenExpressionRef children[] = { expressions[639] }; + expressions[640] = BinaryenBlock(the_module, "the-nothing", children, 1, 0); } - expressions[270] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[641] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); { - BinaryenExpressionRef children[] = { expressions[269], expressions[270] }; - expressions[271] = BinaryenBlock(the_module, "the-body", children, 2, 0); + BinaryenExpressionRef children[] = { expressions[640], expressions[641] }; + expressions[642] = BinaryenBlock(the_module, "the-body", children, 2, 0); } { BinaryenType varTypes[] = { 1 }; - functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[271]); + functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[642]); } { BinaryenType paramTypes[] = { 1, 4 }; @@ -1510,11 +3315,11 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} const char* funcNames[] = { "kitchen()sinker" }; BinaryenSetFunctionTable(the_module, 1, 4294967295, funcNames, 1); } - expressions[272] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + expressions[643] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); { const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; const char* segments[] = { segment0 }; - BinaryenExpressionRef segmentOffsets[] = { expressions[272] }; + BinaryenExpressionRef segmentOffsets[] = { expressions[643] }; BinaryenIndex segmentSizes[] = { 12 }; BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0); } @@ -1522,10 +3327,10 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} BinaryenType paramTypes[] = { 0 }; functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); } - expressions[273] = BinaryenNop(the_module); + expressions[644] = BinaryenNop(the_module); { BinaryenType varTypes[] = { 0 }; - functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[273]); + functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[644]); } BinaryenSetStart(the_module, functions[1]); { @@ -1555,415 +3360,1188 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (drop (block $the-value (result i32) (drop - (i32.clz - (i32.const -10) + (i32.clz + (i32.const -10) + ) + ) + (drop + (i64.ctz + (i64.const -22) + ) + ) + (drop + (i32.popcnt + (i32.const -10) + ) + ) + (drop + (f32.neg + (f32.const -33.61199951171875) + ) + ) + (drop + (f64.abs + (f64.const -9005.841) + ) + ) + (drop + (f32.ceil + (f32.const -33.61199951171875) + ) + ) + (drop + (f64.floor + (f64.const -9005.841) + ) + ) + (drop + (f32.trunc + (f32.const -33.61199951171875) + ) + ) + (drop + (f32.nearest + (f32.const -33.61199951171875) + ) + ) + (drop + (f64.sqrt + (f64.const -9005.841) + ) + ) + (drop + (i32.eqz + (i32.const -10) + ) + ) + (drop + (i64.extend_s/i32 + (i32.const -10) + ) + ) + (drop + (i64.extend_u/i32 + (i32.const -10) + ) + ) + (drop + (i32.wrap/i64 + (i64.const -22) + ) + ) + (drop + (i32.trunc_s/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_s/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_u/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_u/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_s/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_s/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.trunc_u/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_u/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.trunc_s:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_s:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_u:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.trunc_u:sat/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i32.trunc_s:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_s:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.trunc_u:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i64.trunc_u:sat/f64 + (f64.const -9005.841) + ) + ) + (drop + (i32.reinterpret/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (i64.reinterpret/f64 + (f64.const -9005.841) + ) + ) + (drop + (f32.convert_s/i32 + (i32.const -10) + ) + ) + (drop + (f64.convert_s/i32 + (i32.const -10) + ) + ) + (drop + (f32.convert_u/i32 + (i32.const -10) + ) + ) + (drop + (f64.convert_u/i32 + (i32.const -10) + ) + ) + (drop + (f32.convert_s/i64 + (i64.const -22) + ) + ) + (drop + (f64.convert_s/i64 + (i64.const -22) + ) + ) + (drop + (f32.convert_u/i64 + (i64.const -22) + ) + ) + (drop + (f64.convert_u/i64 + (i64.const -22) + ) + ) + (drop + (f64.promote/f32 + (f32.const -33.61199951171875) + ) + ) + (drop + (f32.demote/f64 + (f64.const -9005.841) + ) + ) + (drop + (f32.reinterpret/i32 + (i32.const -10) + ) + ) + (drop + (f64.reinterpret/i64 + (i64.const -22) + ) + ) + (drop + (i8x16.splat + (i32.const 42) + ) + ) + (drop + (i16x8.splat + (i32.const 42) + ) + ) + (drop + (i32x4.splat + (i32.const 42) + ) + ) + (drop + (i64x2.splat + (i64.const 1958505087099) + ) + ) + (drop + (f32x4.splat + (f32.const 42) + ) + ) + (drop + (f64x2.splat + (f64.const 42) + ) + ) + (drop + (v128.not + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i16x8.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.any_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.all_true + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.abs + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.neg + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.sqrt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_s/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32x4.trunc_u/f32x4:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_s/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i64x2.trunc_u/f64x2:sat + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_s/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f32x4.convert_u/i32x4 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_s/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (f64x2.convert_u/i64x2 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i32.add + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (f64.sub + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (i32.div_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.div_u + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i64.rem_s + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i32.rem_u + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i32.and + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.or + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i32.xor + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.shl + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i64.shr_u + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i32.shr_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i32.rotl + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.rotr + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (f32.div + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + ) + (drop + (f64.copysign + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (f32.min + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + ) + (drop + (f64.max + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (i32.eq + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (f32.ne + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + ) + (drop + (i32.lt_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.lt_u + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i64.le_s + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i32.le_u + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.gt_s + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (i32.gt_u + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i32.ge_s + (i32.const -10) + (i32.const -11) + ) + ) + (drop + (i64.ge_u + (i64.const 4294967274) + (i64.const 4294967273) + ) + ) + (drop + (f32.lt + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + ) + (drop + (f64.le + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (f64.gt + (f64.const -9005.841) + (f64.const -9007.333) + ) + ) + (drop + (f32.ge + (f32.const -33.61199951171875) + (f32.const -62.5) + ) + ) + (drop + (i8x16.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (i8x16.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.ctz - (i64.const -22) + (i8x16.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.popcnt - (i32.const -10) + (i8x16.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.neg - (f32.const -33.61199951171875) + (i8x16.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.abs - (f64.const -9005.841) + (i16x8.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.ceil - (f32.const -33.61199951171875) + (i16x8.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.floor - (f64.const -9005.841) + (i16x8.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.trunc - (f32.const -33.61199951171875) + (i16x8.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.nearest - (f32.const -33.61199951171875) + (i16x8.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.sqrt - (f64.const -9005.841) + (i16x8.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eqz - (i32.const -10) + (i16x8.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.extend_s/i32 - (i32.const -10) + (i16x8.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.extend_u/i32 - (i32.const -10) + (i16x8.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.wrap/i64 - (i64.const -22) + (i16x8.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s/f32 - (f32.const -33.61199951171875) + (i32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s/f32 - (f32.const -33.61199951171875) + (i32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u/f32 - (f32.const -33.61199951171875) + (i32x4.lt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u/f32 - (f32.const -33.61199951171875) + (i32x4.lt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s/f64 - (f64.const -9005.841) + (i32x4.gt_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s/f64 - (f64.const -9005.841) + (i32x4.gt_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u/f64 - (f64.const -9005.841) + (i32x4.le_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u/f64 - (f64.const -9005.841) + (i32x4.le_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s:sat/f32 - (f32.const -33.61199951171875) + (i32x4.ge_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s:sat/f32 - (f32.const -33.61199951171875) + (i32x4.ge_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u:sat/f32 - (f32.const -33.61199951171875) + (f32x4.eq + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u:sat/f32 - (f32.const -33.61199951171875) + (f32x4.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_s:sat/f64 - (f64.const -9005.841) + (f32x4.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_s:sat/f64 - (f64.const -9005.841) + (f32x4.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.trunc_u:sat/f64 - (f64.const -9005.841) + (f32x4.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.trunc_u:sat/f64 - (f64.const -9005.841) + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.reinterpret/f32 - (f32.const -33.61199951171875) + (f32x4.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.reinterpret/f64 - (f64.const -9005.841) + (f64x2.ne + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_s/i32 - (i32.const -10) + (f64x2.lt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_s/i32 - (i32.const -10) + (f64x2.gt + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_u/i32 - (i32.const -10) + (f64x2.le + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_u/i32 - (i32.const -10) + (f64x2.ge + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ( + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) (drop - (f32.convert_s/i64 - (i64.const -22) + (i8x16.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_s/i64 - (i64.const -22) + (i8x16.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.convert_u/i64 - (i64.const -22) + (i8x16.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.convert_u/i64 - (i64.const -22) + (i8x16.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.promote/f32 - (f32.const -33.61199951171875) + (i8x16.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.demote/f64 - (f64.const -9005.841) + (i8x16.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.reinterpret/i32 - (i32.const -10) + (i8x16.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.reinterpret/i64 - (i64.const -22) + (i16x8.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.add - (i32.const -10) - (i32.const -11) + (i16x8.add_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.sub - (f64.const -9005.841) - (f64.const -9007.333) + (i16x8.add_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.div_s - (i32.const -10) - (i32.const -11) + (i16x8.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.div_u - (i64.const 4294967274) - (i64.const 4294967273) + (i16x8.sub_saturate_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.rem_s - (i64.const 4294967274) - (i64.const 4294967273) + (i16x8.sub_saturate_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.rem_u - (i32.const -10) - (i32.const -11) + (i16x8.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.and - (i32.const -10) - (i32.const -11) + (i32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.or - (i64.const 4294967274) - (i64.const 4294967273) + (i32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.xor - (i32.const -10) - (i32.const -11) + (i32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.shl - (i64.const 4294967274) - (i64.const 4294967273) + (i64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.shr_u - (i64.const 4294967274) - (i64.const 4294967273) + (i64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.shr_s - (i32.const -10) - (i32.const -11) + (f32x4.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.rotl - (i32.const -10) - (i32.const -11) + (f32x4.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.rotr - (i64.const 4294967274) - (i64.const 4294967273) + (f32x4.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.div - (f32.const -33.61199951171875) - (f32.const -62.5) + (f32x4.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.copysign - (f64.const -9005.841) - (f64.const -9007.333) + (f32x4.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.min - (f32.const -33.61199951171875) - (f32.const -62.5) + (f32x4.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.max - (f64.const -9005.841) - (f64.const -9007.333) + (f64x2.add + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.eq - (i32.const -10) - (i32.const -11) + (f64x2.sub + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.ne - (f32.const -33.61199951171875) - (f32.const -62.5) + (f64x2.mul + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.lt_s - (i32.const -10) - (i32.const -11) + (f64x2.div + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.lt_u - (i64.const 4294967274) - (i64.const 4294967273) + (f64x2.min + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.le_s - (i64.const 4294967274) - (i64.const 4294967273) + (f64x2.max + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.le_u - (i32.const -10) - (i32.const -11) + (i8x16.extract_lane_s 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.gt_s - (i64.const 4294967274) - (i64.const 4294967273) + (i8x16.extract_lane_u 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.gt_u - (i32.const -10) - (i32.const -11) + (i16x8.extract_lane_s 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i32.ge_s - (i32.const -10) - (i32.const -11) + (i16x8.extract_lane_u 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (i64.ge_u - (i64.const 4294967274) - (i64.const 4294967273) + (i32x4.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.lt - (f32.const -33.61199951171875) - (f32.const -62.5) + (i64x2.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.le - (f64.const -9005.841) - (f64.const -9007.333) + (f32x4.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f64.gt - (f64.const -9005.841) - (f64.const -9007.333) + (f64x2.extract_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (drop - (f32.ge - (f32.const -33.61199951171875) - (f32.const -62.5) + (i16x8.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i8x16.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i32x4.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 42) + ) + ) + (drop + (i64x2.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i64.const 184683593770) + ) + ) + (drop + (f32x4.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f32.const 42) + ) + ) + (drop + (f64x2.replace_lane 1 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (f64.const 42) + ) + ) + (drop + (i8x16.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i8x16.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i16x8.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i32x4.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shl + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_s + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (i64x2.shr_u + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (i32.const 1) + ) + ) + (drop + (v8x16.shuffle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + ) + ) + (drop + (v128.bitselect + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) + (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) ) ) (block From b964f07eec51de2765c801f23ba7e16465a23dd9 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 14:09:40 -0800 Subject: [PATCH 26/36] Remove repeated tests from memory.wast --- test/example/c-api-kitchen-sink.c | 1 - test/spec/memory.wast | 51 ++++++++----------------------- 2 files changed, 13 insertions(+), 39 deletions(-) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index f9b107e3145..2f51e5c4417 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -128,7 +128,6 @@ void test_core() { // Literals and consts - BinaryenExpressionRef constI32 = BinaryenConst(module, BinaryenLiteralInt32(1)), constI64 = BinaryenConst(module, BinaryenLiteralInt64(2)), constF32 = BinaryenConst(module, BinaryenLiteralFloat32(3.14f)), diff --git a/test/spec/memory.wast b/test/spec/memory.wast index 3bb849d03f4..e54888f7c72 100644 --- a/test/spec/memory.wast +++ b/test/spec/memory.wast @@ -92,7 +92,6 @@ (module (memory 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) (module (memory 0) (func (drop (i32.load align=4 (i32.const 0))))) (module (memory 0) (func (drop (f32.load align=4 (i32.const 0))))) -(module (memory 0) (func (drop (v128.load align=16 (i32.const 0))))) (assert_invalid (module (memory 0) (func (drop (i64.load align=0 (i32.const 0))))) @@ -114,6 +113,7 @@ (module (memory 0) (func (drop (i64.load align=7 (i32.const 0))))) "alignment must be a power of two" ) + (assert_invalid (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) "alignment must not be larger than natural" @@ -134,10 +134,6 @@ (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) "alignment must not be larger than natural" ) -(assert_invalid - (module (memory 0) (func (v128.load align=128 (i32.const 0)))) - "alignment must not be larget than natural" -) (assert_invalid (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) "alignment must not be larger than natural" @@ -154,45 +150,32 @@ (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) "alignment must not be larger than natural" ) -(assert_invalid - (module (memory 0) (func (v128.store align=128 (i32.const 0)))) - "alignment must not be larget than natural" -) (module (memory 1) (data (i32.const 0) "ABC\a7D") (data (i32.const 20) "WASM") - (data (i32.const 128) "WASMSIMDGOESFAST") ;; Data section (func (export "data") (result i32) (i32.and (i32.and (i32.and - (i32.and - (i32.eq (i32.load8_u (i32.const 0)) (i32.const 65)) - (i32.eq (i32.load8_u (i32.const 3)) (i32.const 167)) - ) - (i32.and - (i32.eq (i32.load8_u (i32.const 6)) (i32.const 0)) - (i32.eq (i32.load8_u (i32.const 19)) (i32.const 0)) - ) + (i32.eq (i32.load8_u (i32.const 0)) (i32.const 65)) + (i32.eq (i32.load8_u (i32.const 3)) (i32.const 167)) ) (i32.and - (i32.and - (i32.eq (i32.load8_u (i32.const 20)) (i32.const 87)) - (i32.eq (i32.load8_u (i32.const 23)) (i32.const 77)) - ) - (i32.and - (i32.eq (i32.load8_u (i32.const 24)) (i32.const 0)) - (i32.eq (i32.load8_u (i32.const 1023)) (i32.const 0)) - ) + (i32.eq (i32.load8_u (i32.const 6)) (i32.const 0)) + (i32.eq (i32.load8_u (i32.const 19)) (i32.const 0)) ) ) - (i8x16.all_true - (i8x16.eq - (v128.load (i32.const 128)) - (v128.const i32 87 65 83 77 83 73 77 68 71 79 69 83 70 65 83 84) + (i32.and + (i32.and + (i32.eq (i32.load8_u (i32.const 20)) (i32.const 87)) + (i32.eq (i32.load8_u (i32.const 23)) (i32.const 77)) + ) + (i32.and + (i32.eq (i32.load8_u (i32.const 24)) (i32.const 0)) + (i32.eq (i32.load8_u (i32.const 1023)) (i32.const 0)) ) ) ) @@ -302,12 +285,6 @@ (i64.store32 (i32.const 8) (get_local $i)) (i64.load32_u (i32.const 8)) ) - - ;; SIMD loads and stores - (func (export "v128_load") (param $v v128) (result v128) - (v128.store (i32.const 16) (get_local $v)) - (v128.load (i32.const 16)) - ) ) (assert_return (invoke "data") (i32.const 1)) @@ -338,5 +315,3 @@ (assert_return (invoke "i64_load16_u" (i64.const 40000)) (i64.const 40000)) (assert_return (invoke "i64_load32_s" (i64.const 20000)) (i64.const 20000)) (assert_return (invoke "i64_load32_u" (i64.const 40000)) (i64.const 40000)) - -(assert_return (invoke "v128_load" (v128.const i32 1 2 3 4)) (v128.const i32 1 2 3 4)) From 3b18385ab64418ba43ca158b0fd23136c5f5253c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 15:20:12 -0800 Subject: [PATCH 27/36] Add extra curlies to make clang 5.0.0 happy --- src/literal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/literal.h b/src/literal.h index 094fe2a83c9..3b261d9aa48 100644 --- a/src/literal.h +++ b/src/literal.h @@ -65,9 +65,9 @@ class Literal { case Type::f32: return Literal(float(x)); break; case Type::f64: return Literal(double(x)); break; case Type::v128: return Literal( - std::array{ + std::array{{ Literal(x), Literal(int32_t(0)), Literal(int32_t(0)), Literal(int32_t(0)) - } + }} ); case none: case unreachable: WASM_UNREACHABLE(); From 4d88447805de34ccb3bc869bf135e93822717861 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 15:31:44 -0800 Subject: [PATCH 28/36] Explicitly initialize some vars to help gcc out --- src/wasm/wasm-validator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index f05d2ea0377..e1838bb7171 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -571,8 +571,8 @@ void FunctionValidator::visitAtomicWake(AtomicWake* curr) { void FunctionValidator::visitSIMDExtract(SIMDExtract* curr) { shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); shouldBeEqualOrFirstIsUnreachable(curr->vec->type, v128, curr, "extract_lane must operate on a v128"); - Type lane_t; - size_t lanes; + Type lane_t = none; + size_t lanes = 0; switch (curr->op) { case ExtractLaneSVecI8x16: case ExtractLaneUVecI8x16: lane_t = i32; lanes = 16; break; @@ -591,8 +591,8 @@ void FunctionValidator::visitSIMDReplace(SIMDReplace* curr) { shouldBeTrue(info.features.hasSIMD(), curr, "SIMD operation (SIMD is disabled)"); shouldBeEqualOrFirstIsUnreachable(curr->type, v128, curr, "replace_lane must have type v128"); shouldBeEqualOrFirstIsUnreachable(curr->vec->type, v128, curr, "replace_lane must operate on a v128"); - Type lane_t; - size_t lanes; + Type lane_t = none; + size_t lanes = 0; switch (curr->op) { case ReplaceLaneVecI8x16: lane_t = i32; lanes = 16; break; case ReplaceLaneVecI16x8: lane_t = i32; lanes = 8; break; From dc16d00c33049735b936118efc282d1773a8cbd3 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 16:16:02 -0800 Subject: [PATCH 29/36] Remove obsolete sat_add function --- src/wasm/literal.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 755f8837428..c4a1707f0cd 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -510,26 +510,6 @@ Literal Literal::sub(const Literal& other) const { WASM_UNREACHABLE(); } -template -static T sat_add(T a, T b) { - using UT = typename std::make_unsigned::type; - using ST = typename std::make_signed::type; - UT ua = static_cast(a); - UT ub = static_cast(b); - UT ures = ua + ub; - if (std::is_signed::value) { - // overflow if sign of result is different from sign of a and b - if (static_cast((ures ^ ua) & (ures ^ ub)) < 0) { - return (a < 0) - ? std::numeric_limits::min() - : std::numeric_limits::max(); - } - return static_cast(ures); - } else { - return (ures >= ub) ? ures : 0; - } -} - template static T add_sat_s(T a, T b) { static_assert(std::is_signed::value, "Trying to instantiate add_sat_s with unsigned type"); From e9ff225013b590a1cccc03b95c89cef8ed002e11 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 18:02:01 -0800 Subject: [PATCH 30/36] Update js tests --- test/binaryen.js/kitchen-sink.js.txt | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 1a9097cafc9..e64de578d51 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -3213,26 +3213,26 @@ getExpressionInfo={"id":15,"type":3,"op":6} (f32.const -33.61199951171875) ) - expressions[263] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); - BinaryenExpressionGetId(expressions[263]); - BinaryenExpressionGetType(expressions[263]); - BinaryenConstGetValueI32(expressions[263]); + expressions[634] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); + BinaryenExpressionGetId(expressions[634]); + BinaryenExpressionGetType(expressions[634]); + BinaryenConstGetValueI32(expressions[634]); getExpressionInfo(i32.const)={"id":14,"type":1,"value":5} - expressions[264] = BinaryenConst(the_module, BinaryenLiteralInt64(30064771078)); - BinaryenExpressionGetId(expressions[264]); - BinaryenExpressionGetType(expressions[264]); - BinaryenConstGetValueI64Low(expressions[264]); - BinaryenConstGetValueI64High(expressions[264]); + expressions[635] = BinaryenConst(the_module, BinaryenLiteralInt64(30064771078)); + BinaryenExpressionGetId(expressions[635]); + BinaryenExpressionGetType(expressions[635]); + BinaryenConstGetValueI64Low(expressions[635]); + BinaryenConstGetValueI64High(expressions[635]); getExpressionInfo(i64.const)={"id":14,"type":2,"value":{"low":6,"high":7}} - expressions[265] = BinaryenConst(the_module, BinaryenLiteralFloat32(8.5)); - BinaryenExpressionGetId(expressions[265]); - BinaryenExpressionGetType(expressions[265]); - BinaryenConstGetValueF32(expressions[265]); + expressions[636] = BinaryenConst(the_module, BinaryenLiteralFloat32(8.5)); + BinaryenExpressionGetId(expressions[636]); + BinaryenExpressionGetType(expressions[636]); + BinaryenConstGetValueF32(expressions[636]); getExpressionInfo(f32.const)={"id":14,"type":3,"value":8.5} - expressions[266] = BinaryenConst(the_module, BinaryenLiteralFloat64(9.5)); - BinaryenExpressionGetId(expressions[266]); - BinaryenExpressionGetType(expressions[266]); - BinaryenConstGetValueF64(expressions[266]); + expressions[637] = BinaryenConst(the_module, BinaryenLiteralFloat64(9.5)); + BinaryenExpressionGetId(expressions[637]); + BinaryenExpressionGetType(expressions[637]); + BinaryenConstGetValueF64(expressions[637]); getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} { BinaryenExpressionRef children[] = { expressions[24], expressions[26], expressions[28], expressions[30], expressions[32], From c8de9e0c932b9573d03fb809a9818c4198a5c20c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 18:39:38 -0800 Subject: [PATCH 31/36] address first batch of comments --- src/dataflow/graph.h | 2 +- src/ir/literal-utils.h | 2 +- src/literal.h | 32 ++++++++++++++++++-------- src/passes/OptimizeInstructions.cpp | 8 +++---- src/passes/Precompute.cpp | 2 +- src/passes/RedundantSetElimination.cpp | 3 +-- src/tools/fuzzing.h | 6 ++--- src/tools/wasm-ctor-eval.cpp | 4 ++-- src/tools/wasm-reduce.cpp | 2 +- src/wasm/literal.cpp | 16 ++++++------- src/wasm/wasm-binary.cpp | 6 ++--- src/wasm/wasm-s-parser.cpp | 10 ++++---- 12 files changed, 52 insertions(+), 41 deletions(-) diff --git a/src/dataflow/graph.h b/src/dataflow/graph.h index 29de8cf4f8f..9a30b7576f5 100644 --- a/src/dataflow/graph.h +++ b/src/dataflow/graph.h @@ -153,7 +153,7 @@ struct Graph : public UnifiedExpressionVisitor { } Node* makeZero(wasm::Type type) { - return makeConst(Literal::makeLiteralZero(type)); + return makeConst(Literal::makeZero(type)); } // Add a new node to our list of owned nodes. diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h index 32a28a4cb54..543c34e9f13 100644 --- a/src/ir/literal-utils.h +++ b/src/ir/literal-utils.h @@ -25,7 +25,7 @@ namespace LiteralUtils { inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) { auto* ret = wasm.allocator.alloc(); - ret->value = Literal::makeLiteralFromInt32(x, type); + ret->value = Literal::makeFromInt32(x, type); ret->type = type; return ret; } diff --git a/src/literal.h b/src/literal.h index 3b261d9aa48..ee52275c36c 100644 --- a/src/literal.h +++ b/src/literal.h @@ -49,7 +49,9 @@ class Literal { explicit Literal(uint64_t init) : type(Type::i64), i64(init) {} explicit Literal(float init) : type(Type::f32), i32(bit_cast(init)) {} explicit Literal(double init) : type(Type::f64), i64(bit_cast(init)) {} + // v128 literal from bytes explicit Literal(const uint8_t init[16]); + // v128 literal from lane value literals explicit Literal(const std::array&); explicit Literal(const std::array&); explicit Literal(const std::array&); @@ -58,7 +60,7 @@ class Literal { bool isConcrete() { return type != none; } bool isNull() { return type == none; } - inline static Literal makeLiteralFromInt32(int32_t x, Type type) { + inline static Literal makeFromInt32(int32_t x, Type type) { switch (type) { case Type::i32: return Literal(int32_t(x)); break; case Type::i64: return Literal(int64_t(x)); break; @@ -75,8 +77,8 @@ class Literal { WASM_UNREACHABLE(); } - inline static Literal makeLiteralZero(Type type) { - return makeLiteralFromInt32(0, type); + inline static Literal makeZero(Type type) { + return makeFromInt32(0, type); } Literal castToF32(); @@ -90,8 +92,8 @@ class Literal { double getf64() const { assert(type == Type::f64); return bit_cast(i64); } std::array getv128() const; - - int32_t* geti32Ptr() { assert(type == Type::i32); return &i32; } // careful! + // careful! + int32_t* geti32Ptr() { assert(type == Type::i32); return &i32; } uint8_t* getv128Ptr() { assert(type == Type::v128); return v128; } const uint8_t* getv128Ptr() const { assert(type == Type::v128); return v128; } @@ -102,7 +104,7 @@ class Literal { int64_t getInteger() const; double getFloat() const; - void getBits(uint8_t (&buf)[16]) const; + void getBits(void* buf) const; // Equality checks for the type and the bits, so a nan float would // be compared bitwise (which means that a Literal containing a nan // would be equal to itself, if the bits are equal). @@ -373,10 +375,20 @@ template<> struct less { if (a.type < b.type) return true; if (a.type > b.type) return false; switch (a.type) { - case wasm::Type::i32: return a.geti32() < b.geti32(); - case wasm::Type::f32: return a.getf32() < b.getf32(); - case wasm::Type::i64: return a.geti64() < b.geti64(); - case wasm::Type::f64: return b.getf64() < b.getf64(); + case wasm::Type::i32: + case wasm::Type::f32: { + int32_t ai, bi; + a.getBits(&ai); + b.getBits(&bi); + return ai < bi; + } + case wasm::Type::i64: + case wasm::Type::f64: { + int64_t ai, bi; + a.getBits(&ai); + b.getBits(&bi); + return ai < bi; + } case wasm::Type::v128: { return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0; } diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 21c9d1684ca..4c4adc623c9 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -461,7 +461,7 @@ struct OptimizeInstructions : public WalkerPasstype)) { // no overflow, we can do this - leftRight->value = Literal::makeLiteralFromInt32(total, right->type); + leftRight->value = Literal::makeFromInt32(total, right->type); return left; } // TODO: handle overflows } @@ -1096,7 +1096,7 @@ struct OptimizeInstructions : public WalkerPassright->cast(); if (isIntegerType(type)) { // operations on zero - if (right->value == Literal::makeLiteralFromInt32(0, type)) { + if (right->value == Literal::makeFromInt32(0, type)) { if (binary->op == Abstract::getBinary(type, Abstract::Shl) || binary->op == Abstract::getBinary(type, Abstract::ShrU) || binary->op == Abstract::getBinary(type, Abstract::ShrS) || @@ -1152,7 +1152,7 @@ struct OptimizeInstructions : public WalkerPassvalue == Literal::makeLiteralFromInt32(1, type)) { + if (right->value == Literal::makeFromInt32(1, type)) { if (binary->op == Abstract::getBinary(type, Abstract::Mul) || binary->op == Abstract::getBinary(type, Abstract::DivS) || binary->op == Abstract::getBinary(type, Abstract::DivU)) { @@ -1171,7 +1171,7 @@ struct OptimizeInstructions : public WalkerPassleft->cast(); if (isIntegerType(type)) { // operations on zero - if (left->value == Literal::makeLiteralFromInt32(0, type)) { + if (left->value == Literal::makeFromInt32(0, type)) { if ((binary->op == Abstract::getBinary(type, Abstract::Shl) || binary->op == Abstract::getBinary(type, Abstract::ShrU) || binary->op == Abstract::getBinary(type, Abstract::ShrS)) && diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index ff1eb0ab5fc..9fb7ab31ceb 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -297,7 +297,7 @@ struct Precompute : public WalkerPassisVar(get->index)) { - curr = Literal::makeLiteralZero(getFunction()->getLocalType(get->index)); + curr = Literal::makeZero(getFunction()->getLocalType(get->index)); } else { // it's a param, so it's hopeless value = Literal(); diff --git a/src/passes/RedundantSetElimination.cpp b/src/passes/RedundantSetElimination.cpp index 6b4a2f5dafe..8cd8fbf9921 100644 --- a/src/passes/RedundantSetElimination.cpp +++ b/src/passes/RedundantSetElimination.cpp @@ -172,7 +172,7 @@ struct RedundantSetElimination : public WalkerPassgetLocalType(i))); + start[i] = getLiteralValue(Literal::makeZero(func->getLocalType(i))); } } } else { @@ -375,4 +375,3 @@ Pass *createRedundantSetEliminationPass() { } } // namespace wasm - diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 9bffed47216..9e2c8a85a74 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -1268,10 +1268,10 @@ class TranslateToFuzzReader { } // tweak around special values if (oneIn(3)) { // +- 1 - value = value.add(Literal::makeLiteralFromInt32(upTo(3) - 1, type)); + value = value.add(Literal::makeFromInt32(upTo(3) - 1, type)); } if (oneIn(2)) { // flip sign - value = value.mul(Literal::makeLiteralFromInt32(-1, type)); + value = value.mul(Literal::makeFromInt32(-1, type)); } break; } @@ -1288,7 +1288,7 @@ class TranslateToFuzzReader { } // maybe negative if (oneIn(2)) { - value = value.mul(Literal::makeLiteralFromInt32(-1, type)); + value = value.mul(Literal::makeFromInt32(-1, type)); } } } diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 950f3733858..4a7ca51b775 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -195,12 +195,12 @@ struct CtorEvalExternalInterface : EvallingModuleInstance::ExternalInterface { // fill in fake values for everything else, which is dangerous to use ModuleUtils::iterDefinedGlobals(wasm_, [&](Global* defined) { if (globals.find(defined->name) == globals.end()) { - globals[defined->name] = Literal::makeLiteralZero(defined->type); + globals[defined->name] = Literal::makeZero(defined->type); } }); ModuleUtils::iterImportedGlobals(wasm_, [&](Global* import) { if (globals.find(import->name) == globals.end()) { - globals[import->name] = Literal::makeLiteralZero(import->type); + globals[import->name] = Literal::makeZero(import->type); } }); } diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 65930ce31a7..02174bb8a93 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -839,7 +839,7 @@ struct Reducer : public WalkerPassmakeConst(Literal(int32_t(0))); if (tryToReplaceCurrent(c)) return true; - c->value = Literal::makeLiteralFromInt32(1, curr->type); + c->value = Literal::makeFromInt32(1, curr->type); c->type = curr->type; return tryToReplaceCurrent(c); } diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index c4a1707f0cd..f5f687b5975 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -36,7 +36,7 @@ Literal::Literal(const uint8_t init[16]) : type(Type::v128) { } template -static void extract_bytes(uint8_t (&dest)[16], const LaneArray& lanes) { +static void extractBytes(uint8_t (&dest)[16], const LaneArray& lanes) { std::array bytes; const size_t lane_width = 16 / Lanes; for (size_t lane_idx = 0; lane_idx < Lanes; ++lane_idx) { @@ -52,19 +52,19 @@ static void extract_bytes(uint8_t (&dest)[16], const LaneArray& lanes) { } Literal::Literal(const LaneArray<16>& lanes) : type(Type::v128) { - extract_bytes(v128, lanes); + extractBytes(v128, lanes); } Literal::Literal(const LaneArray<8>& lanes) : type(Type::v128) { - extract_bytes(v128, lanes); + extractBytes(v128, lanes); } Literal::Literal(const LaneArray<4>& lanes) : type(Type::v128) { - extract_bytes(v128, lanes); + extractBytes(v128, lanes); } Literal::Literal(const LaneArray<2>& lanes) : type(Type::v128) { - extract_bytes(v128, lanes); + extractBytes(v128, lanes); } std::array Literal::getv128() const { @@ -118,7 +118,7 @@ double Literal::getFloat() const { } } -void Literal::getBits(uint8_t (&buf)[16]) const { +void Literal::getBits(void* buf) const { switch (type) { case Type::i32: case Type::f32: memcpy(buf, &i32, sizeof(i32)); break; @@ -1100,7 +1100,7 @@ template (Literal::*IntoLanes)() const> static Literal any_true(const Literal& val) { LaneArray lanes = (val.*IntoLanes)(); for (size_t i = 0; i < Lanes; ++i) { - if (lanes[i] != Literal::makeLiteralZero(lanes[i].type)) { + if (lanes[i] != Literal::makeZero(lanes[i].type)) { return Literal(int32_t(1)); } } @@ -1111,7 +1111,7 @@ template (Literal::*IntoLanes)() const> static Literal all_true(const Literal& val) { LaneArray lanes = (val.*IntoLanes)(); for (size_t i = 0; i < Lanes; ++i) { - if (lanes[i] == Literal::makeLiteralZero(lanes[i].type)) { + if (lanes[i] == Literal::makeZero(lanes[i].type)) { return Literal(int32_t(0)); } } diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index f51a85cc1b8..414264ed6b6 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1716,13 +1716,13 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) { break; } case BinaryConsts::TruncSatPrefix: { - uint32_t code = getU32LEB(); - if (maybeVisitTruncSat(curr, code)) break; + auto opcode = getU32LEB(); + if (maybeVisitTruncSat(curr, opcode)) break; throwError("invalid code after nontrapping float-to-int prefix: " + std::to_string(code)); break; } case BinaryConsts::SIMDPrefix: { - uint32_t opcode = getU32LEB(); + auto opcode = getU32LEB(); if (maybeVisitSIMDBinary(curr, opcode)) break; if (maybeVisitSIMDUnary(curr, opcode)) break; if (maybeVisitSIMDConst(curr, opcode)) break; diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 683711b8f87..ac60cb20808 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -872,11 +872,11 @@ Expression* SExpressionWasmBuilder::makeConst(Element& s, Type type) { auto ret = allocator.alloc(); auto getLiteral = [](Expression* expr) { - if (expr == nullptr) { - throw ParseException("Could not parse v128 lane"); - } - return expr->cast()->value; - }; + if (expr == nullptr) { + throw ParseException("Could not parse v128 lane"); + } + return expr->cast()->value; + }; Type lane_t = stringToType(s[1]->str()); size_t lanes = s.size() - 2; switch (lanes) { From 69904cd833dd0cdeceb62e9a4a7159131d835da3 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 12 Dec 2018 20:07:13 -0800 Subject: [PATCH 32/36] Argument evaluation order is unspecified. obviously. --- test/example/c-api-kitchen-sink.c | 3 +- test/example/c-api-kitchen-sink.txt | 78 ++++++++++++++--------------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 2f51e5c4417..caca8e28cd1 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -104,7 +104,8 @@ BinaryenExpressionRef makeSIMDReplace(BinaryenModuleRef module, BinaryenOp op, B } BinaryenExpressionRef makeSIMDShift(BinaryenModuleRef module, BinaryenOp op) { - return BinaryenSIMDShift(module, op, makeVec128(module, v128_bytes), makeInt32(module, 1)); + BinaryenExpressionRef vec = makeVec128(module, v128_bytes); + return BinaryenSIMDShift(module, op, vec, makeInt32(module, 1)); } // tests diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 4132e5228b7..281512986ec 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -3024,84 +3024,84 @@ int main() { expressions[544] = BinaryenConst(the_module, BinaryenLiteralVec128(t193)); } expressions[545] = BinaryenSIMDReplace(the_module, 5, expressions[544], 0, expressions[543]); - expressions[546] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { uint8_t t194[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[547] = BinaryenConst(the_module, BinaryenLiteralVec128(t194)); + expressions[546] = BinaryenConst(the_module, BinaryenLiteralVec128(t194)); } - expressions[548] = BinaryenSIMDShift(the_module, 0, expressions[547], expressions[546]); - expressions[549] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[547] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[548] = BinaryenSIMDShift(the_module, 0, expressions[546], expressions[547]); { uint8_t t195[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[550] = BinaryenConst(the_module, BinaryenLiteralVec128(t195)); + expressions[549] = BinaryenConst(the_module, BinaryenLiteralVec128(t195)); } - expressions[551] = BinaryenSIMDShift(the_module, 1, expressions[550], expressions[549]); - expressions[552] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[550] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[551] = BinaryenSIMDShift(the_module, 1, expressions[549], expressions[550]); { uint8_t t196[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[553] = BinaryenConst(the_module, BinaryenLiteralVec128(t196)); + expressions[552] = BinaryenConst(the_module, BinaryenLiteralVec128(t196)); } - expressions[554] = BinaryenSIMDShift(the_module, 2, expressions[553], expressions[552]); - expressions[555] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[553] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[554] = BinaryenSIMDShift(the_module, 2, expressions[552], expressions[553]); { uint8_t t197[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[556] = BinaryenConst(the_module, BinaryenLiteralVec128(t197)); + expressions[555] = BinaryenConst(the_module, BinaryenLiteralVec128(t197)); } - expressions[557] = BinaryenSIMDShift(the_module, 3, expressions[556], expressions[555]); - expressions[558] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[556] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[557] = BinaryenSIMDShift(the_module, 3, expressions[555], expressions[556]); { uint8_t t198[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[559] = BinaryenConst(the_module, BinaryenLiteralVec128(t198)); + expressions[558] = BinaryenConst(the_module, BinaryenLiteralVec128(t198)); } - expressions[560] = BinaryenSIMDShift(the_module, 4, expressions[559], expressions[558]); - expressions[561] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[559] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[560] = BinaryenSIMDShift(the_module, 4, expressions[558], expressions[559]); { uint8_t t199[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[562] = BinaryenConst(the_module, BinaryenLiteralVec128(t199)); + expressions[561] = BinaryenConst(the_module, BinaryenLiteralVec128(t199)); } - expressions[563] = BinaryenSIMDShift(the_module, 5, expressions[562], expressions[561]); - expressions[564] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[562] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[563] = BinaryenSIMDShift(the_module, 5, expressions[561], expressions[562]); { uint8_t t200[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[565] = BinaryenConst(the_module, BinaryenLiteralVec128(t200)); + expressions[564] = BinaryenConst(the_module, BinaryenLiteralVec128(t200)); } - expressions[566] = BinaryenSIMDShift(the_module, 128, expressions[565], expressions[564]); - expressions[567] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[565] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[566] = BinaryenSIMDShift(the_module, 128, expressions[564], expressions[565]); { uint8_t t201[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[568] = BinaryenConst(the_module, BinaryenLiteralVec128(t201)); + expressions[567] = BinaryenConst(the_module, BinaryenLiteralVec128(t201)); } - expressions[569] = BinaryenSIMDShift(the_module, 6, expressions[568], expressions[567]); - expressions[570] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[568] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[569] = BinaryenSIMDShift(the_module, 6, expressions[567], expressions[568]); { uint8_t t202[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[571] = BinaryenConst(the_module, BinaryenLiteralVec128(t202)); + expressions[570] = BinaryenConst(the_module, BinaryenLiteralVec128(t202)); } - expressions[572] = BinaryenSIMDShift(the_module, 7, expressions[571], expressions[570]); - expressions[573] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[571] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[572] = BinaryenSIMDShift(the_module, 7, expressions[570], expressions[571]); { uint8_t t203[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[574] = BinaryenConst(the_module, BinaryenLiteralVec128(t203)); + expressions[573] = BinaryenConst(the_module, BinaryenLiteralVec128(t203)); } - expressions[575] = BinaryenSIMDShift(the_module, 8, expressions[574], expressions[573]); - expressions[576] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[574] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[575] = BinaryenSIMDShift(the_module, 8, expressions[573], expressions[574]); { uint8_t t204[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[577] = BinaryenConst(the_module, BinaryenLiteralVec128(t204)); + expressions[576] = BinaryenConst(the_module, BinaryenLiteralVec128(t204)); } - expressions[578] = BinaryenSIMDShift(the_module, 9, expressions[577], expressions[576]); - expressions[579] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[577] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[578] = BinaryenSIMDShift(the_module, 9, expressions[576], expressions[577]); { uint8_t t205[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[580] = BinaryenConst(the_module, BinaryenLiteralVec128(t205)); + expressions[579] = BinaryenConst(the_module, BinaryenLiteralVec128(t205)); } - expressions[581] = BinaryenSIMDShift(the_module, 10, expressions[580], expressions[579]); - expressions[582] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[580] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[581] = BinaryenSIMDShift(the_module, 10, expressions[579], expressions[580]); { uint8_t t206[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[583] = BinaryenConst(the_module, BinaryenLiteralVec128(t206)); + expressions[582] = BinaryenConst(the_module, BinaryenLiteralVec128(t206)); } - expressions[584] = BinaryenSIMDShift(the_module, 11, expressions[583], expressions[582]); + expressions[583] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[584] = BinaryenSIMDShift(the_module, 11, expressions[582], expressions[583]); { uint8_t t207[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[585] = BinaryenConst(the_module, BinaryenLiteralVec128(t207)); From 78baf2912f9fa094d6b9a6d0283eab8ce3fa902f Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 13 Dec 2018 11:50:51 -0800 Subject: [PATCH 33/36] More arg evaluation order fixes --- test/example/c-api-kitchen-sink.c | 17 +++++++++++++++-- test/example/c-api-kitchen-sink.txt | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index caca8e28cd1..8b395cba2c6 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -103,6 +103,19 @@ BinaryenExpressionRef makeSIMDReplace(BinaryenModuleRef module, BinaryenOp op, B return BinaryenSIMDReplace(module, op, makeVec128(module, v128_bytes), 0, val); } +BinaryenExpressionRef makeSIMDShuffle(BinaryenModuleRef module) { + BinaryenExpressionRef left = makeVec128(module, v128_bytes); + BinaryenExpressionRef right = makeVec128(module, v128_bytes); + return BinaryenSIMDShuffle(module, left, right, (uint8_t[16]) {}); +} + +BinaryenExpressionRef makeSIMDBitselect(BinaryenModuleRef module) { + BinaryenExpressionRef left = makeVec128(module, v128_bytes); + BinaryenExpressionRef right = makeVec128(module, v128_bytes); + BinaryenExpressionRef cond = makeVec128(module, v128_bytes); + return BinaryenSIMDBitselect(module, left, right, cond); +} + BinaryenExpressionRef makeSIMDShift(BinaryenModuleRef module, BinaryenOp op) { BinaryenExpressionRef vec = makeVec128(module, v128_bytes); return BinaryenSIMDShift(module, op, vec, makeInt32(module, 1)); @@ -373,8 +386,8 @@ void test_core() { makeSIMDShift(module, BinaryenShrSVecI64x2()), makeSIMDShift(module, BinaryenShrUVecI64x2()), // Other SIMD - BinaryenSIMDShuffle(module, makeVec128(module, v128_bytes), makeVec128(module, v128_bytes), (uint8_t[16]) {}), - BinaryenSIMDBitselect(module, makeVec128(module, v128_bytes), makeVec128(module, v128_bytes), makeVec128(module, v128_bytes)), + makeSIMDShuffle(module), + makeSIMDBitselect(module), // All the rest BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type BinaryenIf(module, temp1, temp2, temp3), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 281512986ec..d1e25633ad4 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -3112,7 +3112,7 @@ int main() { } { uint8_t mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - expressions[587] = BinaryenSIMDShuffle(the_module, expressions[586], expressions[585], mask); + expressions[587] = BinaryenSIMDShuffle(the_module, expressions[585], expressions[586], mask); } { uint8_t t209[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; @@ -3126,7 +3126,7 @@ int main() { uint8_t t211[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[590] = BinaryenConst(the_module, BinaryenLiteralVec128(t211)); } - expressions[591] = BinaryenSIMDBitselect(the_module, expressions[590], expressions[589], expressions[588]); + expressions[591] = BinaryenSIMDBitselect(the_module, expressions[588], expressions[589], expressions[590]); { BinaryenExpressionRef children[] = { 0 }; expressions[592] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto()); From 9e541b83cd8da824636e63fd637eac2c20504432 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 13 Dec 2018 13:08:00 -0800 Subject: [PATCH 34/36] Add SIMD feature options and make SafeHeap feature-aware --- src/passes/SafeHeap.cpp | 6 +- src/tools/feature-options.h | 15 +- test/passes/safe-heap_disable-simd.txt | 2148 +++++++++++++++++++++++ test/passes/safe-heap_disable-simd.wast | 1 + 4 files changed, 2167 insertions(+), 3 deletions(-) create mode 100644 test/passes/safe-heap_disable-simd.txt create mode 100644 test/passes/safe-heap_disable-simd.wast diff --git a/src/passes/SafeHeap.cpp b/src/passes/SafeHeap.cpp index f42f4c3c045..f170041e10c 100644 --- a/src/passes/SafeHeap.cpp +++ b/src/passes/SafeHeap.cpp @@ -109,7 +109,7 @@ struct SafeHeap : public Pass { instrumenter.add(); instrumenter.run(); // add helper checking funcs and imports - addGlobals(module); + addGlobals(module, runner->options.features); } Name dynamicTopPtr, segfault, alignfault; @@ -156,10 +156,11 @@ struct SafeHeap : public Pass { return align == bytes && shared && isIntegerType(type); } - void addGlobals(Module* module) { + void addGlobals(Module* module, FeatureSet features) { // load funcs Load load; for (auto type : { i32, i64, f32, f64, v128 }) { + if (type == v128 && !features.hasSIMD()) continue; load.type = type; for (Index bytes : { 1, 2, 4, 8, 16 }) { load.bytes = bytes; @@ -188,6 +189,7 @@ struct SafeHeap : public Pass { // store funcs Store store; for (auto valueType : { i32, i64, f32, f64, v128 }) { + if (valueType == v128 && !features.hasSIMD()) continue; store.valueType = valueType; store.type = none; for (Index bytes : { 1, 2, 4, 8, 16 }) { diff --git a/src/tools/feature-options.h b/src/tools/feature-options.h index 3b35656fc1c..1bd78d9b903 100644 --- a/src/tools/feature-options.h +++ b/src/tools/feature-options.h @@ -70,7 +70,20 @@ struct FeatureOptions : public Options { Options::Arguments::Zero, [this](Options *o, const std::string& arguments) { passOptions.features.setTruncSat(false); - }); + }) + .add("--enable-simd", "", + "Enable nontrapping float-to-int operations", + Options::Arguments::Zero, + [this](Options *o, const std::string& arguments) { + passOptions.features.setSIMD(); + }) + .add("--disable-simd", "", + "Disable nontrapping float-to-int operations", + Options::Arguments::Zero, + [this](Options *o, const std::string& arguments) { + passOptions.features.setSIMD(false); + }) + ; } FeatureSet getFeatures() const { diff --git a/test/passes/safe-heap_disable-simd.txt b/test/passes/safe-heap_disable-simd.txt new file mode 100644 index 00000000000..cf6fdc42c67 --- /dev/null +++ b/test/passes/safe-heap_disable-simd.txt @@ -0,0 +1,2148 @@ +(module + (type $FUNCSIG$v (func)) + (import "env" "DYNAMICTOP_PTR" (global $DYNAMICTOP_PTR i32)) + (import "env" "segfault" (func $segfault)) + (import "env" "alignfault" (func $alignfault)) + (func $SAFE_HEAP_LOAD_i32_1_1 (; 2 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 1) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.load8_s + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_1_U_1 (; 3 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 1) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.load8_u + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_2_1 (; 4 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.load16_s align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_2_2 (; 5 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i32.load16_s + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_2_U_1 (; 6 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.load16_u align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_2_U_2 (; 7 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i32.load16_u + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_4_1 (; 8 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.load align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_4_2 (; 9 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i32.load align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_4_4 (; 10 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (i32.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_4_U_1 (; 11 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.load align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_4_U_2 (; 12 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i32.load align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i32_4_U_4 (; 13 ;) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (i32.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_1_1 (; 14 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 1) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load8_s + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_1_U_1 (; 15 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 1) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load8_u + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_2_1 (; 16 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load16_s align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_2_2 (; 17 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.load16_s + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_2_U_1 (; 18 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load16_u align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_2_U_2 (; 19 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.load16_u + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_4_1 (; 20 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load32_s align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_4_2 (; 21 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.load32_s align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_4_4 (; 22 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (i64.load32_s + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_4_U_1 (; 23 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load32_u align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_4_U_2 (; 24 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.load32_u align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_4_U_4 (; 25 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (i64.load32_u + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_1 (; 26 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_2 (; 27 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.load align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_4 (; 28 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (i64.load align=4 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_8 (; 29 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 7) + ) + (call $alignfault) + ) + (i64.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_U_1 (; 30 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.load align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_U_2 (; 31 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.load align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_U_4 (; 32 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (i64.load align=4 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_i64_8_U_8 (; 33 ;) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 7) + ) + (call $alignfault) + ) + (i64.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f32_4_1 (; 34 ;) (param $0 i32) (param $1 i32) (result f32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (f32.load align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f32_4_2 (; 35 ;) (param $0 i32) (param $1 i32) (result f32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.load align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f32_4_4 (; 36 ;) (param $0 i32) (param $1 i32) (result f32) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (f32.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f64_8_1 (; 37 ;) (param $0 i32) (param $1 i32) (result f64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (f64.load align=1 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f64_8_2 (; 38 ;) (param $0 i32) (param $1 i32) (result f64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (call $alignfault) + ) + (f64.load align=2 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f64_8_4 (; 39 ;) (param $0 i32) (param $1 i32) (result f64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 3) + ) + (call $alignfault) + ) + (f64.load align=4 + (get_local $2) + ) + ) + (func $SAFE_HEAP_LOAD_f64_8_8 (; 40 ;) (param $0 i32) (param $1 i32) (result f64) + (local $2 i32) + (set_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $2) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $2) + (i32.const 7) + ) + (call $alignfault) + ) + (f64.load + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_1_1 (; 41 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 1) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.store8 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_2_1 (; 42 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.store16 align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_2_2 (; 43 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (i32.store16 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_4_1 (; 44 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i32.store align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_4_2 (; 45 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (i32.store align=2 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i32_4_4 (; 46 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (i32.store + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_1_1 (; 47 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 1) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.store8 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_2_1 (; 48 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.store16 align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_2_2 (; 49 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 2) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.store16 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_4_1 (; 50 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.store32 align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_4_2 (; 51 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.store32 align=2 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_4_4 (; 52 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (i64.store32 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_8_1 (; 53 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (i64.store align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_8_2 (; 54 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (i64.store align=2 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_8_4 (; 55 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (i64.store align=4 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_i64_8_8 (; 56 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 7) + ) + (call $alignfault) + ) + (i64.store + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f32_4_1 (; 57 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (f32.store align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f32_4_2 (; 58 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (f32.store align=2 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f32_4_4 (; 59 ;) (param $0 i32) (param $1 i32) (param $2 f32) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 4) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (f32.store + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f64_8_1 (; 60 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (f64.store align=1 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f64_8_2 (; 61 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 1) + ) + (call $alignfault) + ) + (f64.store align=2 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f64_8_4 (; 62 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 3) + ) + (call $alignfault) + ) + (f64.store align=4 + (get_local $3) + (get_local $2) + ) + ) + (func $SAFE_HEAP_STORE_f64_8_8 (; 63 ;) (param $0 i32) (param $1 i32) (param $2 f64) + (local $3 i32) + (set_local $3 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (if + (i32.or + (i32.eq + (get_local $3) + (i32.const 0) + ) + (i32.gt_u + (i32.add + (get_local $3) + (i32.const 8) + ) + (i32.load + (get_global $DYNAMICTOP_PTR) + ) + ) + ) + (call $segfault) + ) + (if + (i32.and + (get_local $3) + (i32.const 7) + ) + (call $alignfault) + ) + (f64.store + (get_local $3) + (get_local $2) + ) + ) +) diff --git a/test/passes/safe-heap_disable-simd.wast b/test/passes/safe-heap_disable-simd.wast new file mode 100644 index 00000000000..3af8f254547 --- /dev/null +++ b/test/passes/safe-heap_disable-simd.wast @@ -0,0 +1 @@ +(module) From 44e19ad17c0ced08d2710e2dbfa18df4184eb4db Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 13 Dec 2018 13:38:01 -0800 Subject: [PATCH 35/36] make parameter to `getBits` a reference to array of bytes --- src/literal.h | 26 +++++++------------------- src/wasm/literal.cpp | 5 +++-- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/literal.h b/src/literal.h index ee52275c36c..dd568826323 100644 --- a/src/literal.h +++ b/src/literal.h @@ -104,7 +104,7 @@ class Literal { int64_t getInteger() const; double getFloat() const; - void getBits(void* buf) const; + void getBits(uint8_t (&buf)[16]) const; // Equality checks for the type and the bits, so a nan float would // be compared bitwise (which means that a Literal containing a nan // would be equal to itself, if the bits are equal). @@ -357,7 +357,7 @@ class Literal { namespace std { template<> struct hash { size_t operator()(const wasm::Literal& a) const { - uint8_t bytes[16] = {}; + uint8_t bytes[16]; a.getBits(bytes); int64_t chunks[2]; memcpy(chunks, bytes, sizeof(chunks)); @@ -375,23 +375,11 @@ template<> struct less { if (a.type < b.type) return true; if (a.type > b.type) return false; switch (a.type) { - case wasm::Type::i32: - case wasm::Type::f32: { - int32_t ai, bi; - a.getBits(&ai); - b.getBits(&bi); - return ai < bi; - } - case wasm::Type::i64: - case wasm::Type::f64: { - int64_t ai, bi; - a.getBits(&ai); - b.getBits(&bi); - return ai < bi; - } - case wasm::Type::v128: { - return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0; - } + case wasm::Type::i32: return a.geti32() < b.geti32(); + case wasm::Type::f32: return a.reinterpreti32() < b.reinterpreti32(); + case wasm::Type::i64: return a.geti64() < b.geti64(); + case wasm::Type::f64: return a.reinterpreti64() < b.reinterpreti64(); + case wasm::Type::v128: return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0; case wasm::Type::none: case wasm::Type::unreachable: return false; } diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index f5f687b5975..8d44b9b73fb 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -118,7 +118,8 @@ double Literal::getFloat() const { } } -void Literal::getBits(void* buf) const { +void Literal::getBits(uint8_t (&buf)[16]) const { + memset(buf, 0, 16); switch (type) { case Type::i32: case Type::f32: memcpy(buf, &i32, sizeof(i32)); break; @@ -133,7 +134,7 @@ void Literal::getBits(void* buf) const { bool Literal::operator==(const Literal& other) const { if (type != other.type) return false; if (type == none) return true; - uint8_t bits[16] = {}, other_bits[16] = {}; + uint8_t bits[16], other_bits[16]; getBits(bits); other.getBits(other_bits); return memcmp(bits, other_bits, 16) == 0; From dc893cbfc7a43a927c765180aa48e0cb8839e0af Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 13 Dec 2018 16:26:20 -0800 Subject: [PATCH 36/36] Remove extraneous "shift" operation --- test/example/c-api-kitchen-sink.c | 1 - test/example/c-api-kitchen-sink.txt | 186 +++++++++++------------- test/example/c-api-kitchen-sink.txt.txt | 6 - 3 files changed, 84 insertions(+), 109 deletions(-) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 8b395cba2c6..cf2ce6c04c0 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -378,7 +378,6 @@ void test_core() { makeSIMDShift(module, BinaryenShlVecI16x8()), makeSIMDShift(module, BinaryenShrSVecI16x8()), makeSIMDShift(module, BinaryenShrUVecI16x8()), - makeSIMDShift(module, BinaryenAddVecI16x8()), makeSIMDShift(module, BinaryenShlVecI32x4()), makeSIMDShift(module, BinaryenShrSVecI32x4()), makeSIMDShift(module, BinaryenShrUVecI32x4()), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index d1e25633ad4..8b716f1b37a 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1175,12 +1175,6 @@ BinaryenTypeAuto: -1 (i32.const 1) ) ) - (drop - ( - (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) - (i32.const 1) - ) - ) (drop (i32x4.shl (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) @@ -3065,132 +3059,126 @@ int main() { expressions[564] = BinaryenConst(the_module, BinaryenLiteralVec128(t200)); } expressions[565] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[566] = BinaryenSIMDShift(the_module, 128, expressions[564], expressions[565]); + expressions[566] = BinaryenSIMDShift(the_module, 6, expressions[564], expressions[565]); { uint8_t t201[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[567] = BinaryenConst(the_module, BinaryenLiteralVec128(t201)); } expressions[568] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[569] = BinaryenSIMDShift(the_module, 6, expressions[567], expressions[568]); + expressions[569] = BinaryenSIMDShift(the_module, 7, expressions[567], expressions[568]); { uint8_t t202[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[570] = BinaryenConst(the_module, BinaryenLiteralVec128(t202)); } expressions[571] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[572] = BinaryenSIMDShift(the_module, 7, expressions[570], expressions[571]); + expressions[572] = BinaryenSIMDShift(the_module, 8, expressions[570], expressions[571]); { uint8_t t203[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[573] = BinaryenConst(the_module, BinaryenLiteralVec128(t203)); } expressions[574] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[575] = BinaryenSIMDShift(the_module, 8, expressions[573], expressions[574]); + expressions[575] = BinaryenSIMDShift(the_module, 9, expressions[573], expressions[574]); { uint8_t t204[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[576] = BinaryenConst(the_module, BinaryenLiteralVec128(t204)); } expressions[577] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[578] = BinaryenSIMDShift(the_module, 9, expressions[576], expressions[577]); + expressions[578] = BinaryenSIMDShift(the_module, 10, expressions[576], expressions[577]); { uint8_t t205[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[579] = BinaryenConst(the_module, BinaryenLiteralVec128(t205)); } expressions[580] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[581] = BinaryenSIMDShift(the_module, 10, expressions[579], expressions[580]); + expressions[581] = BinaryenSIMDShift(the_module, 11, expressions[579], expressions[580]); { uint8_t t206[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; expressions[582] = BinaryenConst(the_module, BinaryenLiteralVec128(t206)); } - expressions[583] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[584] = BinaryenSIMDShift(the_module, 11, expressions[582], expressions[583]); { uint8_t t207[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[585] = BinaryenConst(the_module, BinaryenLiteralVec128(t207)); + expressions[583] = BinaryenConst(the_module, BinaryenLiteralVec128(t207)); } { - uint8_t t208[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[586] = BinaryenConst(the_module, BinaryenLiteralVec128(t208)); + uint8_t mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + expressions[584] = BinaryenSIMDShuffle(the_module, expressions[582], expressions[583], mask); } { - uint8_t mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - expressions[587] = BinaryenSIMDShuffle(the_module, expressions[585], expressions[586], mask); + uint8_t t208[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + expressions[585] = BinaryenConst(the_module, BinaryenLiteralVec128(t208)); } { uint8_t t209[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[588] = BinaryenConst(the_module, BinaryenLiteralVec128(t209)); + expressions[586] = BinaryenConst(the_module, BinaryenLiteralVec128(t209)); } { uint8_t t210[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[589] = BinaryenConst(the_module, BinaryenLiteralVec128(t210)); - } - { - uint8_t t211[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - expressions[590] = BinaryenConst(the_module, BinaryenLiteralVec128(t211)); + expressions[587] = BinaryenConst(the_module, BinaryenLiteralVec128(t210)); } - expressions[591] = BinaryenSIMDBitselect(the_module, expressions[588], expressions[589], expressions[590]); + expressions[588] = BinaryenSIMDBitselect(the_module, expressions[585], expressions[586], expressions[587]); { BinaryenExpressionRef children[] = { 0 }; - expressions[592] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto()); - } - expressions[593] = BinaryenIf(the_module, expressions[18], expressions[19], expressions[20]); - expressions[594] = BinaryenIf(the_module, expressions[21], expressions[22], expressions[0]); - expressions[595] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[596] = BinaryenLoop(the_module, "in", expressions[595]); - expressions[597] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[598] = BinaryenLoop(the_module, NULL, expressions[597]); - expressions[599] = BinaryenBreak(the_module, "the-value", expressions[23], expressions[24]); - expressions[600] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[601] = BinaryenBreak(the_module, "the-nothing", expressions[600], expressions[0]); - expressions[602] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); - expressions[603] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[602]); - expressions[604] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]); + expressions[589] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto()); + } + expressions[590] = BinaryenIf(the_module, expressions[18], expressions[19], expressions[20]); + expressions[591] = BinaryenIf(the_module, expressions[21], expressions[22], expressions[0]); + expressions[592] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[593] = BinaryenLoop(the_module, "in", expressions[592]); + expressions[594] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[595] = BinaryenLoop(the_module, NULL, expressions[594]); + expressions[596] = BinaryenBreak(the_module, "the-value", expressions[23], expressions[24]); + expressions[597] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[598] = BinaryenBreak(the_module, "the-nothing", expressions[597], expressions[0]); + expressions[599] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); + expressions[600] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[599]); + expressions[601] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]); { const char* names[] = { "the-value" }; - expressions[605] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[25], expressions[26]); + expressions[602] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[25], expressions[26]); } - expressions[606] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[603] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { const char* names[] = { "the-nothing" }; - expressions[607] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[606], expressions[0]); + expressions[604] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[603], expressions[0]); } { BinaryenExpressionRef operands[] = { expressions[10], expressions[11], expressions[12], expressions[13] }; - expressions[608] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); + expressions[605] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1); } - expressions[609] = BinaryenUnary(the_module, 20, expressions[608]); + expressions[606] = BinaryenUnary(the_module, 20, expressions[605]); { BinaryenExpressionRef operands[] = { expressions[8], expressions[9] }; - expressions[610] = BinaryenCall(the_module, "an-imported", operands, 2, 3); + expressions[607] = BinaryenCall(the_module, "an-imported", operands, 2, 3); } - expressions[611] = BinaryenUnary(the_module, 25, expressions[610]); - expressions[612] = BinaryenUnary(the_module, 20, expressions[611]); - expressions[613] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); + expressions[608] = BinaryenUnary(the_module, 25, expressions[607]); + expressions[609] = BinaryenUnary(the_module, 20, expressions[608]); + expressions[610] = BinaryenConst(the_module, BinaryenLiteralInt32(2449)); { BinaryenExpressionRef operands[] = { expressions[14], expressions[15], expressions[16], expressions[17] }; - expressions[614] = BinaryenCallIndirect(the_module, expressions[613], operands, 4, "iiIfF"); - } - expressions[615] = BinaryenUnary(the_module, 20, expressions[614]); - expressions[616] = BinaryenGetLocal(the_module, 0, 1); - expressions[617] = BinaryenDrop(the_module, expressions[616]); - expressions[618] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); - expressions[619] = BinaryenSetLocal(the_module, 0, expressions[618]); - expressions[620] = BinaryenConst(the_module, BinaryenLiteralInt32(102)); - expressions[621] = BinaryenTeeLocal(the_module, 0, expressions[620]); - expressions[622] = BinaryenDrop(the_module, expressions[621]); - expressions[623] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - expressions[624] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[623]); - expressions[625] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); - expressions[626] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[625]); - expressions[627] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); - expressions[628] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[627]); - expressions[629] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); - expressions[630] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[629]); - expressions[631] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 1); - expressions[632] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 2); - expressions[633] = BinaryenSelect(the_module, expressions[27], expressions[28], expressions[29]); - expressions[634] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); - expressions[635] = BinaryenReturn(the_module, expressions[634]); - expressions[636] = BinaryenNop(the_module); - expressions[637] = BinaryenUnreachable(the_module); + expressions[611] = BinaryenCallIndirect(the_module, expressions[610], operands, 4, "iiIfF"); + } + expressions[612] = BinaryenUnary(the_module, 20, expressions[611]); + expressions[613] = BinaryenGetLocal(the_module, 0, 1); + expressions[614] = BinaryenDrop(the_module, expressions[613]); + expressions[615] = BinaryenConst(the_module, BinaryenLiteralInt32(101)); + expressions[616] = BinaryenSetLocal(the_module, 0, expressions[615]); + expressions[617] = BinaryenConst(the_module, BinaryenLiteralInt32(102)); + expressions[618] = BinaryenTeeLocal(the_module, 0, expressions[617]); + expressions[619] = BinaryenDrop(the_module, expressions[618]); + expressions[620] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + expressions[621] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[620]); + expressions[622] = BinaryenConst(the_module, BinaryenLiteralInt32(8)); + expressions[623] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[622]); + expressions[624] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); + expressions[625] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[624]); + expressions[626] = BinaryenConst(the_module, BinaryenLiteralInt32(9)); + expressions[627] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[626]); + expressions[628] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 1); + expressions[629] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 2); + expressions[630] = BinaryenSelect(the_module, expressions[27], expressions[28], expressions[29]); + expressions[631] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); + expressions[632] = BinaryenReturn(the_module, expressions[631]); + expressions[633] = BinaryenNop(the_module); + expressions[634] = BinaryenUnreachable(the_module); BinaryenExpressionPrint(expressions[41]); (f32.neg (f32.const -33.61199951171875) @@ -3231,32 +3219,32 @@ int main() { expressions[525], expressions[527], expressions[530], expressions[533], expressions[536], expressions[539], expressions[542], expressions[545], expressions[548], expressions[551], expressions[554], expressions[557], expressions[560], expressions[563], expressions[566], expressions[569], expressions[572], expressions[575], - expressions[578], expressions[581], expressions[584], expressions[587], expressions[591], expressions[592], - expressions[593], expressions[594], expressions[596], expressions[598], expressions[599], expressions[601], - expressions[603], expressions[604], expressions[605], expressions[607], expressions[609], expressions[612], - expressions[615], expressions[617], expressions[619], expressions[622], expressions[624], expressions[626], - expressions[628], expressions[630], expressions[631], expressions[632], expressions[633], expressions[635], - expressions[636], expressions[637] }; - expressions[638] = BinaryenBlock(the_module, "the-value", children, 241, BinaryenTypeAuto()); + expressions[578], expressions[581], expressions[584], expressions[588], expressions[589], expressions[590], + expressions[591], expressions[593], expressions[595], expressions[596], expressions[598], expressions[600], + expressions[601], expressions[602], expressions[604], expressions[606], expressions[609], expressions[612], + expressions[614], expressions[616], expressions[619], expressions[621], expressions[623], expressions[625], + expressions[627], expressions[628], expressions[629], expressions[630], expressions[632], expressions[633], + expressions[634] }; + expressions[635] = BinaryenBlock(the_module, "the-value", children, 240, BinaryenTypeAuto()); } - expressions[639] = BinaryenDrop(the_module, expressions[638]); + expressions[636] = BinaryenDrop(the_module, expressions[635]); { - BinaryenExpressionRef children[] = { expressions[639] }; - expressions[640] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto()); + BinaryenExpressionRef children[] = { expressions[636] }; + expressions[637] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto()); } - expressions[641] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[638] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); { - BinaryenExpressionRef children[] = { expressions[640], expressions[641] }; - expressions[642] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); + BinaryenExpressionRef children[] = { expressions[637], expressions[638] }; + expressions[639] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); } { BinaryenType varTypes[] = { 1 }; - functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[642]); + functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[639]); } - expressions[643] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); - BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[643]); - expressions[644] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); - BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[644]); + expressions[640] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); + BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[640]); + expressions[641] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); + BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[641]); { BinaryenType paramTypes[] = { 1, 4 }; functionTypes[1] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); @@ -3268,11 +3256,11 @@ int main() { const char* funcNames[] = { "kitchen()sinker" }; BinaryenSetFunctionTable(the_module, 1, 1, funcNames, 1); } - expressions[645] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + expressions[642] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); { const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; const char* segments[] = { segment0 }; - BinaryenExpressionRef segmentOffsets[] = { expressions[645] }; + BinaryenExpressionRef segmentOffsets[] = { expressions[642] }; BinaryenIndex segmentSizes[] = { 12 }; BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0); } @@ -3280,10 +3268,10 @@ int main() { BinaryenType paramTypes[] = { 0 }; functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); } - expressions[646] = BinaryenNop(the_module); + expressions[643] = BinaryenNop(the_module); { BinaryenType varTypes[] = { 0 }; - functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[646]); + functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[643]); } BinaryenSetStart(the_module, functions[1]); { @@ -4459,12 +4447,6 @@ int main() { (i32.const 1) ) ) - (drop - ( - (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) - (i32.const 1) - ) - ) (drop (i32x4.shl (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 13213b8a78c..d19b0660993 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -1167,12 +1167,6 @@ (i32.const 1) ) ) - (drop - ( - (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10) - (i32.const 1) - ) - ) (drop (i32x4.shl (v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10)