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

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

Issue 1778893005: [wasm] Int64Lowering of Int64Sub on ia32 and arm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-add
Patch Set: 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
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 13bce4a612540875270900c2088df2684d84c6a8..c55147775ed6d81df03797c2c7335960eafbb2c5 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -4202,6 +4202,7 @@ int64_t ToInt64(uint32_t low, uint32_t high) {
}
#if V8_TARGET_ARCH_32_BIT
+
TEST(RunInt32PairAdd) {
BufferedRawMachineAssemblerTester<int32_t> m(
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
@@ -4264,6 +4265,69 @@ TEST(RunInt32PairAddWithSharedInput) {
TestInt32PairAddWithSharedInput(0, 0, 0, 1);
TestInt32PairAddWithSharedInput(1, 1, 0, 0);
}
+
+TEST(RunInt32PairSub) {
+ BufferedRawMachineAssemblerTester<int32_t> m(
+ MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
+ MachineType::Int32());
+
+ uint32_t high;
+ uint32_t low;
+
+ Node* PairSub = m.Int32PairSub(m.Parameter(0), m.Parameter(1), m.Parameter(2),
+ m.Parameter(3));
+
+ m.StoreToPointer(&low, MachineRepresentation::kWord32,
+ m.Projection(0, PairSub));
+ m.StoreToPointer(&high, MachineRepresentation::kWord32,
+ m.Projection(1, PairSub));
+ m.Return(m.Int32Constant(74));
+
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ m.Call(static_cast<int32_t>(*i & 0xffffffff),
+ static_cast<int32_t>(*i >> 32),
+ static_cast<int32_t>(*j & 0xffffffff),
+ static_cast<int32_t>(*j >> 32));
+ CHECK_EQ(*i - *j, ToInt64(low, high));
+ }
+ }
+}
+
+void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) {
+ BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
+ MachineType::Uint32());
+
+ uint32_t high;
+ uint32_t low;
+
+ Node* PairSub = m.Int32PairSub(m.Parameter(a), m.Parameter(b), m.Parameter(c),
+ m.Parameter(d));
+
+ m.StoreToPointer(&low, MachineRepresentation::kWord32,
+ m.Projection(0, PairSub));
+ m.StoreToPointer(&high, MachineRepresentation::kWord32,
+ m.Projection(1, PairSub));
+ 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(RunInt32PairSubWithSharedInput) {
+ TestInt32PairSubWithSharedInput(0, 0, 0, 0);
+ TestInt32PairSubWithSharedInput(1, 0, 0, 0);
+ TestInt32PairSubWithSharedInput(0, 1, 0, 0);
+ TestInt32PairSubWithSharedInput(0, 0, 1, 0);
+ TestInt32PairSubWithSharedInput(0, 0, 0, 1);
+ TestInt32PairSubWithSharedInput(1, 1, 0, 0);
+}
#endif
TEST(RunDeadChangeFloat64ToInt32) {

Powered by Google App Engine
This is Rietveld 408576698