Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 2428443002: [wasm] Trim graph before scheduling. (Closed)
Patch Set: Use proper temp registers if Projection(1) does not exist. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(),
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698