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

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 1807273002: [wasm] Int64Lowering of Int64Mul on ia32 and arm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-phi
Patch Set: Rebase Created 4 years, 9 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 | « src/compiler/x87/instruction-selector-x87.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc
index c68a6ffddd2ba9a978904446f9a123ccae359a5d..2bfe1244beed38b15c6b7cb27fa0073503f3ac2d 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -4328,6 +4328,70 @@ TEST(RunInt32PairSubWithSharedInput) {
TestInt32PairSubWithSharedInput(1, 1, 0, 0);
}
+TEST(RunInt32PairMul) {
+ BufferedRawMachineAssemblerTester<int32_t> m(
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
+ MachineType::Uint32());
+
+ uint32_t high;
+ uint32_t low;
+
+ Node* PairMul = m.Int32PairMul(m.Parameter(0), m.Parameter(1), m.Parameter(2),
+ m.Parameter(3));
+
+ m.StoreToPointer(&low, MachineRepresentation::kWord32,
+ m.Projection(0, PairMul));
+ m.StoreToPointer(&high, MachineRepresentation::kWord32,
+ m.Projection(1, PairMul));
+ m.Return(m.Int32Constant(74));
+
+ FOR_UINT64_INPUTS(i) {
+ FOR_UINT64_INPUTS(j) {
+ m.Call(static_cast<uint32_t>(*i & 0xffffffff),
+ static_cast<uint32_t>(*i >> 32),
+ static_cast<uint32_t>(*j & 0xffffffff),
+ static_cast<uint32_t>(*j >> 32));
+ CHECK_EQ(*i * *j, ToInt64(low, high));
+ }
+ }
+}
+
+void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) {
+ BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
+ MachineType::Uint32());
+
+ uint32_t high;
+ uint32_t low;
+
+ Node* PairMul = m.Int32PairMul(m.Parameter(a), m.Parameter(b), m.Parameter(c),
+ m.Parameter(d));
+
+ m.StoreToPointer(&low, MachineRepresentation::kWord32,
+ m.Projection(0, PairMul));
+ m.StoreToPointer(&high, MachineRepresentation::kWord32,
+ m.Projection(1, PairMul));
+ m.Return(m.Int32Constant(74));
+
+ FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(j) {
+ m.Call(*i, *j);
+ uint32_t inputs[] = {*i, *j};
+ CHECK_EQ(ToInt64(inputs[a], inputs[b]) * ToInt64(inputs[c], inputs[d]),
+ ToInt64(low, high));
+ }
+ }
+}
+
+TEST(RunInt32PairMulWithSharedInput) {
+ TestInt32PairMulWithSharedInput(0, 0, 0, 0);
+ TestInt32PairMulWithSharedInput(1, 0, 0, 0);
+ TestInt32PairMulWithSharedInput(0, 1, 0, 0);
+ TestInt32PairMulWithSharedInput(0, 0, 1, 0);
+ TestInt32PairMulWithSharedInput(0, 0, 0, 1);
+ TestInt32PairMulWithSharedInput(1, 1, 0, 0);
+ TestInt32PairMulWithSharedInput(0, 1, 1, 0);
+}
+
TEST(RunWord32PairShl) {
BufferedRawMachineAssemblerTester<int32_t> m(
MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698