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 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 EXPECT_EQ(kX64Shl, s[0]->arch_opcode()); | 865 EXPECT_EQ(kX64Shl, s[0]->arch_opcode()); |
866 ASSERT_EQ(2U, s[0]->InputCount()); | 866 ASSERT_EQ(2U, s[0]->InputCount()); |
867 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 867 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
868 EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1))); | 868 EXPECT_EQ(x, s.ToInt32(s[0]->InputAt(1))); |
869 ASSERT_EQ(1U, s[0]->OutputCount()); | 869 ASSERT_EQ(1U, s[0]->OutputCount()); |
870 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output())); | 870 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output())); |
871 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 871 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
872 } | 872 } |
873 } | 873 } |
874 | 874 |
| 875 |
| 876 TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
| 877 { |
| 878 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
| 879 Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); |
| 880 Node* mul = m.Float64Mul(add, m.Parameter(1)); |
| 881 Node* sub = m.Float64Sub(mul, add); |
| 882 Node* ret = m.Float64Div(mul, sub); |
| 883 m.Return(ret); |
| 884 Stream s = m.Build(AVX); |
| 885 ASSERT_EQ(4U, s.size()); |
| 886 EXPECT_EQ(kAVXFloat64Add, s[0]->arch_opcode()); |
| 887 EXPECT_EQ(kAVXFloat64Mul, s[1]->arch_opcode()); |
| 888 EXPECT_EQ(kAVXFloat64Sub, s[2]->arch_opcode()); |
| 889 EXPECT_EQ(kAVXFloat64Div, s[3]->arch_opcode()); |
| 890 } |
| 891 { |
| 892 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
| 893 Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); |
| 894 Node* mul = m.Float64Mul(add, m.Parameter(1)); |
| 895 Node* sub = m.Float64Sub(mul, add); |
| 896 Node* ret = m.Float64Div(mul, sub); |
| 897 m.Return(ret); |
| 898 Stream s = m.Build(); |
| 899 ASSERT_EQ(4U, s.size()); |
| 900 EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode()); |
| 901 EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode()); |
| 902 EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode()); |
| 903 EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode()); |
| 904 } |
| 905 } |
| 906 |
875 } // namespace compiler | 907 } // namespace compiler |
876 } // namespace internal | 908 } // namespace internal |
877 } // namespace v8 | 909 } // namespace v8 |
OLD | NEW |