| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 ASSERT_EQ(1U, s.size()); | 437 ASSERT_EQ(1U, s.size()); |
| 438 EXPECT_EQ(conv.mi.arch_opcode, s[0]->arch_opcode()); | 438 EXPECT_EQ(conv.mi.arch_opcode, s[0]->arch_opcode()); |
| 439 EXPECT_EQ(1U, s[0]->InputCount()); | 439 EXPECT_EQ(1U, s[0]->InputCount()); |
| 440 EXPECT_EQ(1U, s[0]->OutputCount()); | 440 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, | 443 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
| 444 InstructionSelectorConversionTest, | 444 InstructionSelectorConversionTest, |
| 445 ::testing::ValuesIn(kConversionInstructions)); | 445 ::testing::ValuesIn(kConversionInstructions)); |
| 446 | 446 |
| 447 TEST_F(InstructionSelectorTest, ChangesFromToSmi) { |
| 448 { |
| 449 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 450 m.Return(m.TruncateInt64ToInt32( |
| 451 m.Word64Sar(m.Parameter(0), m.Int32Constant(32)))); |
| 452 Stream s = m.Build(); |
| 453 ASSERT_EQ(1U, s.size()); |
| 454 EXPECT_EQ(kMips64Dsar, s[0]->arch_opcode()); |
| 455 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); |
| 456 ASSERT_EQ(2U, s[0]->InputCount()); |
| 457 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 458 } |
| 459 { |
| 460 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 461 m.Return( |
| 462 m.Word64Shl(m.ChangeInt32ToInt64(m.Parameter(0)), m.Int32Constant(32))); |
| 463 Stream s = m.Build(); |
| 464 ASSERT_EQ(1U, s.size()); |
| 465 EXPECT_EQ(kMips64Dshl, s[0]->arch_opcode()); |
| 466 ASSERT_EQ(2U, s[0]->InputCount()); |
| 467 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 468 } |
| 469 } |
| 470 |
| 447 | 471 |
| 448 // ---------------------------------------------------------------------------- | 472 // ---------------------------------------------------------------------------- |
| 449 // Loads and stores. | 473 // Loads and stores. |
| 450 // ---------------------------------------------------------------------------- | 474 // ---------------------------------------------------------------------------- |
| 451 | 475 |
| 452 | 476 |
| 453 namespace { | 477 namespace { |
| 454 | 478 |
| 455 struct MemoryAccess { | 479 struct MemoryAccess { |
| 456 MachineType type; | 480 MachineType type; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 EXPECT_EQ(kMips64AbsD, s[0]->arch_opcode()); | 866 EXPECT_EQ(kMips64AbsD, s[0]->arch_opcode()); |
| 843 ASSERT_EQ(1U, s[0]->InputCount()); | 867 ASSERT_EQ(1U, s[0]->InputCount()); |
| 844 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 868 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 845 ASSERT_EQ(1U, s[0]->OutputCount()); | 869 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 846 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 870 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 847 } | 871 } |
| 848 | 872 |
| 849 } // namespace compiler | 873 } // namespace compiler |
| 850 } // namespace internal | 874 } // namespace internal |
| 851 } // namespace v8 | 875 } // namespace v8 |
| OLD | NEW |