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

Unified Diff: test/unittests/compiler/x64/instruction-selector-x64-unittest.cc

Issue 756643002: [turbofan] Fix lea matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unit test & fix Created 6 years, 1 month 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/mjsunit/regress/regress-lea-matching.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
diff --git a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
index f1293f0fa622dd810db950ea4d61f9e5e04d282d..6faa6ba975d86a17d998c579ea7766c69dc3e4d8 100644
--- a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
+++ b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
@@ -741,6 +741,31 @@ TEST_F(InstructionSelectorTest, Int32SubConstantAsLea) {
}
+TEST_F(InstructionSelectorTest, Int32AddScaled2Other) {
+ StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32, kMachInt32);
+ Node* const p0 = m.Parameter(0);
+ Node* const p1 = m.Parameter(1);
+ Node* const p2 = m.Parameter(2);
+ Node* const s0 = m.Int32Mul(p1, m.Int32Constant(2));
+ Node* const a0 = m.Int32Add(s0, p2);
+ Node* const a1 = m.Int32Add(p0, a0);
+ m.Return(a1);
+ Stream s = m.Build();
+ ASSERT_EQ(2U, s.size());
+ EXPECT_EQ(kX64Lea32, s[0]->arch_opcode());
+ EXPECT_EQ(kMode_MR2, s[0]->addressing_mode());
+ ASSERT_EQ(2U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(0)));
+ EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
+ EXPECT_EQ(s.ToVreg(a0), s.ToVreg(s[0]->OutputAt(0)));
+ ASSERT_EQ(2U, s[1]->InputCount());
+ EXPECT_EQ(kX64Add32, s[1]->arch_opcode());
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[1]->InputAt(0)));
+ EXPECT_EQ(s.ToVreg(a0), s.ToVreg(s[1]->InputAt(1)));
+ EXPECT_EQ(s.ToVreg(a1), s.ToVreg(s[1]->OutputAt(0)));
+}
+
+
// -----------------------------------------------------------------------------
// Multiplication.
« no previous file with comments | « test/mjsunit/regress/regress-lea-matching.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698