Commit a4d96612 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

[wasm] Fix expected function to match interpreter's function

b % 32 could produce negative results. Therefore, the result
of the shift could be undefined values.

Bug: 
Change-Id: I6c2f7201df424735695aa01891d46523e3c5bd12
Reviewed-on: https://chromium-review.googlesource.com/759079
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49240}
parent 24b26a0c
......@@ -203,11 +203,11 @@ WASM_I32_BINOP_TEST(RemU, uint32_t, b == 0 ? 0xdeadbeef : a % b)
WASM_I32_BINOP_TEST(And, int32_t, a& b)
WASM_I32_BINOP_TEST(Ior, int32_t, a | b)
WASM_I32_BINOP_TEST(Xor, int32_t, a ^ b)
WASM_I32_BINOP_TEST(Shl, int32_t, a << (b % 32))
WASM_I32_BINOP_TEST(ShrU, uint32_t, a >> (b % 32))
WASM_I32_BINOP_TEST(ShrS, int32_t, a >> (b % 32))
WASM_I32_BINOP_TEST(Ror, uint32_t, (a >> (b % 32)) | (a << (32 - (b % 32))))
WASM_I32_BINOP_TEST(Rol, uint32_t, (a << (b % 32)) | (a >> (32 - (b % 32))))
WASM_I32_BINOP_TEST(Shl, int32_t, a << (b & 0x1f))
WASM_I32_BINOP_TEST(ShrU, uint32_t, a >> (b & 0x1f))
WASM_I32_BINOP_TEST(ShrS, int32_t, a >> (b & 0x1f))
WASM_I32_BINOP_TEST(Ror, uint32_t, (a >> (b & 0x1f)) | (a << (32 - (b & 0x1f))))
WASM_I32_BINOP_TEST(Rol, uint32_t, (a << (b & 0x1f)) | (a >> (32 - (b & 0x1f))))
WASM_I32_BINOP_TEST(Eq, int32_t, a == b)
WASM_I32_BINOP_TEST(Ne, int32_t, a != b)
WASM_I32_BINOP_TEST(LtS, int32_t, a < b)
......
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