OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/unittests/compiler/instruction-selector-unittest.h" | 5 #include "test/unittests/compiler/instruction-selector-unittest.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 2122 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
2123 ASSERT_EQ(1U, s[0]->OutputCount()); | 2123 ASSERT_EQ(1U, s[0]->OutputCount()); |
2124 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode()); | 2124 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode()); |
2125 ASSERT_EQ(2U, s[1]->InputCount()); | 2125 ASSERT_EQ(2U, s[1]->InputCount()); |
2126 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); | 2126 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); |
2127 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1))); | 2127 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1))); |
2128 ASSERT_EQ(1U, s[1]->OutputCount()); | 2128 ASSERT_EQ(1U, s[1]->OutputCount()); |
2129 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); | 2129 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); |
2130 } | 2130 } |
2131 | 2131 |
| 2132 |
| 2133 TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) { |
| 2134 { |
| 2135 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 2136 Node* const p0 = m.Parameter(0); |
| 2137 Node* const r = |
| 2138 m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(24)), m.Int32Constant(24)); |
| 2139 m.Return(r); |
| 2140 Stream s = m.Build(); |
| 2141 ASSERT_EQ(1U, s.size()); |
| 2142 EXPECT_EQ(kArm64Sxtb32, s[0]->arch_opcode()); |
| 2143 ASSERT_EQ(1U, s[0]->InputCount()); |
| 2144 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 2145 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 2146 EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
| 2147 } |
| 2148 { |
| 2149 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 2150 Node* const p0 = m.Parameter(0); |
| 2151 Node* const r = |
| 2152 m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(16)), m.Int32Constant(16)); |
| 2153 m.Return(r); |
| 2154 Stream s = m.Build(); |
| 2155 ASSERT_EQ(1U, s.size()); |
| 2156 EXPECT_EQ(kArm64Sxth32, s[0]->arch_opcode()); |
| 2157 ASSERT_EQ(1U, s[0]->InputCount()); |
| 2158 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 2159 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 2160 EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
| 2161 } |
| 2162 } |
| 2163 |
2132 } // namespace compiler | 2164 } // namespace compiler |
2133 } // namespace internal | 2165 } // namespace internal |
2134 } // namespace v8 | 2166 } // namespace v8 |
OLD | NEW |