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 e217bb8e71e09db7e09ac4f5afd08634e2427ced..e28273d3bed2617a021fc9b9e50dba1a19448d4d 100644 |
--- a/test/cctest/wasm/test-run-wasm-64.cc |
+++ b/test/cctest/wasm/test-run-wasm-64.cc |
@@ -136,6 +136,21 @@ WASM_EXEC_TEST(I64Add) { |
} |
} |
+// The i64 add and subtract regression tests need a 64-bit value with a non-zero |
+// upper half. This upper half was clobbering eax, leading to the function |
+// returning 1 rather than 0. |
+const int64_t kHasBit33On = 0x100000000; |
+ |
+WASM_EXEC_TEST(Regress5800_Add) { |
+ REQUIRE(I64Add); |
+ WasmRunner<int32_t> r(execution_mode); |
+ BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_ADD( |
+ WASM_I64V(0), WASM_I64V(kHasBit33On)))), |
+ WASM_RETURN1(WASM_I32V(0))), |
+ WASM_I32V(0)); |
+ CHECK_EQ(0, r.Call()); |
+} |
+ |
WASM_EXEC_TEST(I64Sub) { |
REQUIRE(I64Sub); |
WasmRunner<int64_t, int64_t, int64_t> r(execution_mode); |
@@ -145,6 +160,16 @@ WASM_EXEC_TEST(I64Sub) { |
} |
} |
+WASM_EXEC_TEST(Regress5800_Sub) { |
+ REQUIRE(I64Sub); |
+ WasmRunner<int32_t> r(execution_mode); |
+ BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_SUB( |
+ WASM_I64V(0), WASM_I64V(kHasBit33On)))), |
+ WASM_RETURN1(WASM_I32V(0))), |
+ WASM_I32V(0)); |
+ CHECK_EQ(0, r.Call()); |
+} |
+ |
WASM_EXEC_TEST(I64AddUseOnlyLowWord) { |
REQUIRE(I64Add); |
REQUIRE(I32ConvertI64); |