diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/literal.h | 1 | ||||
-rw-r--r-- | src/wasm-interpreter.h | 2 | ||||
-rw-r--r-- | src/wasm/literal.cpp | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/literal.h b/src/literal.h index 1dd013c4c..965ec157c 100644 --- a/src/literal.h +++ b/src/literal.h @@ -570,6 +570,7 @@ public: Literal extMulHighUI32x4(const Literal& other) const; Literal absI64x2() const; Literal negI64x2() const; + Literal bitmaskI64x2() const; Literal allTrueI64x2() const; Literal shlI64x2(const Literal& other) const; Literal shrSI64x2(const Literal& other) const; diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 77b055fd1..8870e24dd 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -500,7 +500,7 @@ public: case AllTrueVecI64x2: return value.allTrueI64x2(); case BitmaskVecI64x2: - WASM_UNREACHABLE("unimp"); + return value.bitmaskI64x2(); case AbsVecF32x4: return value.absF32x4(); case NegVecF32x4: diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 151ea83e5..c3a2ddf7a 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -1868,6 +1868,16 @@ Literal Literal::bitmaskI32x4() const { Literal Literal::allTrueI64x2() const { return all_true<2, &Literal::getLanesI64x2>(*this); } +Literal Literal::bitmaskI64x2() const { + uint32_t result = 0; + LaneArray<2> lanes = getLanesI64x2(); + for (size_t i = 0; i < 2; ++i) { + if (lanes[i].geti64() & (1ll << 63)) { + result = result | (1 << i); + } + } + return Literal(result); +} template<int Lanes, LaneArray<Lanes> (Literal::*IntoLanes)() const, |