Index: test/unittests/compiler/mips/instruction-selector-mips-unittest.cc |
diff --git a/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc b/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc |
index 3f45a446150571f67eb5ca6a4da3051a12c33944..063225c1afe83b8347423d04a2e0ba64fe890456 100644 |
--- a/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc |
+++ b/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc |
@@ -425,6 +425,32 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { |
} |
+TEST_F(InstructionSelectorTest, Word32AndToClearBits) { |
+ TRACED_FORRANGE(int32_t, shift, 1, 31) { |
+ int32_t mask = ~((1 << shift) - 1); |
+ StreamBuilder m(this, kMachInt32, kMachInt32); |
+ m.Return(m.Word32And(m.Parameter(0), m.Int32Constant(mask))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kMipsIns, s[0]->arch_opcode()); |
+ ASSERT_EQ(3U, s[0]->InputCount()); |
+ EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1))); |
+ EXPECT_EQ(shift, s.ToInt32(s[0]->InputAt(2))); |
+ } |
+ TRACED_FORRANGE(int32_t, shift, 1, 31) { |
+ int32_t mask = ~((1 << shift) - 1); |
+ StreamBuilder m(this, kMachInt32, kMachInt32); |
+ m.Return(m.Word32And(m.Int32Constant(mask), m.Parameter(0))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kMipsIns, s[0]->arch_opcode()); |
+ ASSERT_EQ(3U, s[0]->InputCount()); |
+ EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1))); |
+ EXPECT_EQ(shift, s.ToInt32(s[0]->InputAt(2))); |
+ } |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// MUL/DIV instructions. |
// ---------------------------------------------------------------------------- |