Index: test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
diff --git a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
index 3ed52e0ba7f6182351ece11e358badbc06a22b6b..3e36d202e61da628f577b19d09dc019da6c4340f 100644 |
--- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
+++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
@@ -2429,6 +2429,40 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32Shl) { |
} |
+TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { |
+ TRACED_FORRANGE(int32_t, shift, 1, 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)); |
+ m.Return(r); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kArm64Ubfiz32, s[0]->arch_opcode()); |
+ ASSERT_EQ(3U, 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())); |
+ } |
+ 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(kArm64Lsl32, 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, Word32Clz) { |
StreamBuilder m(this, kMachUint32, kMachUint32); |
Node* const p0 = m.Parameter(0); |