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 c82cb9fe4f386854aa7bc06ac08781587d923211..db87cd5e5ea7fdbafcf76c7be8b02782c3e7eab3 100644 |
--- a/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc |
+++ b/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc |
@@ -719,6 +719,51 @@ TEST_F(InstructionSelectorTest, Word64ShlWithWord64And) { |
} |
} |
+TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) { |
+ { |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const r = |
+ m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(24)), m.Int32Constant(24)); |
+ m.Return(r); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kMips64Seb, s[0]->arch_opcode()); |
+ ASSERT_EQ(1U, 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())); |
+ } |
+ { |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const r = |
+ m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(16)), m.Int32Constant(16)); |
+ m.Return(r); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kMips64Seh, s[0]->arch_opcode()); |
+ ASSERT_EQ(1U, 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())); |
+ } |
+ { |
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const r = |
+ m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(32)), m.Int32Constant(32)); |
+ 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))); |
+ EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1))); |
+ ASSERT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
+ } |
+} |
// ---------------------------------------------------------------------------- |
// MUL/DIV instructions. |