| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 m.Return(n); | 839 m.Return(n); |
| 840 Stream s = m.Build(); | 840 Stream s = m.Build(); |
| 841 ASSERT_EQ(1U, s.size()); | 841 ASSERT_EQ(1U, s.size()); |
| 842 EXPECT_EQ(kMipsAbsD, s[0]->arch_opcode()); | 842 EXPECT_EQ(kMipsAbsD, s[0]->arch_opcode()); |
| 843 ASSERT_EQ(1U, s[0]->InputCount()); | 843 ASSERT_EQ(1U, s[0]->InputCount()); |
| 844 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 844 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 845 ASSERT_EQ(1U, s[0]->OutputCount()); | 845 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 846 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 846 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 847 } | 847 } |
| 848 | 848 |
| 849 |
| 850 TEST_F(InstructionSelectorTest, Float32Max) { |
| 851 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32); |
| 852 Node* const p0 = m.Parameter(0); |
| 853 Node* const p1 = m.Parameter(1); |
| 854 Node* const n = m.Float32Max(p0, p1); |
| 855 m.Return(n); |
| 856 Stream s = m.Build(); |
| 857 // Float32Max is `(b < a) ? a : b`. |
| 858 ASSERT_EQ(1U, s.size()); |
| 859 EXPECT_EQ(kMipsFloat32Max, s[0]->arch_opcode()); |
| 860 ASSERT_EQ(2U, s[0]->InputCount()); |
| 861 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 862 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 863 } |
| 864 |
| 865 |
| 866 TEST_F(InstructionSelectorTest, Float32Min) { |
| 867 StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32); |
| 868 Node* const p0 = m.Parameter(0); |
| 869 Node* const p1 = m.Parameter(1); |
| 870 Node* const n = m.Float32Min(p0, p1); |
| 871 m.Return(n); |
| 872 Stream s = m.Build(); |
| 873 // Float32Min is `(a < b) ? a : b`. |
| 874 ASSERT_EQ(1U, s.size()); |
| 875 EXPECT_EQ(kMipsFloat32Min, s[0]->arch_opcode()); |
| 876 ASSERT_EQ(2U, s[0]->InputCount()); |
| 877 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 878 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 879 } |
| 880 |
| 881 |
| 882 TEST_F(InstructionSelectorTest, Float64Max) { |
| 883 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
| 884 Node* const p0 = m.Parameter(0); |
| 885 Node* const p1 = m.Parameter(1); |
| 886 Node* const n = m.Float64Max(p0, p1); |
| 887 m.Return(n); |
| 888 Stream s = m.Build(); |
| 889 // Float64Max is `(b < a) ? a : b`. |
| 890 ASSERT_EQ(1U, s.size()); |
| 891 EXPECT_EQ(kMipsFloat64Max, s[0]->arch_opcode()); |
| 892 ASSERT_EQ(2U, s[0]->InputCount()); |
| 893 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 894 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 895 } |
| 896 |
| 897 |
| 898 TEST_F(InstructionSelectorTest, Float64Min) { |
| 899 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
| 900 Node* const p0 = m.Parameter(0); |
| 901 Node* const p1 = m.Parameter(1); |
| 902 Node* const n = m.Float64Min(p0, p1); |
| 903 m.Return(n); |
| 904 Stream s = m.Build(); |
| 905 // Float64Min is `(a < b) ? a : b`. |
| 906 ASSERT_EQ(1U, s.size()); |
| 907 EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode()); |
| 908 ASSERT_EQ(2U, s[0]->InputCount()); |
| 909 ASSERT_EQ(1U, s[0]->OutputCount()); |
| 910 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 911 } |
| 912 |
| 913 |
| 849 } // namespace compiler | 914 } // namespace compiler |
| 850 } // namespace internal | 915 } // namespace internal |
| 851 } // namespace v8 | 916 } // namespace v8 |
| OLD | NEW |