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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // ---------------------------------------------------------------------------- | 313 // ---------------------------------------------------------------------------- |
314 typedef InstructionSelectorTestWithParam<IntCmp> InstructionSelectorCmpTest; | 314 typedef InstructionSelectorTestWithParam<IntCmp> InstructionSelectorCmpTest; |
315 | 315 |
316 | 316 |
317 TEST_P(InstructionSelectorCmpTest, Parameter) { | 317 TEST_P(InstructionSelectorCmpTest, Parameter) { |
318 const IntCmp cmp = GetParam(); | 318 const IntCmp cmp = GetParam(); |
319 const MachineType type = cmp.mi.machine_type; | 319 const MachineType type = cmp.mi.machine_type; |
320 StreamBuilder m(this, type, type, type); | 320 StreamBuilder m(this, type, type, type); |
321 m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Parameter(1))); | 321 m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Parameter(1))); |
322 Stream s = m.Build(); | 322 Stream s = m.Build(); |
323 ASSERT_EQ(cmp.expected_size, s.size()); | 323 |
324 EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode()); | 324 if (FLAG_debug_code && |
325 EXPECT_EQ(2U, s[0]->InputCount()); | 325 type.representation() == MachineRepresentation::kWord32) { |
326 EXPECT_EQ(1U, s[0]->OutputCount()); | 326 ASSERT_EQ(6, s.size()); |
| 327 |
| 328 EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode()); |
| 329 EXPECT_EQ(2U, s[0]->InputCount()); |
| 330 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 331 |
| 332 EXPECT_EQ(kMips64Dshl, s[1]->arch_opcode()); |
| 333 EXPECT_EQ(2U, s[1]->InputCount()); |
| 334 EXPECT_EQ(1U, s[1]->OutputCount()); |
| 335 |
| 336 EXPECT_EQ(kMips64Dshl, s[2]->arch_opcode()); |
| 337 EXPECT_EQ(2U, s[2]->InputCount()); |
| 338 EXPECT_EQ(1U, s[2]->OutputCount()); |
| 339 |
| 340 EXPECT_EQ(cmp.mi.arch_opcode, s[3]->arch_opcode()); |
| 341 EXPECT_EQ(2U, s[3]->InputCount()); |
| 342 EXPECT_EQ(1U, s[3]->OutputCount()); |
| 343 |
| 344 EXPECT_EQ(kMips64AssertEqual, s[4]->arch_opcode()); |
| 345 EXPECT_EQ(3U, s[4]->InputCount()); |
| 346 EXPECT_EQ(0U, s[4]->OutputCount()); |
| 347 |
| 348 EXPECT_EQ(cmp.mi.arch_opcode, s[5]->arch_opcode()); |
| 349 EXPECT_EQ(2U, s[5]->InputCount()); |
| 350 EXPECT_EQ(1U, s[5]->OutputCount()); |
| 351 } else { |
| 352 ASSERT_EQ(cmp.expected_size, s.size()); |
| 353 EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode()); |
| 354 EXPECT_EQ(2U, s[0]->InputCount()); |
| 355 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 356 } |
327 } | 357 } |
328 | 358 |
329 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorCmpTest, | 359 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorCmpTest, |
330 ::testing::ValuesIn(kCmpInstructions)); | 360 ::testing::ValuesIn(kCmpInstructions)); |
331 | 361 |
332 // ---------------------------------------------------------------------------- | 362 // ---------------------------------------------------------------------------- |
333 // Shift instructions. | 363 // Shift instructions. |
334 // ---------------------------------------------------------------------------- | 364 // ---------------------------------------------------------------------------- |
335 typedef InstructionSelectorTestWithParam<MachInst2> | 365 typedef InstructionSelectorTestWithParam<MachInst2> |
336 InstructionSelectorShiftTest; | 366 InstructionSelectorShiftTest; |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 ASSERT_EQ(1U, s.size()); | 1791 ASSERT_EQ(1U, s.size()); |
1762 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode()); | 1792 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode()); |
1763 ASSERT_EQ(2U, s[0]->InputCount()); | 1793 ASSERT_EQ(2U, s[0]->InputCount()); |
1764 ASSERT_EQ(1U, s[0]->OutputCount()); | 1794 ASSERT_EQ(1U, s[0]->OutputCount()); |
1765 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 1795 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
1766 } | 1796 } |
1767 | 1797 |
1768 } // namespace compiler | 1798 } // namespace compiler |
1769 } // namespace internal | 1799 } // namespace internal |
1770 } // namespace v8 | 1800 } // namespace v8 |
OLD | NEW |