diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index 836ca4dba8e..80f6911b4bd 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -437,6 +437,10 @@ ("f32x4.max", "makeBinary(s, BinaryOp::MaxVecF32x4)"), ("f32x4.pmin", "makeBinary(s, BinaryOp::PMinVecF32x4)"), ("f32x4.pmax", "makeBinary(s, BinaryOp::PMaxVecF32x4)"), + ("f32x4.ceil", "makeUnary(s, UnaryOp::CeilVecF32x4)"), + ("f32x4.floor", "makeUnary(s, UnaryOp::FloorVecF32x4)"), + ("f32x4.trunc", "makeUnary(s, UnaryOp::TruncVecF32x4)"), + ("f32x4.nearest", "makeUnary(s, UnaryOp::NearestVecF32x4)"), ("f64x2.abs", "makeUnary(s, UnaryOp::AbsVecF64x2)"), ("f64x2.neg", "makeUnary(s, UnaryOp::NegVecF64x2)"), ("f64x2.sqrt", "makeUnary(s, UnaryOp::SqrtVecF64x2)"), @@ -450,6 +454,10 @@ ("f64x2.max", "makeBinary(s, BinaryOp::MaxVecF64x2)"), ("f64x2.pmin", "makeBinary(s, BinaryOp::PMinVecF64x2)"), ("f64x2.pmax", "makeBinary(s, BinaryOp::PMaxVecF64x2)"), + ("f64x2.ceil", "makeUnary(s, UnaryOp::CeilVecF64x2)"), + ("f64x2.floor", "makeUnary(s, UnaryOp::FloorVecF64x2)"), + ("f64x2.trunc", "makeUnary(s, UnaryOp::TruncVecF64x2)"), + ("f64x2.nearest", "makeUnary(s, UnaryOp::NearestVecF64x2)"), ("i32x4.trunc_sat_f32x4_s", "makeUnary(s, UnaryOp::TruncSatSVecF32x4ToVecI32x4)"), ("i32x4.trunc_sat_f32x4_u", "makeUnary(s, UnaryOp::TruncSatUVecF32x4ToVecI32x4)"), ("i64x2.trunc_sat_f64x2_s", "makeUnary(s, UnaryOp::TruncSatSVecF64x2ToVecI64x2)"), diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 96edb4c21cd..e6155bad353 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -682,6 +682,10 @@ BinaryenOp BinaryenDivVecF32x4(void) { return DivVecF32x4; } BinaryenOp BinaryenMinVecF32x4(void) { return MinVecF32x4; } BinaryenOp BinaryenMaxVecF32x4(void) { return MaxVecF32x4; } BinaryenOp BinaryenPMinVecF32x4(void) { return PMinVecF32x4; } +BinaryenOp BinaryenCeilVecF32x4(void) { return CeilVecF32x4; } +BinaryenOp BinaryenFloorVecF32x4(void) { return FloorVecF32x4; } +BinaryenOp BinaryenTruncVecF32x4(void) { return TruncVecF32x4; } +BinaryenOp BinaryenNearestVecF32x4(void) { return NearestVecF32x4; } BinaryenOp BinaryenPMaxVecF32x4(void) { return PMaxVecF32x4; } BinaryenOp BinaryenAbsVecF64x2(void) { return AbsVecF64x2; } BinaryenOp BinaryenNegVecF64x2(void) { return NegVecF64x2; } @@ -696,6 +700,10 @@ BinaryenOp BinaryenMinVecF64x2(void) { return MinVecF64x2; } BinaryenOp BinaryenMaxVecF64x2(void) { return MaxVecF64x2; } BinaryenOp BinaryenPMinVecF64x2(void) { return PMinVecF64x2; } BinaryenOp BinaryenPMaxVecF64x2(void) { return PMaxVecF64x2; } +BinaryenOp BinaryenCeilVecF64x2(void) { return CeilVecF64x2; } +BinaryenOp BinaryenFloorVecF64x2(void) { return FloorVecF64x2; } +BinaryenOp BinaryenTruncVecF64x2(void) { return TruncVecF64x2; } +BinaryenOp BinaryenNearestVecF64x2(void) { return NearestVecF64x2; } BinaryenOp BinaryenTruncSatSVecF32x4ToVecI32x4(void) { return TruncSatSVecF32x4ToVecI32x4; } diff --git a/src/binaryen-c.h b/src/binaryen-c.h index 9fd08f968cb..e52d5f46a30 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -543,6 +543,10 @@ BINARYEN_API BinaryenOp BinaryenMinVecF32x4(void); BINARYEN_API BinaryenOp BinaryenMaxVecF32x4(void); BINARYEN_API BinaryenOp BinaryenPMinVecF32x4(void); BINARYEN_API BinaryenOp BinaryenPMaxVecF32x4(void); +BINARYEN_API BinaryenOp BinaryenCeilVecF32x4(void); +BINARYEN_API BinaryenOp BinaryenFloorVecF32x4(void); +BINARYEN_API BinaryenOp BinaryenTruncVecF32x4(void); +BINARYEN_API BinaryenOp BinaryenNearestVecF32x4(void); BINARYEN_API BinaryenOp BinaryenAbsVecF64x2(void); BINARYEN_API BinaryenOp BinaryenNegVecF64x2(void); BINARYEN_API BinaryenOp BinaryenSqrtVecF64x2(void); @@ -556,6 +560,10 @@ BINARYEN_API BinaryenOp BinaryenMinVecF64x2(void); BINARYEN_API BinaryenOp BinaryenMaxVecF64x2(void); BINARYEN_API BinaryenOp BinaryenPMinVecF64x2(void); BINARYEN_API BinaryenOp BinaryenPMaxVecF64x2(void); +BINARYEN_API BinaryenOp BinaryenCeilVecF64x2(void); +BINARYEN_API BinaryenOp BinaryenFloorVecF64x2(void); +BINARYEN_API BinaryenOp BinaryenTruncVecF64x2(void); +BINARYEN_API BinaryenOp BinaryenNearestVecF64x2(void); BINARYEN_API BinaryenOp BinaryenTruncSatSVecF32x4ToVecI32x4(void); BINARYEN_API BinaryenOp BinaryenTruncSatUVecF32x4ToVecI32x4(void); BINARYEN_API BinaryenOp BinaryenTruncSatSVecF64x2ToVecI64x2(void); diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index 3a7569a613f..c7a703aea1c 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -267,13 +267,21 @@ switch (op[0]) { } } case 'c': { - switch (op[20]) { - case 's': - if (strcmp(op, "f32x4.convert_i32x4_s") == 0) { return makeUnary(s, UnaryOp::ConvertSVecI32x4ToVecF32x4); } - goto parse_error; - case 'u': - if (strcmp(op, "f32x4.convert_i32x4_u") == 0) { return makeUnary(s, UnaryOp::ConvertUVecI32x4ToVecF32x4); } + switch (op[7]) { + case 'e': + if (strcmp(op, "f32x4.ceil") == 0) { return makeUnary(s, UnaryOp::CeilVecF32x4); } goto parse_error; + case 'o': { + switch (op[20]) { + case 's': + if (strcmp(op, "f32x4.convert_i32x4_s") == 0) { return makeUnary(s, UnaryOp::ConvertSVecI32x4ToVecF32x4); } + goto parse_error; + case 'u': + if (strcmp(op, "f32x4.convert_i32x4_u") == 0) { return makeUnary(s, UnaryOp::ConvertUVecI32x4ToVecF32x4); } + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } @@ -291,6 +299,9 @@ switch (op[0]) { default: goto parse_error; } } + case 'f': + if (strcmp(op, "f32x4.floor") == 0) { return makeUnary(s, UnaryOp::FloorVecF32x4); } + goto parse_error; case 'g': { switch (op[7]) { case 'e': @@ -332,6 +343,9 @@ switch (op[0]) { case '\0': if (strcmp(op, "f32x4.ne") == 0) { return makeBinary(s, BinaryOp::NeVecF32x4); } goto parse_error; + case 'a': + if (strcmp(op, "f32x4.nearest") == 0) { return makeUnary(s, UnaryOp::NearestVecF32x4); } + goto parse_error; case 'g': if (strcmp(op, "f32x4.neg") == 0) { return makeUnary(s, UnaryOp::NegVecF32x4); } goto parse_error; @@ -377,6 +391,9 @@ switch (op[0]) { default: goto parse_error; } } + case 't': + if (strcmp(op, "f32x4.trunc") == 0) { return makeUnary(s, UnaryOp::TruncVecF32x4); } + goto parse_error; default: goto parse_error; } } @@ -559,13 +576,21 @@ switch (op[0]) { } } case 'c': { - switch (op[20]) { - case 's': - if (strcmp(op, "f64x2.convert_i64x2_s") == 0) { return makeUnary(s, UnaryOp::ConvertSVecI64x2ToVecF64x2); } - goto parse_error; - case 'u': - if (strcmp(op, "f64x2.convert_i64x2_u") == 0) { return makeUnary(s, UnaryOp::ConvertUVecI64x2ToVecF64x2); } + switch (op[7]) { + case 'e': + if (strcmp(op, "f64x2.ceil") == 0) { return makeUnary(s, UnaryOp::CeilVecF64x2); } goto parse_error; + case 'o': { + switch (op[20]) { + case 's': + if (strcmp(op, "f64x2.convert_i64x2_s") == 0) { return makeUnary(s, UnaryOp::ConvertSVecI64x2ToVecF64x2); } + goto parse_error; + case 'u': + if (strcmp(op, "f64x2.convert_i64x2_u") == 0) { return makeUnary(s, UnaryOp::ConvertUVecI64x2ToVecF64x2); } + goto parse_error; + default: goto parse_error; + } + } default: goto parse_error; } } @@ -583,6 +608,9 @@ switch (op[0]) { default: goto parse_error; } } + case 'f': + if (strcmp(op, "f64x2.floor") == 0) { return makeUnary(s, UnaryOp::FloorVecF64x2); } + goto parse_error; case 'g': { switch (op[7]) { case 'e': @@ -624,6 +652,9 @@ switch (op[0]) { case '\0': if (strcmp(op, "f64x2.ne") == 0) { return makeBinary(s, BinaryOp::NeVecF64x2); } goto parse_error; + case 'a': + if (strcmp(op, "f64x2.nearest") == 0) { return makeUnary(s, UnaryOp::NearestVecF64x2); } + goto parse_error; case 'g': if (strcmp(op, "f64x2.neg") == 0) { return makeUnary(s, UnaryOp::NegVecF64x2); } goto parse_error; @@ -669,6 +700,9 @@ switch (op[0]) { default: goto parse_error; } } + case 't': + if (strcmp(op, "f64x2.trunc") == 0) { return makeUnary(s, UnaryOp::TruncVecF64x2); } + goto parse_error; default: goto parse_error; } } diff --git a/src/ir/cost.h b/src/ir/cost.h index f890e89100b..ea3e32909b8 100644 --- a/src/ir/cost.h +++ b/src/ir/cost.h @@ -173,9 +173,17 @@ struct CostAnalyzer : public Visitor { case AbsVecF32x4: case NegVecF32x4: case SqrtVecF32x4: + case CeilVecF32x4: + case FloorVecF32x4: + case TruncVecF32x4: + case NearestVecF32x4: case AbsVecF64x2: case NegVecF64x2: case SqrtVecF64x2: + case CeilVecF64x2: + case FloorVecF64x2: + case TruncVecF64x2: + case NearestVecF64x2: case TruncSatSVecF32x4ToVecI32x4: case TruncSatUVecF32x4ToVecI32x4: case TruncSatSVecF64x2ToVecI64x2: diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 2d7bd3f3613..dfdb0545737 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -423,6 +423,10 @@ function initializeConstants() { 'MaxVecF32x4', 'PMinVecF32x4', 'PMaxVecF32x4', + 'CeilVecF32x4', + 'FloorVecF32x4', + 'TruncVecF32x4', + 'NearestVecF32x4', 'AbsVecF64x2', 'NegVecF64x2', 'SqrtVecF64x2', @@ -436,6 +440,10 @@ function initializeConstants() { 'MaxVecF64x2', 'PMinVecF64x2', 'PMaxVecF64x2', + 'CeilVecF64x2', + 'FloorVecF64x2', + 'TruncVecF64x2', + 'NearestVecF64x2', 'TruncSatSVecF32x4ToVecI32x4', 'TruncSatUVecF32x4ToVecI32x4', 'TruncSatSVecF64x2ToVecI64x2', @@ -1918,6 +1926,18 @@ function wrapModule(module, self) { 'pmax': function(left, right) { return Module['_BinaryenBinary'](module, Module['PMaxVecF32x4'], left, right); }, + 'ceil': function(value) { + return Module['_BinaryenUnary'](module, Module['CeilVecF32x4'], value); + }, + 'floor': function(value) { + return Module['_BinaryenUnary'](module, Module['FloorVecF32x4'], value); + }, + 'trunc': function(value) { + return Module['_BinaryenUnary'](module, Module['TruncVecF32x4'], value); + }, + 'nearest': function(value) { + return Module['_BinaryenUnary'](module, Module['NearestVecF32x4'], value); + }, 'convert_i32x4_s': function(value) { return Module['_BinaryenUnary'](module, Module['ConvertSVecI32x4ToVecF32x4'], value); }, @@ -1993,6 +2013,18 @@ function wrapModule(module, self) { 'pmax': function(left, right) { return Module['_BinaryenBinary'](module, Module['PMaxVecF64x2'], left, right); }, + 'ceil': function(value) { + return Module['_BinaryenUnary'](module, Module['CeilVecF64x2'], value); + }, + 'floor': function(value) { + return Module['_BinaryenUnary'](module, Module['FloorVecF64x2'], value); + }, + 'trunc': function(value) { + return Module['_BinaryenUnary'](module, Module['TruncVecF64x2'], value); + }, + 'nearest': function(value) { + return Module['_BinaryenUnary'](module, Module['NearestVecF64x2'], value); + }, 'convert_i64x2_s': function(value) { return Module['_BinaryenUnary'](module, Module['ConvertSVecI64x2ToVecF64x2'], value); }, diff --git a/src/literal.h b/src/literal.h index 2295a126eb1..8bfee38c12d 100644 --- a/src/literal.h +++ b/src/literal.h @@ -429,6 +429,10 @@ class Literal { Literal maxF32x4(const Literal& other) const; Literal pminF32x4(const Literal& other) const; Literal pmaxF32x4(const Literal& other) const; + Literal ceilF32x4() const; + Literal floorF32x4() const; + Literal truncF32x4() const; + Literal nearestF32x4() const; Literal absF64x2() const; Literal negF64x2() const; Literal sqrtF64x2() const; @@ -440,6 +444,10 @@ class Literal { Literal maxF64x2(const Literal& other) const; Literal pminF64x2(const Literal& other) const; Literal pmaxF64x2(const Literal& other) const; + Literal ceilF64x2() const; + Literal floorF64x2() const; + Literal truncF64x2() const; + Literal nearestF64x2() const; Literal truncSatToSI32x4() const; Literal truncSatToUI32x4() const; Literal truncSatToSI64x2() const; diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index efa31cac068..6246a5f5ae2 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -780,6 +780,18 @@ struct PrintExpressionContents case SqrtVecF32x4: o << "f32x4.sqrt"; break; + case CeilVecF32x4: + o << "f32x4.ceil"; + break; + case FloorVecF32x4: + o << "f32x4.floor"; + break; + case TruncVecF32x4: + o << "f32x4.trunc"; + break; + case NearestVecF32x4: + o << "f32x4.nearest"; + break; case AbsVecF64x2: o << "f64x2.abs"; break; @@ -789,6 +801,18 @@ struct PrintExpressionContents case SqrtVecF64x2: o << "f64x2.sqrt"; break; + case CeilVecF64x2: + o << "f64x2.ceil"; + break; + case FloorVecF64x2: + o << "f64x2.floor"; + break; + case TruncVecF64x2: + o << "f64x2.trunc"; + break; + case NearestVecF64x2: + o << "f64x2.nearest"; + break; case TruncSatSVecF32x4ToVecI32x4: o << "i32x4.trunc_sat_f32x4_s"; break; diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 995adde2ab6..b8d14377d13 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -862,6 +862,15 @@ enum ASTNodes { F32x4PMin = 0xea, F32x4PMax = 0xeb, + F32x4Ceil = 0xd8, + F32x4Floor = 0xd9, + F32x4Trunc = 0xda, + F32x4Nearest = 0xdb, + F64x2Ceil = 0xdc, + F64x2Floor = 0xdd, + F64x2Trunc = 0xde, + F64x2Nearest = 0xdf, + F64x2Abs = 0xec, F64x2Neg = 0xed, F64x2Sqrt = 0xef, diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index c47786a0885..86ea7e146ea 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -495,12 +495,28 @@ class ExpressionRunner : public OverriddenVisitor { return value.negF32x4(); case SqrtVecF32x4: return value.sqrtF32x4(); + case CeilVecF32x4: + return value.ceilF32x4(); + case FloorVecF32x4: + return value.floorF32x4(); + case TruncVecF32x4: + return value.truncF32x4(); + case NearestVecF32x4: + return value.nearestF32x4(); case AbsVecF64x2: return value.absF64x2(); case NegVecF64x2: return value.negF64x2(); case SqrtVecF64x2: return value.sqrtF64x2(); + case CeilVecF64x2: + return value.ceilF64x2(); + case FloorVecF64x2: + return value.floorF64x2(); + case TruncVecF64x2: + return value.truncF64x2(); + case NearestVecF64x2: + return value.nearestF64x2(); case TruncSatSVecF32x4ToVecI32x4: return value.truncSatToSI32x4(); case TruncSatUVecF32x4ToVecI32x4: diff --git a/src/wasm.h b/src/wasm.h index 0afe5ab288f..a1c38628926 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -177,9 +177,17 @@ enum UnaryOp { AbsVecF32x4, NegVecF32x4, SqrtVecF32x4, + CeilVecF32x4, + FloorVecF32x4, + TruncVecF32x4, + NearestVecF32x4, AbsVecF64x2, NegVecF64x2, SqrtVecF64x2, + CeilVecF64x2, + FloorVecF64x2, + TruncVecF64x2, + NearestVecF64x2, // SIMD conversions TruncSatSVecF32x4ToVecI32x4, diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 3326adc7428..5aebf30a337 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -1531,6 +1531,18 @@ Literal Literal::negF32x4() const { Literal Literal::sqrtF32x4() const { return unary<4, &Literal::getLanesF32x4, &Literal::sqrt>(*this); } +Literal Literal::ceilF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::ceil>(*this); +} +Literal Literal::floorF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::floor>(*this); +} +Literal Literal::truncF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::trunc>(*this); +} +Literal Literal::nearestF32x4() const { + return unary<4, &Literal::getLanesF32x4, &Literal::nearbyint>(*this); +} Literal Literal::absF64x2() const { return unary<2, &Literal::getLanesF64x2, &Literal::abs>(*this); } @@ -1540,6 +1552,18 @@ Literal Literal::negF64x2() const { Literal Literal::sqrtF64x2() const { return unary<2, &Literal::getLanesF64x2, &Literal::sqrt>(*this); } +Literal Literal::ceilF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::ceil>(*this); +} +Literal Literal::floorF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::floor>(*this); +} +Literal Literal::truncF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::trunc>(*this); +} +Literal Literal::nearestF64x2() const { + return unary<2, &Literal::getLanesF64x2, &Literal::nearbyint>(*this); +} Literal Literal::truncSatToSI32x4() const { return unary<4, &Literal::getLanesF32x4, &Literal::truncSatToSI32>(*this); } diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 3441953a769..a766e9b6330 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -4194,6 +4194,22 @@ bool WasmBinaryBuilder::maybeVisitSIMDUnary(Expression*& out, uint32_t code) { curr = allocator.alloc(); curr->op = SqrtVecF32x4; break; + case BinaryConsts::F32x4Ceil: + curr = allocator.alloc(); + curr->op = CeilVecF32x4; + break; + case BinaryConsts::F32x4Floor: + curr = allocator.alloc(); + curr->op = FloorVecF32x4; + break; + case BinaryConsts::F32x4Trunc: + curr = allocator.alloc(); + curr->op = TruncVecF32x4; + break; + case BinaryConsts::F32x4Nearest: + curr = allocator.alloc(); + curr->op = NearestVecF32x4; + break; case BinaryConsts::F64x2Abs: curr = allocator.alloc(); curr->op = AbsVecF64x2; @@ -4206,6 +4222,22 @@ bool WasmBinaryBuilder::maybeVisitSIMDUnary(Expression*& out, uint32_t code) { curr = allocator.alloc(); curr->op = SqrtVecF64x2; break; + case BinaryConsts::F64x2Ceil: + curr = allocator.alloc(); + curr->op = CeilVecF64x2; + break; + case BinaryConsts::F64x2Floor: + curr = allocator.alloc(); + curr->op = FloorVecF64x2; + break; + case BinaryConsts::F64x2Trunc: + curr = allocator.alloc(); + curr->op = TruncVecF64x2; + break; + case BinaryConsts::F64x2Nearest: + curr = allocator.alloc(); + curr->op = NearestVecF64x2; + break; case BinaryConsts::I32x4TruncSatSF32x4: curr = allocator.alloc(); curr->op = TruncSatSVecF32x4ToVecI32x4; diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 58fa3f2ef67..9ebf39fb894 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -981,6 +981,19 @@ void BinaryInstWriter::visitUnary(Unary* curr) { case SqrtVecF32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Sqrt); break; + case CeilVecF32x4: + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Ceil); + break; + case FloorVecF32x4: + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Floor); + break; + case TruncVecF32x4: + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F32x4Trunc); + break; + case NearestVecF32x4: + o << int8_t(BinaryConsts::SIMDPrefix) + << U32LEB(BinaryConsts::F32x4Nearest); + break; case AbsVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Abs); break; @@ -990,6 +1003,19 @@ void BinaryInstWriter::visitUnary(Unary* curr) { case SqrtVecF64x2: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Sqrt); break; + case CeilVecF64x2: + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Ceil); + break; + case FloorVecF64x2: + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Floor); + break; + case TruncVecF64x2: + o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::F64x2Trunc); + break; + case NearestVecF64x2: + o << int8_t(BinaryConsts::SIMDPrefix) + << U32LEB(BinaryConsts::F64x2Nearest); + break; case TruncSatSVecF32x4ToVecI32x4: o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4TruncSatSF32x4); diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 606cb47a89f..97e45d47101 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1704,9 +1704,17 @@ void FunctionValidator::visitUnary(Unary* curr) { case AbsVecF32x4: case NegVecF32x4: case SqrtVecF32x4: + case CeilVecF32x4: + case FloorVecF32x4: + case TruncVecF32x4: + case NearestVecF32x4: case AbsVecF64x2: case NegVecF64x2: case SqrtVecF64x2: + case CeilVecF64x2: + case FloorVecF64x2: + case TruncVecF64x2: + case NearestVecF64x2: case TruncSatSVecF32x4ToVecI32x4: case TruncSatUVecF32x4ToVecI32x4: case TruncSatSVecF64x2ToVecI64x2: diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 704e48e88c2..6f86a13acfb 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -746,9 +746,17 @@ void Unary::finalize() { case AbsVecF32x4: case NegVecF32x4: case SqrtVecF32x4: + case CeilVecF32x4: + case FloorVecF32x4: + case TruncVecF32x4: + case NearestVecF32x4: case AbsVecF64x2: case NegVecF64x2: case SqrtVecF64x2: + case CeilVecF64x2: + case FloorVecF64x2: + case TruncVecF64x2: + case NearestVecF64x2: case TruncSatSVecF32x4ToVecI32x4: case TruncSatUVecF32x4ToVecI32x4: case TruncSatSVecF64x2ToVecI64x2: diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 6c5afa1691d..cd3af675023 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -391,6 +391,10 @@ function test_core() { module.f32x4.max(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.f32x4.pmin(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.f32x4.pmax(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.ceil(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.floor(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.trunc(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f32x4.nearest(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)), @@ -399,6 +403,10 @@ function test_core() { module.f64x2.max(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.f64x2.pmin(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.f64x2.pmax(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.ceil(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.floor(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.trunc(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), + module.f64x2.nearest(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.i8x16.narrow_i16x8_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.i8x16.narrow_i16x8_u(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), module.i16x8.narrow_i32x4_s(module.v128.const(v128_bytes), module.v128.const(v128_bytes)), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 14f8c0d0362..d81ea53125a 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -1296,6 +1296,26 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (f32x4.ceil + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.floor + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.trunc + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.nearest + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (drop (f64x2.add (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) @@ -1344,6 +1364,26 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (f64x2.ceil + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.floor + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.trunc + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.nearest + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (drop (i8x16.narrow_i16x8_s (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) @@ -3094,6 +3134,26 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (f32x4.ceil + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.floor + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.trunc + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.nearest + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (drop (f64x2.add (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) @@ -3142,6 +3202,26 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (f64x2.ceil + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.floor + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.trunc + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.nearest + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (drop (i8x16.narrow_i16x8_s (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 764cc0ba619..1f6ffc9fc00 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -564,6 +564,10 @@ void test_core() { makeBinary(module, BinaryenMaxVecF32x4(), v128), makeBinary(module, BinaryenPMinVecF32x4(), v128), makeBinary(module, BinaryenPMaxVecF32x4(), v128), + makeBinary(module, BinaryenCeilVecF32x4(), v128), + makeBinary(module, BinaryenFloorVecF32x4(), v128), + makeBinary(module, BinaryenTruncVecF32x4(), v128), + makeBinary(module, BinaryenNearestVecF32x4(), v128), makeBinary(module, BinaryenAddVecF64x2(), v128), makeBinary(module, BinaryenSubVecF64x2(), v128), makeBinary(module, BinaryenMulVecF64x2(), v128), @@ -572,6 +576,10 @@ void test_core() { makeBinary(module, BinaryenMaxVecF64x2(), v128), makeBinary(module, BinaryenPMinVecF64x2(), v128), makeBinary(module, BinaryenPMaxVecF64x2(), v128), + makeBinary(module, BinaryenCeilVecF64x2(), v128), + makeBinary(module, BinaryenFloorVecF64x2(), v128), + makeBinary(module, BinaryenTruncVecF64x2(), v128), + makeBinary(module, BinaryenNearestVecF64x2(), v128), makeBinary(module, BinaryenNarrowSVecI16x8ToVecI8x16(), v128), makeBinary(module, BinaryenNarrowUVecI16x8ToVecI8x16(), v128), makeBinary(module, BinaryenNarrowSVecI32x4ToVecI16x8(), v128), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index fda846fcb73..ff9256fda81 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1230,6 +1230,30 @@ BinaryenFeatureAll: 1023 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (i16x8.lt_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i16x8.lt_u + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i16x8.gt_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i16x8.gt_u + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (drop (f64x2.add (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) @@ -1278,6 +1302,30 @@ BinaryenFeatureAll: 1023 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (i16x8.ge_u + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.eq + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.ne + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.lt_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (drop (i8x16.narrow_i16x8_s (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) diff --git a/test/simd.wast b/test/simd.wast index edd9a2c4334..7ee8760e1fd 100644 --- a/test/simd.wast +++ b/test/simd.wast @@ -844,6 +844,26 @@ (local.get $1) ) ) + (func $f32x4.ceil (param $0 v128) (result v128) + (f32x4.ceil + (local.get $0) + ) + ) + (func $f32x4.floor (param $0 v128) (result v128) + (f32x4.floor + (local.get $0) + ) + ) + (func $f32x4.trunc (param $0 v128) (result v128) + (f32x4.trunc + (local.get $0) + ) + ) + (func $f32x4.nearest (param $0 v128) (result v128) + (f32x4.nearest + (local.get $0) + ) + ) (func $f32x4.abs (param $0 v128) (result v128) (f32x4.abs (local.get $0) @@ -921,6 +941,26 @@ (local.get $1) ) ) + (func $f64x2.ceil (param $0 v128) (result v128) + (f64x2.ceil + (local.get $0) + ) + ) + (func $f64x2.floor (param $0 v128) (result v128) + (f64x2.floor + (local.get $0) + ) + ) + (func $f64x2.trunc (param $0 v128) (result v128) + (f64x2.trunc + (local.get $0) + ) + ) + (func $f64x2.nearest (param $0 v128) (result v128) + (f64x2.nearest + (local.get $0) + ) + ) (func $f64x2.abs (param $0 v128) (result v128) (f64x2.abs (local.get $0) diff --git a/test/simd.wast.from-wast b/test/simd.wast.from-wast index 35643ec045b..508d44c7c00 100644 --- a/test/simd.wast.from-wast +++ b/test/simd.wast.from-wast @@ -860,6 +860,26 @@ (local.get $1) ) ) + (func $f32x4.ceil (param $0 v128) (result v128) + (f32x4.ceil + (local.get $0) + ) + ) + (func $f32x4.floor (param $0 v128) (result v128) + (f32x4.floor + (local.get $0) + ) + ) + (func $f32x4.trunc (param $0 v128) (result v128) + (f32x4.trunc + (local.get $0) + ) + ) + (func $f32x4.nearest (param $0 v128) (result v128) + (f32x4.nearest + (local.get $0) + ) + ) (func $f32x4.abs (param $0 v128) (result v128) (f32x4.abs (local.get $0) @@ -937,6 +957,26 @@ (local.get $1) ) ) + (func $f64x2.ceil (param $0 v128) (result v128) + (f64x2.ceil + (local.get $0) + ) + ) + (func $f64x2.floor (param $0 v128) (result v128) + (f64x2.floor + (local.get $0) + ) + ) + (func $f64x2.trunc (param $0 v128) (result v128) + (f64x2.trunc + (local.get $0) + ) + ) + (func $f64x2.nearest (param $0 v128) (result v128) + (f64x2.nearest + (local.get $0) + ) + ) (func $f64x2.abs (param $0 v128) (result v128) (f64x2.abs (local.get $0) diff --git a/test/simd.wast.fromBinary b/test/simd.wast.fromBinary index 40ce99ec2a4..d5337688369 100644 --- a/test/simd.wast.fromBinary +++ b/test/simd.wast.fromBinary @@ -860,6 +860,26 @@ (local.get $1) ) ) + (func $f32x4.ceil (param $0 v128) (result v128) + (f32x4.ceil + (local.get $0) + ) + ) + (func $f32x4.floor (param $0 v128) (result v128) + (f32x4.floor + (local.get $0) + ) + ) + (func $f32x4.trunc (param $0 v128) (result v128) + (f32x4.trunc + (local.get $0) + ) + ) + (func $f32x4.nearest (param $0 v128) (result v128) + (f32x4.nearest + (local.get $0) + ) + ) (func $f32x4.abs (param $0 v128) (result v128) (f32x4.abs (local.get $0) @@ -937,6 +957,26 @@ (local.get $1) ) ) + (func $f64x2.ceil (param $0 v128) (result v128) + (f64x2.ceil + (local.get $0) + ) + ) + (func $f64x2.floor (param $0 v128) (result v128) + (f64x2.floor + (local.get $0) + ) + ) + (func $f64x2.trunc (param $0 v128) (result v128) + (f64x2.trunc + (local.get $0) + ) + ) + (func $f64x2.nearest (param $0 v128) (result v128) + (f64x2.nearest + (local.get $0) + ) + ) (func $f64x2.abs (param $0 v128) (result v128) (f64x2.abs (local.get $0) diff --git a/test/simd.wast.fromBinary.noDebugInfo b/test/simd.wast.fromBinary.noDebugInfo index 85ca0a9f48a..474dfc7c561 100644 --- a/test/simd.wast.fromBinary.noDebugInfo +++ b/test/simd.wast.fromBinary.noDebugInfo @@ -861,266 +861,306 @@ ) ) (func $149 (param $0 v128) (result v128) - (f32x4.abs + (f32x4.ceil (local.get $0) ) ) (func $150 (param $0 v128) (result v128) - (f32x4.neg + (f32x4.floor (local.get $0) ) ) (func $151 (param $0 v128) (result v128) + (f32x4.trunc + (local.get $0) + ) + ) + (func $152 (param $0 v128) (result v128) + (f32x4.nearest + (local.get $0) + ) + ) + (func $153 (param $0 v128) (result v128) + (f32x4.abs + (local.get $0) + ) + ) + (func $154 (param $0 v128) (result v128) + (f32x4.neg + (local.get $0) + ) + ) + (func $155 (param $0 v128) (result v128) (f32x4.sqrt (local.get $0) ) ) - (func $152 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (func $156 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) (f32x4.qfma (local.get $0) (local.get $1) (local.get $2) ) ) - (func $153 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (func $157 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) (f32x4.qfms (local.get $0) (local.get $1) (local.get $2) ) ) - (func $154 (param $0 v128) (param $1 v128) (result v128) + (func $158 (param $0 v128) (param $1 v128) (result v128) (f64x2.add (local.get $0) (local.get $1) ) ) - (func $155 (param $0 v128) (param $1 v128) (result v128) + (func $159 (param $0 v128) (param $1 v128) (result v128) (f64x2.sub (local.get $0) (local.get $1) ) ) - (func $156 (param $0 v128) (param $1 v128) (result v128) + (func $160 (param $0 v128) (param $1 v128) (result v128) (f64x2.mul (local.get $0) (local.get $1) ) ) - (func $157 (param $0 v128) (param $1 v128) (result v128) + (func $161 (param $0 v128) (param $1 v128) (result v128) (f64x2.div (local.get $0) (local.get $1) ) ) - (func $158 (param $0 v128) (param $1 v128) (result v128) + (func $162 (param $0 v128) (param $1 v128) (result v128) (f64x2.min (local.get $0) (local.get $1) ) ) - (func $159 (param $0 v128) (param $1 v128) (result v128) + (func $163 (param $0 v128) (param $1 v128) (result v128) (f64x2.max (local.get $0) (local.get $1) ) ) - (func $160 (param $0 v128) (param $1 v128) (result v128) + (func $164 (param $0 v128) (param $1 v128) (result v128) (f64x2.pmin (local.get $0) (local.get $1) ) ) - (func $161 (param $0 v128) (param $1 v128) (result v128) + (func $165 (param $0 v128) (param $1 v128) (result v128) (f64x2.pmax (local.get $0) (local.get $1) ) ) - (func $162 (param $0 v128) (result v128) + (func $166 (param $0 v128) (result v128) + (f64x2.ceil + (local.get $0) + ) + ) + (func $167 (param $0 v128) (result v128) + (f64x2.floor + (local.get $0) + ) + ) + (func $168 (param $0 v128) (result v128) + (f64x2.trunc + (local.get $0) + ) + ) + (func $169 (param $0 v128) (result v128) + (f64x2.nearest + (local.get $0) + ) + ) + (func $170 (param $0 v128) (result v128) (f64x2.abs (local.get $0) ) ) - (func $163 (param $0 v128) (result v128) + (func $171 (param $0 v128) (result v128) (f64x2.neg (local.get $0) ) ) - (func $164 (param $0 v128) (result v128) + (func $172 (param $0 v128) (result v128) (f64x2.sqrt (local.get $0) ) ) - (func $165 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (func $173 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) (f64x2.qfma (local.get $0) (local.get $1) (local.get $2) ) ) - (func $166 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) + (func $174 (param $0 v128) (param $1 v128) (param $2 v128) (result v128) (f64x2.qfms (local.get $0) (local.get $1) (local.get $2) ) ) - (func $167 (param $0 v128) (result v128) + (func $175 (param $0 v128) (result v128) (i32x4.trunc_sat_f32x4_s (local.get $0) ) ) - (func $168 (param $0 v128) (result v128) + (func $176 (param $0 v128) (result v128) (i32x4.trunc_sat_f32x4_u (local.get $0) ) ) - (func $169 (param $0 v128) (result v128) + (func $177 (param $0 v128) (result v128) (i64x2.trunc_sat_f64x2_s (local.get $0) ) ) - (func $170 (param $0 v128) (result v128) + (func $178 (param $0 v128) (result v128) (i64x2.trunc_sat_f64x2_u (local.get $0) ) ) - (func $171 (param $0 v128) (result v128) + (func $179 (param $0 v128) (result v128) (f32x4.convert_i32x4_s (local.get $0) ) ) - (func $172 (param $0 v128) (result v128) + (func $180 (param $0 v128) (result v128) (f32x4.convert_i32x4_u (local.get $0) ) ) - (func $173 (param $0 v128) (result v128) + (func $181 (param $0 v128) (result v128) (f64x2.convert_i64x2_s (local.get $0) ) ) - (func $174 (param $0 v128) (result v128) + (func $182 (param $0 v128) (result v128) (f64x2.convert_i64x2_u (local.get $0) ) ) - (func $175 (param $0 i32) (result v128) + (func $183 (param $0 i32) (result v128) (v8x16.load_splat (local.get $0) ) ) - (func $176 (param $0 i32) (result v128) + (func $184 (param $0 i32) (result v128) (v16x8.load_splat (local.get $0) ) ) - (func $177 (param $0 i32) (result v128) + (func $185 (param $0 i32) (result v128) (v32x4.load_splat (local.get $0) ) ) - (func $178 (param $0 i32) (result v128) + (func $186 (param $0 i32) (result v128) (v64x2.load_splat (local.get $0) ) ) - (func $179 (param $0 v128) (param $1 v128) (result v128) + (func $187 (param $0 v128) (param $1 v128) (result v128) (i8x16.narrow_i16x8_s (local.get $0) (local.get $1) ) ) - (func $180 (param $0 v128) (param $1 v128) (result v128) + (func $188 (param $0 v128) (param $1 v128) (result v128) (i8x16.narrow_i16x8_u (local.get $0) (local.get $1) ) ) - (func $181 (param $0 v128) (param $1 v128) (result v128) + (func $189 (param $0 v128) (param $1 v128) (result v128) (i16x8.narrow_i32x4_s (local.get $0) (local.get $1) ) ) - (func $182 (param $0 v128) (param $1 v128) (result v128) + (func $190 (param $0 v128) (param $1 v128) (result v128) (i16x8.narrow_i32x4_u (local.get $0) (local.get $1) ) ) - (func $183 (param $0 v128) (result v128) + (func $191 (param $0 v128) (result v128) (i16x8.widen_low_i8x16_s (local.get $0) ) ) - (func $184 (param $0 v128) (result v128) + (func $192 (param $0 v128) (result v128) (i16x8.widen_high_i8x16_s (local.get $0) ) ) - (func $185 (param $0 v128) (result v128) + (func $193 (param $0 v128) (result v128) (i16x8.widen_low_i8x16_u (local.get $0) ) ) - (func $186 (param $0 v128) (result v128) + (func $194 (param $0 v128) (result v128) (i16x8.widen_high_i8x16_u (local.get $0) ) ) - (func $187 (param $0 v128) (result v128) + (func $195 (param $0 v128) (result v128) (i32x4.widen_low_i16x8_s (local.get $0) ) ) - (func $188 (param $0 v128) (result v128) + (func $196 (param $0 v128) (result v128) (i32x4.widen_high_i16x8_s (local.get $0) ) ) - (func $189 (param $0 v128) (result v128) + (func $197 (param $0 v128) (result v128) (i32x4.widen_low_i16x8_u (local.get $0) ) ) - (func $190 (param $0 v128) (result v128) + (func $198 (param $0 v128) (result v128) (i32x4.widen_high_i16x8_u (local.get $0) ) ) - (func $191 (param $0 i32) (result v128) + (func $199 (param $0 i32) (result v128) (i16x8.load8x8_u (local.get $0) ) ) - (func $192 (param $0 i32) (result v128) + (func $200 (param $0 i32) (result v128) (i16x8.load8x8_s (local.get $0) ) ) - (func $193 (param $0 i32) (result v128) + (func $201 (param $0 i32) (result v128) (i32x4.load16x4_s (local.get $0) ) ) - (func $194 (param $0 i32) (result v128) + (func $202 (param $0 i32) (result v128) (i32x4.load16x4_u (local.get $0) ) ) - (func $195 (param $0 i32) (result v128) + (func $203 (param $0 i32) (result v128) (i64x2.load32x2_s (local.get $0) ) ) - (func $196 (param $0 i32) (result v128) + (func $204 (param $0 i32) (result v128) (i64x2.load32x2_u (local.get $0) ) ) - (func $197 (param $0 v128) (param $1 v128) (result v128) + (func $205 (param $0 v128) (param $1 v128) (result v128) (v8x16.swizzle (local.get $0) (local.get $1) diff --git a/test/spec/simd.wast b/test/spec/simd.wast index 26da927a9a6..4fe9c84e28d 100644 --- a/test/spec/simd.wast +++ b/test/spec/simd.wast @@ -181,6 +181,10 @@ (func (export "f32x4.max") (param $0 v128) (param $1 v128) (result v128) (f32x4.max (local.get $0) (local.get $1))) (func (export "f32x4.pmin") (param $0 v128) (param $1 v128) (result v128) (f32x4.pmin (local.get $0) (local.get $1))) (func (export "f32x4.pmax") (param $0 v128) (param $1 v128) (result v128) (f32x4.pmax (local.get $0) (local.get $1))) + (func (export "f32x4.ceil") (param $0 v128) (result v128) (f32x4.ceil (local.get $0))) + (func (export "f32x4.floor") (param $0 v128) (result v128) (f32x4.floor (local.get $0))) + (func (export "f32x4.trunc") (param $0 v128) (result v128) (f32x4.trunc (local.get $0))) + (func (export "f32x4.nearest") (param $0 v128) (result v128) (f32x4.nearest (local.get $0))) (func (export "f64x2.abs") (param $0 v128) (result v128) (f64x2.abs (local.get $0))) (func (export "f64x2.neg") (param $0 v128) (result v128) (f64x2.neg (local.get $0))) (func (export "f64x2.sqrt") (param $0 v128) (result v128) (f64x2.sqrt (local.get $0))) @@ -194,6 +198,10 @@ (func (export "f64x2.max") (param $0 v128) (param $1 v128) (result v128) (f64x2.max (local.get $0) (local.get $1))) (func (export "f64x2.pmin") (param $0 v128) (param $1 v128) (result v128) (f64x2.pmin (local.get $0) (local.get $1))) (func (export "f64x2.pmax") (param $0 v128) (param $1 v128) (result v128) (f64x2.pmax (local.get $0) (local.get $1))) + (func (export "f64x2.ceil") (param $0 v128) (result v128) (f64x2.ceil (local.get $0))) + (func (export "f64x2.floor") (param $0 v128) (result v128) (f64x2.floor (local.get $0))) + (func (export "f64x2.trunc") (param $0 v128) (result v128) (f64x2.trunc (local.get $0))) + (func (export "f64x2.nearest") (param $0 v128) (result v128) (f64x2.nearest (local.get $0))) (func (export "i32x4.trunc_sat_f32x4_s") (param $0 v128) (result v128) (i32x4.trunc_sat_f32x4_s (local.get $0))) (func (export "i32x4.trunc_sat_f32x4_u") (param $0 v128) (result v128) (i32x4.trunc_sat_f32x4_u (local.get $0))) (func (export "i64x2.trunc_sat_f64x2_s") (param $0 v128) (result v128) (i64x2.trunc_sat_f64x2_s (local.get $0))) @@ -799,6 +807,18 @@ (assert_return (invoke "f32x4.max" (v128.const f32x4 -0 0 nan 5) (v128.const f32x4 0 -0 5 nan)) (v128.const f32x4 0 0 nan nan)) (assert_return (invoke "f32x4.pmin" (v128.const f32x4 -0 0 nan 5) (v128.const f32x4 0 -0 5 nan)) (v128.const f32x4 -0 0 nan 5)) (assert_return (invoke "f32x4.pmax" (v128.const f32x4 -0 0 nan 5) (v128.const f32x4 0 -0 5 nan)) (v128.const f32x4 -0 0 nan 5)) +(assert_return (invoke "f32x4.ceil" (v128.const f32x4 -0 0 infinity -infinity)) (v128.const f32x4 -0 0 infinity -infinity)) +(assert_return (invoke "f32x4.ceil" (v128.const f32x4 nan 42 0.5 -0.5)) (v128.const f32x4 nan 42 1 -0)) +(assert_return (invoke "f32x4.ceil" (v128.const f32x4 1.5 -1.5 4.2 -4.2)) (v128.const f32x4 2 -1 5 -4)) +(assert_return (invoke "f32x4.floor" (v128.const f32x4 -0 0 infinity -infinity)) (v128.const f32x4 -0 0 infinity -infinity)) +(assert_return (invoke "f32x4.floor" (v128.const f32x4 nan 42 0.5 -0.5)) (v128.const f32x4 nan 42 0 -1)) +(assert_return (invoke "f32x4.floor" (v128.const f32x4 1.5 -1.5 4.2 -4.2)) (v128.const f32x4 1 -2 4 -5)) +(assert_return (invoke "f32x4.trunc" (v128.const f32x4 -0 0 infinity -infinity)) (v128.const f32x4 -0 0 infinity -infinity)) +(assert_return (invoke "f32x4.trunc" (v128.const f32x4 nan 42 0.5 -0.5)) (v128.const f32x4 nan 42 0 -0)) +(assert_return (invoke "f32x4.trunc" (v128.const f32x4 1.5 -1.5 4.2 -4.2)) (v128.const f32x4 1 -1 4 -4)) +(assert_return (invoke "f32x4.nearest" (v128.const f32x4 -0 0 infinity -infinity)) (v128.const f32x4 -0 0 infinity -infinity)) +(assert_return (invoke "f32x4.nearest" (v128.const f32x4 nan 42 0.5 -0.5)) (v128.const f32x4 nan 42 0 -0)) +(assert_return (invoke "f32x4.nearest" (v128.const f32x4 1.5 -1.5 4.2 -4.2)) (v128.const f32x4 2 -2 4 -4)) ;; f64x2 arithmetic (assert_return (invoke "f64x2.abs" (v128.const f64x2 -0 nan)) (v128.const f64x2 0 nan)) @@ -824,6 +844,30 @@ (assert_return (invoke "f64x2.pmin" (v128.const f64x2 nan 5) (v128.const f64x2 5 nan)) (v128.const f64x2 nan 5)) (assert_return (invoke "f64x2.pmax" (v128.const f64x2 -0 0) (v128.const f64x2 0 -0)) (v128.const f64x2 -0 0)) (assert_return (invoke "f64x2.pmax" (v128.const f64x2 nan 5) (v128.const f64x2 5 nan)) (v128.const f64x2 nan 5)) +(assert_return (invoke "f64x2.ceil" (v128.const f64x2 -0 0)) (v128.const f64x2 -0 0)) +(assert_return (invoke "f64x2.ceil" (v128.const f64x2 infinity -infinity)) (v128.const f64x2 infinity -infinity)) +(assert_return (invoke "f64x2.ceil" (v128.const f64x2 nan 42)) (v128.const f64x2 nan 42)) +(assert_return (invoke "f64x2.ceil" (v128.const f64x2 0.5 -0.5)) (v128.const f64x2 1 -0)) +(assert_return (invoke "f64x2.ceil" (v128.const f64x2 1.5 -1.5)) (v128.const f64x2 2 -1)) +(assert_return (invoke "f64x2.ceil" (v128.const f64x2 4.2 -4.2)) (v128.const f64x2 5 -4)) +(assert_return (invoke "f64x2.floor" (v128.const f64x2 -0 0)) (v128.const f64x2 -0 0)) +(assert_return (invoke "f64x2.floor" (v128.const f64x2 infinity -infinity)) (v128.const f64x2 infinity -infinity)) +(assert_return (invoke "f64x2.floor" (v128.const f64x2 nan 42)) (v128.const f64x2 nan 42)) +(assert_return (invoke "f64x2.floor" (v128.const f64x2 0.5 -0.5)) (v128.const f64x2 0 -1)) +(assert_return (invoke "f64x2.floor" (v128.const f64x2 1.5 -1.5)) (v128.const f64x2 1 -2)) +(assert_return (invoke "f64x2.floor" (v128.const f64x2 4.2 -4.2)) (v128.const f64x2 4 -5)) +(assert_return (invoke "f64x2.trunc" (v128.const f64x2 -0 0)) (v128.const f64x2 -0 0)) +(assert_return (invoke "f64x2.trunc" (v128.const f64x2 infinity -infinity)) (v128.const f64x2 infinity -infinity)) +(assert_return (invoke "f64x2.trunc" (v128.const f64x2 nan 42)) (v128.const f64x2 nan 42)) +(assert_return (invoke "f64x2.trunc" (v128.const f64x2 0.5 -0.5)) (v128.const f64x2 0 -0)) +(assert_return (invoke "f64x2.trunc" (v128.const f64x2 1.5 -1.5)) (v128.const f64x2 1 -1)) +(assert_return (invoke "f64x2.trunc" (v128.const f64x2 4.2 -4.2)) (v128.const f64x2 4 -4)) +(assert_return (invoke "f64x2.nearest" (v128.const f64x2 -0 0)) (v128.const f64x2 -0 0)) +(assert_return (invoke "f64x2.nearest" (v128.const f64x2 infinity -infinity)) (v128.const f64x2 infinity -infinity)) +(assert_return (invoke "f64x2.nearest" (v128.const f64x2 nan 42)) (v128.const f64x2 nan 42)) +(assert_return (invoke "f64x2.nearest" (v128.const f64x2 0.5 -0.5)) (v128.const f64x2 0 -0)) +(assert_return (invoke "f64x2.nearest" (v128.const f64x2 1.5 -1.5)) (v128.const f64x2 2 -2)) +(assert_return (invoke "f64x2.nearest" (v128.const f64x2 4.2 -4.2)) (v128.const f64x2 4 -4)) ;; conversions (assert_return (invoke "i32x4.trunc_sat_f32x4_s" (v128.const f32x4 42 nan infinity -infinity)) (v128.const i32x4 42 0 2147483647 -2147483648))