| 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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 m.Return(n); | 808 m.Return(n); |
| 809 Stream s = m.Build(); | 809 Stream s = m.Build(); |
| 810 ASSERT_EQ(1U, s.size()); | 810 ASSERT_EQ(1U, s.size()); |
| 811 EXPECT_EQ(kMipsClz, s[0]->arch_opcode()); | 811 EXPECT_EQ(kMipsClz, s[0]->arch_opcode()); |
| 812 ASSERT_EQ(1U, s[0]->InputCount()); | 812 ASSERT_EQ(1U, s[0]->InputCount()); |
| 813 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 813 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 814 ASSERT_EQ(1U, s[0]->OutputCount()); | 814 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 815 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 815 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 816 } | 816 } |
| 817 | 817 |
| 818 |
| 819 TEST_F(InstructionSelectorTest, Float32Abs) { |
| 820 StreamBuilder m(this, kMachFloat32, kMachFloat32); |
| 821 Node* const p0 = m.Parameter(0); |
| 822 Node* const n = m.Float32Abs(p0); |
| 823 m.Return(n); |
| 824 Stream s = m.Build(); |
| 825 ASSERT_EQ(1U, s.size()); |
| 826 EXPECT_EQ(kMipsAbsS, s[0]->arch_opcode()); |
| 827 ASSERT_EQ(1U, s[0]->InputCount()); |
| 828 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 829 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 830 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 831 } |
| 832 |
| 833 |
| 834 TEST_F(InstructionSelectorTest, Float64Abs) { |
| 835 StreamBuilder m(this, kMachFloat64, kMachFloat64); |
| 836 Node* const p0 = m.Parameter(0); |
| 837 Node* const n = m.Float64Abs(p0); |
| 838 m.Return(n); |
| 839 Stream s = m.Build(); |
| 840 ASSERT_EQ(1U, s.size()); |
| 841 EXPECT_EQ(kMipsAbsD, s[0]->arch_opcode()); |
| 842 ASSERT_EQ(1U, s[0]->InputCount()); |
| 843 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 844 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 845 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 846 } |
| 847 |
| 818 } // namespace compiler | 848 } // namespace compiler |
| 819 } // namespace internal | 849 } // namespace internal |
| 820 } // namespace v8 | 850 } // namespace v8 |
| OLD | NEW |