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

Unified Diff: test/cctest/compiler/test-branch-combine.cc

Issue 1685183003: [turbofan] Fix a bug in the RawMachineAssembler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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-branch-combine.cc
diff --git a/test/cctest/compiler/test-branch-combine.cc b/test/cctest/compiler/test-branch-combine.cc
index c3b4308a93ed275c54630428687f1acc5386e4f3..11395dbe51b710e454ea3a247a9de159477c39d6 100644
--- a/test/cctest/compiler/test-branch-combine.cc
+++ b/test/cctest/compiler/test-branch-combine.cc
@@ -457,6 +457,41 @@ TEST(BranchCombineFloat64Compares) {
}
}
+#if V8_TARGET_ARCH_64_BIT
+TEST(BranchCombineWord64EqualZeroPhi) {
+ // Test combining a branch with a Word64Equal between a phi node and 0.
+ RawMachineAssemblerTester<int32_t> m(MachineType::AnyTagged());
+ uintptr_t something = 0x100000000;
+ uintptr_t null = 0;
+
+ Node* p0 = m.Parameter(0);
+
+ RawMachineLabel is_null, is_not_null, merge;
+ m.Branch(m.IntPtrEqual(p0, m.IntPtrConstant(0)), &is_null, &is_not_null);
+ m.Bind(&is_not_null);
+ Node* val = m.Load(MachineType::AnyTagged(), p0);
+ m.Goto(&merge);
+ m.Bind(&is_null);
+ Node* fail_val = m.IntPtrConstant(0);
+ m.Goto(&merge);
+
+ m.Bind(&merge);
+ Node* phi = m.Phi(MachineRepresentation::kTagged, val, fail_val);
+
+ RawMachineLabel pass, fail;
+ m.Branch(m.IntPtrEqual(phi, m.IntPtrConstant(0)), &pass, &fail);
+ m.Bind(&pass);
+ m.Return(m.Int32Constant(0));
+ m.Bind(&fail);
+ m.Return(m.Int32Constant(1));
+
+ CHECK_EQ(1, m.Call(reinterpret_cast<v8::internal::Object*>(&something)));
+ CHECK_EQ(0, m.Call(reinterpret_cast<v8::internal::Object*>(&null)));
+ CHECK_EQ(0, m.Call(static_cast<v8::internal::Object*>(nullptr)));
+}
+
+#endif
+
} // namespace compiler
} // namespace internal
} // namespace v8
« src/compiler/x64/instruction-selector-x64.cc ('K') | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698