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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "test/unittests/compiler/instruction-selector-unittest.h" | 7 #include "test/unittests/compiler/instruction-selector-unittest.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 ASSERT_EQ(1U, s[0]->OutputCount()); | 1672 ASSERT_EQ(1U, s[0]->OutputCount()); |
1673 EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->OutputAt(0))); | 1673 EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->OutputAt(0))); |
1674 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); | 1674 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
1675 } | 1675 } |
1676 | 1676 |
1677 | 1677 |
1678 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFAITest, | 1678 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFAITest, |
1679 ::testing::ValuesIn(kFAIs)); | 1679 ::testing::ValuesIn(kFAIs)); |
1680 | 1680 |
1681 | 1681 |
| 1682 TEST_F(InstructionSelectorTest, Float32Abs) { |
| 1683 StreamBuilder m(this, kMachFloat32, kMachFloat32); |
| 1684 Node* const p0 = m.Parameter(0); |
| 1685 Node* const n = m.Float32Abs(p0); |
| 1686 m.Return(n); |
| 1687 Stream s = m.Build(); |
| 1688 ASSERT_EQ(1U, s.size()); |
| 1689 EXPECT_EQ(kArmVabsF32, s[0]->arch_opcode()); |
| 1690 ASSERT_EQ(1U, s[0]->InputCount()); |
| 1691 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 1692 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 1693 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 1694 } |
| 1695 |
| 1696 |
| 1697 TEST_F(InstructionSelectorTest, Float64Abs) { |
| 1698 StreamBuilder m(this, kMachFloat64, kMachFloat64); |
| 1699 Node* const p0 = m.Parameter(0); |
| 1700 Node* const n = m.Float64Abs(p0); |
| 1701 m.Return(n); |
| 1702 Stream s = m.Build(); |
| 1703 ASSERT_EQ(1U, s.size()); |
| 1704 EXPECT_EQ(kArmVabsF64, s[0]->arch_opcode()); |
| 1705 ASSERT_EQ(1U, s[0]->InputCount()); |
| 1706 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 1707 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 1708 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 1709 } |
| 1710 |
| 1711 |
1682 TEST_F(InstructionSelectorTest, Float32AddWithFloat32Mul) { | 1712 TEST_F(InstructionSelectorTest, Float32AddWithFloat32Mul) { |
1683 { | 1713 { |
1684 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32, | 1714 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32, |
1685 kMachFloat32); | 1715 kMachFloat32); |
1686 Node* const p0 = m.Parameter(0); | 1716 Node* const p0 = m.Parameter(0); |
1687 Node* const p1 = m.Parameter(1); | 1717 Node* const p1 = m.Parameter(1); |
1688 Node* const p2 = m.Parameter(2); | 1718 Node* const p2 = m.Parameter(2); |
1689 Node* const n = m.Float32Add(m.Float32Mul(p0, p1), p2); | 1719 Node* const n = m.Float32Add(m.Float32Mul(p0, p1), p2); |
1690 m.Return(n); | 1720 m.Return(n); |
1691 Stream s = m.Build(); | 1721 Stream s = m.Build(); |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 EXPECT_EQ(kArmClz, s[0]->arch_opcode()); | 2770 EXPECT_EQ(kArmClz, s[0]->arch_opcode()); |
2741 ASSERT_EQ(1U, s[0]->InputCount()); | 2771 ASSERT_EQ(1U, s[0]->InputCount()); |
2742 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 2772 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
2743 ASSERT_EQ(1U, s[0]->OutputCount()); | 2773 ASSERT_EQ(1U, s[0]->OutputCount()); |
2744 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 2774 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
2745 } | 2775 } |
2746 | 2776 |
2747 } // namespace compiler | 2777 } // namespace compiler |
2748 } // namespace internal | 2778 } // namespace internal |
2749 } // namespace v8 | 2779 } // namespace v8 |
OLD | NEW |