summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/literal.cpp11
-rw-r--r--src/wasm/wasm-binary.cpp4
-rw-r--r--src/wasm/wasm-stack.cpp4
-rw-r--r--src/wasm/wasm-validator.cpp1
4 files changed, 20 insertions, 0 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index f4ddf69cc..41d98dea3 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -1829,6 +1829,17 @@ Literal Literal::maxF64x2(const Literal& other) const {
return binary<2, &Literal::getLanesF64x2, &Literal::max>(*this, other);
}
+Literal Literal::dotSI16x8toI32x4(const Literal& other) const {
+ LaneArray<8> lhs = getLanesSI16x8();
+ LaneArray<8> rhs = other.getLanesSI16x8();
+ LaneArray<4> result;
+ for (size_t i = 0; i < 4; ++i) {
+ result[i] = Literal(lhs[i * 2].geti32() * rhs[i * 2].geti32() +
+ lhs[i * 2 + 1].geti32() * rhs[i * 2 + 1].geti32());
+ }
+ return Literal(result);
+}
+
Literal Literal::bitselectV128(const Literal& left,
const Literal& right) const {
return andV128(left).orV128(notV128().andV128(right));
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index cb67d1556..8d6721c9c 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -3939,6 +3939,10 @@ bool WasmBinaryBuilder::maybeVisitSIMDBinary(Expression*& out, uint32_t code) {
curr = allocator.alloc<Binary>();
curr->op = MaxUVecI32x4;
break;
+ case BinaryConsts::I32x4DotSVecI16x8:
+ curr = allocator.alloc<Binary>();
+ curr->op = DotSVecI16x8ToVecI32x4;
+ break;
case BinaryConsts::I64x2Add:
curr = allocator.alloc<Binary>();
curr->op = AddVecI64x2;
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index d4af126b7..c1d4f1222 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -1459,6 +1459,10 @@ void BinaryInstWriter::visitBinary(Binary* curr) {
case MaxUVecI32x4:
o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I32x4MaxU);
break;
+ case DotSVecI16x8ToVecI32x4:
+ o << int8_t(BinaryConsts::SIMDPrefix)
+ << U32LEB(BinaryConsts::I32x4DotSVecI16x8);
+ break;
case AddVecI64x2:
o << int8_t(BinaryConsts::SIMDPrefix) << U32LEB(BinaryConsts::I64x2Add);
break;
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index ed54173ed..82cd6d6f0 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -1361,6 +1361,7 @@ void FunctionValidator::visitBinary(Binary* curr) {
case MinUVecI32x4:
case MaxSVecI32x4:
case MaxUVecI32x4:
+ case DotSVecI16x8ToVecI32x4:
case AddVecI64x2:
case SubVecI64x2:
case AddVecF32x4: