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