Commit 4ca768db authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd] Indicate possible non-determinism in the interpreter

Bug: chromium:1077198
Change-Id: I74f7afbd2c0d7753ef620e5d5ddee60ee8a16718
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2176892Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67574}
parent e337fc68
......@@ -2286,6 +2286,8 @@ class ThreadImpl {
for (size_t i = 0; i < count; ++i) { \
auto a = s1.val[LANE(i, s1)]; \
auto b = s2.val[LANE(i, s1)]; \
auto result = expr; \
possible_nondeterminism_ |= has_nondeterminism(result); \
res.val[LANE(i, s1)] = expr; \
} \
Push(WasmValue(Simd128(res))); \
......@@ -2365,7 +2367,9 @@ class ThreadImpl {
stype res; \
for (size_t i = 0; i < count; ++i) { \
auto a = s.val[i]; \
res.val[i] = expr; \
auto result = expr; \
possible_nondeterminism_ |= has_nondeterminism(result); \
res.val[i] = result; \
} \
Push(WasmValue(Simd128(res))); \
return true; \
......@@ -2417,7 +2421,9 @@ class ThreadImpl {
for (size_t i = 0; i < count; ++i) { \
auto a = s1.val[i]; \
auto b = s2.val[i]; \
res.val[i] = expr ? -1 : 0; \
auto result = expr; \
possible_nondeterminism_ |= has_nondeterminism(result); \
res.val[i] = result ? -1 : 0; \
} \
Push(WasmValue(Simd128(res))); \
return true; \
......@@ -2560,6 +2566,8 @@ class ThreadImpl {
dst_type res; \
for (size_t i = 0; i < count; ++i) { \
ctype a = s.val[LANE(start_index + i, s)]; \
auto result = expr; \
possible_nondeterminism_ |= has_nondeterminism(result); \
res.val[LANE(i, res)] = expr; \
} \
Push(WasmValue(Simd128(res))); \
......@@ -2636,10 +2644,12 @@ class ThreadImpl {
stype s2 = v2.to_s128().to_##name(); \
stype res; \
for (size_t i = 0; i < count / 2; ++i) { \
res.val[LANE(i, s1)] = \
s1.val[LANE(i * 2, s1)] + s1.val[LANE(i * 2 + 1, s1)]; \
res.val[LANE(i + count / 2, s1)] = \
s2.val[LANE(i * 2, s1)] + s2.val[LANE(i * 2 + 1, s1)]; \
auto result1 = s1.val[LANE(i * 2, s1)] + s1.val[LANE(i * 2 + 1, s1)]; \
possible_nondeterminism_ |= has_nondeterminism(result1); \
res.val[LANE(i, s1)] = result1; \
auto result2 = s2.val[LANE(i * 2, s1)] + s2.val[LANE(i * 2 + 1, s1)]; \
possible_nondeterminism_ |= has_nondeterminism(result2); \
res.val[LANE(i + count / 2, s1)] = result2; \
} \
Push(WasmValue(Simd128(res))); \
return true; \
......
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