Index: test/cctest/wasm/test-run-wasm-64.cc |
diff --git a/test/cctest/wasm/test-run-wasm-64.cc b/test/cctest/wasm/test-run-wasm-64.cc |
index b65e7f1a7db56095f08e0952fbfb3189231feb7e..02e521fffad951c5c948f767f6667cfb80bc6d05 100644 |
--- a/test/cctest/wasm/test-run-wasm-64.cc |
+++ b/test/cctest/wasm/test-run-wasm-64.cc |
@@ -147,6 +147,93 @@ WASM_EXEC_TEST(I64Sub) { |
} |
} |
+WASM_EXEC_TEST(I64AddUseOnlyLowWord) { |
+ REQUIRE(I64Add); |
+ REQUIRE(I32ConvertI64); |
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), |
+ MachineType::Int64()); |
+ BUILD(r, WASM_I32_CONVERT_I64( |
+ WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); |
+ FOR_INT64_INPUTS(i) { |
+ FOR_INT64_INPUTS(j) { |
+ CHECK_EQ(static_cast<int32_t>(*i + *j), r.Call(*i, *j)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_TEST(I64SubUseOnlyLowWord) { |
+ REQUIRE(I64Sub); |
+ REQUIRE(I32ConvertI64); |
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), |
+ MachineType::Int64()); |
+ BUILD(r, WASM_I32_CONVERT_I64( |
+ WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); |
+ FOR_INT64_INPUTS(i) { |
+ FOR_INT64_INPUTS(j) { |
+ CHECK_EQ(static_cast<int32_t>(*i - *j), r.Call(*i, *j)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_TEST(I64MulUseOnlyLowWord) { |
+ REQUIRE(I64Mul); |
+ REQUIRE(I32ConvertI64); |
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), |
+ MachineType::Int64()); |
+ BUILD(r, WASM_I32_CONVERT_I64( |
+ WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); |
+ FOR_INT64_INPUTS(i) { |
+ FOR_INT64_INPUTS(j) { |
+ CHECK_EQ(static_cast<int32_t>(*i * *j), r.Call(*i, *j)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_TEST(I64ShlUseOnlyLowWord) { |
+ REQUIRE(I64Shl); |
+ REQUIRE(I32ConvertI64); |
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), |
+ MachineType::Int64()); |
+ BUILD(r, WASM_I32_CONVERT_I64( |
+ WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); |
+ FOR_INT64_INPUTS(i) { |
+ FOR_INT64_INPUTS(j) { |
+ uint64_t expected = static_cast<int32_t>((*i) << (*j & 0x3f)); |
+ CHECK_EQ(expected, r.Call(*i, *j)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_TEST(I64ShrUseOnlyLowWord) { |
+ REQUIRE(I64ShrU); |
+ REQUIRE(I32ConvertI64); |
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), |
+ MachineType::Int64()); |
+ BUILD(r, WASM_I32_CONVERT_I64( |
+ WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); |
+ FOR_UINT64_INPUTS(i) { |
+ FOR_UINT64_INPUTS(j) { |
+ uint64_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); |
+ CHECK_EQ(expected, r.Call(*i, *j)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_TEST(I64SarUseOnlyLowWord) { |
+ REQUIRE(I64ShrS); |
+ REQUIRE(I32ConvertI64); |
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), |
+ MachineType::Int64()); |
+ BUILD(r, WASM_I32_CONVERT_I64( |
+ WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); |
+ FOR_INT64_INPUTS(i) { |
+ FOR_INT64_INPUTS(j) { |
+ uint64_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); |
+ CHECK_EQ(expected, r.Call(*i, *j)); |
+ } |
+ } |
+} |
+ |
WASM_EXEC_TEST(I64DivS) { |
REQUIRE(I64DivS); |
WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), |