| Index: src/compiler/x64/instruction-selector-x64-unittest.cc
|
| diff --git a/src/compiler/x64/instruction-selector-x64-unittest.cc b/src/compiler/x64/instruction-selector-x64-unittest.cc
|
| index 22f0bce6a089033f0a1c3ec8c6cdddb1887aec15..814c2592da9d0dcf522488dabea8c3f5956ad19b 100644
|
| --- a/src/compiler/x64/instruction-selector-x64-unittest.cc
|
| +++ b/src/compiler/x64/instruction-selector-x64-unittest.cc
|
| @@ -40,6 +40,39 @@ TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
|
|
|
|
|
| // -----------------------------------------------------------------------------
|
| +// Better left operand for commutative binops
|
| +
|
| +TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) {
|
| + StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
| + Node* param1 = m.Parameter(0);
|
| + Node* param2 = m.Parameter(1);
|
| + Node* add = m.Int32Add(param1, param2);
|
| + m.Return(m.Int32Add(add, param1));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(2U, s.size());
|
| + EXPECT_EQ(kX64Add32, s[0]->arch_opcode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_TRUE(s[0]->InputAt(0)->IsUnallocated());
|
| + EXPECT_EQ(param2->id(), s.ToVreg(s[0]->InputAt(0)));
|
| +}
|
| +
|
| +
|
| +TEST_F(InstructionSelectorTest, BetterLeftOperandTestMulBinop) {
|
| + StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
| + Node* param1 = m.Parameter(0);
|
| + Node* param2 = m.Parameter(1);
|
| + Node* mul = m.Int32Mul(param1, param2);
|
| + m.Return(m.Int32Mul(mul, param1));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(2U, s.size());
|
| + EXPECT_EQ(kX64Imul32, s[0]->arch_opcode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_TRUE(s[0]->InputAt(0)->IsUnallocated());
|
| + EXPECT_EQ(param2->id(), s.ToVreg(s[0]->InputAt(0)));
|
| +}
|
| +
|
| +
|
| +// -----------------------------------------------------------------------------
|
| // Loads and stores
|
|
|
| namespace {
|
|
|