Index: test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc |
diff --git a/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc b/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc |
index 8c0c3b18beed3baa9dc54d2efab3266da63cc471..bc691fc602b1ea1643e41fce93d9cd176fb46c4b 100644 |
--- a/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc |
+++ b/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc |
@@ -622,6 +622,44 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { |
} |
+TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { |
+ TRACED_FORRANGE(int32_t, shift, 0, 30) { |
+ StreamBuilder m(this, kMachInt32, kMachInt32); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const r = |
+ m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)), |
+ m.Int32Constant(shift + 1)); |
+ m.Return(r); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kMips64Shl, s[0]->arch_opcode()); |
+ ASSERT_EQ(2U, s[0]->InputCount()); |
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
+ ASSERT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
+ } |
+} |
+ |
+ |
+TEST_F(InstructionSelectorTest, Word64ShlWithWord64And) { |
+ TRACED_FORRANGE(int32_t, shift, 0, 62) { |
+ StreamBuilder m(this, kMachInt64, kMachInt64); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const r = |
+ m.Word64Shl(m.Word64And(p0, m.Int64Constant((1L << (63 - shift)) - 1)), |
+ m.Int64Constant(shift + 1)); |
+ m.Return(r); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kMips64Dshl, s[0]->arch_opcode()); |
+ ASSERT_EQ(2U, s[0]->InputCount()); |
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
+ ASSERT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
+ } |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// MUL/DIV instructions. |
// ---------------------------------------------------------------------------- |