Commit 138b49c2 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

[wasm-simd] Fix endianness issue on BitMask interpreter

Change-Id: I92223e6b42a3ab80d0f0a4dab4dc20d7d7f1a6ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2220329Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#68057}
parent 9e2608a0
...@@ -2357,17 +2357,17 @@ class ThreadImpl { ...@@ -2357,17 +2357,17 @@ class ThreadImpl {
// Cast to double in call to signbit is due to MSCV issue, see // Cast to double in call to signbit is due to MSCV issue, see
// https://github.com/microsoft/STL/issues/519. // https://github.com/microsoft/STL/issues/519.
#define BITMASK_CASE(op, name, stype, count) \ #define BITMASK_CASE(op, name, stype, count) \
case kExpr##op: { \ case kExpr##op: { \
WasmValue v = Pop(); \ WasmValue v = Pop(); \
stype s = v.to_s128().to_##name(); \ stype s = v.to_s128().to_##name(); \
int32_t res = 0; \ int32_t res = 0; \
for (size_t i = 0; i < count; ++i) { \ for (size_t i = 0; i < count; ++i) { \
bool sign = std::signbit(static_cast<double>(s.val[i])); \ bool sign = std::signbit(static_cast<double>(s.val[LANE(i, s)])); \
res |= (sign << i); \ res |= (sign << i); \
} \ } \
Push(WasmValue(res)); \ Push(WasmValue(res)); \
return true; \ return true; \
} }
BITMASK_CASE(I8x16BitMask, i8x16, int16, 16) BITMASK_CASE(I8x16BitMask, i8x16, int16, 16)
BITMASK_CASE(I16x8BitMask, i16x8, int8, 8) BITMASK_CASE(I16x8BitMask, i16x8, int8, 8)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment