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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 ASSERT_EQ(1U, s.size()); | 329 ASSERT_EQ(1U, s.size()); |
330 EXPECT_EQ(kMipsExt, s[0]->arch_opcode()); | 330 EXPECT_EQ(kMipsExt, s[0]->arch_opcode()); |
331 ASSERT_EQ(3U, s[0]->InputCount()); | 331 ASSERT_EQ(3U, s[0]->InputCount()); |
332 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); | 332 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); |
333 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); | 333 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); |
334 } | 334 } |
335 } | 335 } |
336 } | 336 } |
337 | 337 |
338 | 338 |
| 339 TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) { |
| 340 TRACED_FORRANGE(int32_t, shift, 0, 30) { |
| 341 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 342 Node* const p0 = m.Parameter(0); |
| 343 Node* const r = |
| 344 m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)), |
| 345 m.Int32Constant(shift + 1)); |
| 346 m.Return(r); |
| 347 Stream s = m.Build(); |
| 348 ASSERT_EQ(1U, s.size()); |
| 349 EXPECT_EQ(kMipsShl, s[0]->arch_opcode()); |
| 350 ASSERT_EQ(2U, s[0]->InputCount()); |
| 351 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 352 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 353 EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); |
| 354 } |
| 355 } |
| 356 |
| 357 |
339 // ---------------------------------------------------------------------------- | 358 // ---------------------------------------------------------------------------- |
340 // Logical instructions. | 359 // Logical instructions. |
341 // ---------------------------------------------------------------------------- | 360 // ---------------------------------------------------------------------------- |
342 | 361 |
343 | 362 |
344 typedef InstructionSelectorTestWithParam<MachInst2> | 363 typedef InstructionSelectorTestWithParam<MachInst2> |
345 InstructionSelectorLogicalTest; | 364 InstructionSelectorLogicalTest; |
346 | 365 |
347 | 366 |
348 TEST_P(InstructionSelectorLogicalTest, Parameter) { | 367 TEST_P(InstructionSelectorLogicalTest, Parameter) { |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode()); | 1076 EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode()); |
1058 ASSERT_EQ(2U, s[0]->InputCount()); | 1077 ASSERT_EQ(2U, s[0]->InputCount()); |
1059 ASSERT_EQ(1U, s[0]->OutputCount()); | 1078 ASSERT_EQ(1U, s[0]->OutputCount()); |
1060 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 1079 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
1061 } | 1080 } |
1062 | 1081 |
1063 | 1082 |
1064 } // namespace compiler | 1083 } // namespace compiler |
1065 } // namespace internal | 1084 } // namespace internal |
1066 } // namespace v8 | 1085 } // namespace v8 |
OLD | NEW |