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 { |
11 namespace compiler { | 11 namespace compiler { |
12 | 12 |
13 // ----------------------------------------------------------------------------- | 13 // ----------------------------------------------------------------------------- |
14 // Conversions. | 14 // Conversions. |
15 | 15 |
16 | 16 |
17 TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { | 17 TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { |
18 StreamBuilder m(this, kMachFloat32, kMachFloat64); | 18 StreamBuilder m(this, kMachFloat32, kMachFloat64); |
19 m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); | 19 m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); |
20 Stream s = m.Build(); | 20 Stream s = m.Build(); |
21 ASSERT_EQ(1U, s.size()); | 21 ASSERT_EQ(1U, s.size()); |
22 EXPECT_EQ(kSSECvtss2sd, s[0]->arch_opcode()); | 22 EXPECT_EQ(kSSEFloat32ToFloat64, s[0]->arch_opcode()); |
23 EXPECT_EQ(1U, s[0]->InputCount()); | 23 EXPECT_EQ(1U, s[0]->InputCount()); |
24 EXPECT_EQ(1U, s[0]->OutputCount()); | 24 EXPECT_EQ(1U, s[0]->OutputCount()); |
25 } | 25 } |
26 | 26 |
27 | 27 |
28 TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) { | 28 TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) { |
29 StreamBuilder m(this, kMachInt64, kMachInt32); | 29 StreamBuilder m(this, kMachInt64, kMachInt32); |
30 m.Return(m.ChangeInt32ToInt64(m.Parameter(0))); | 30 m.Return(m.ChangeInt32ToInt64(m.Parameter(0))); |
31 Stream s = m.Build(); | 31 Stream s = m.Build(); |
32 ASSERT_EQ(1U, s.size()); | 32 ASSERT_EQ(1U, s.size()); |
(...skipping 17 matching lines...) Expand all Loading... |
50 ASSERT_EQ(1U, s.size()); | 50 ASSERT_EQ(1U, s.size()); |
51 EXPECT_EQ(kX64Movl, s[0]->arch_opcode()); | 51 EXPECT_EQ(kX64Movl, s[0]->arch_opcode()); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { | 55 TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { |
56 StreamBuilder m(this, kMachFloat64, kMachFloat32); | 56 StreamBuilder m(this, kMachFloat64, kMachFloat32); |
57 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); | 57 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); |
58 Stream s = m.Build(); | 58 Stream s = m.Build(); |
59 ASSERT_EQ(1U, s.size()); | 59 ASSERT_EQ(1U, s.size()); |
60 EXPECT_EQ(kSSECvtsd2ss, s[0]->arch_opcode()); | 60 EXPECT_EQ(kSSEFloat64ToFloat32, s[0]->arch_opcode()); |
61 EXPECT_EQ(1U, s[0]->InputCount()); | 61 EXPECT_EQ(1U, s[0]->InputCount()); |
62 EXPECT_EQ(1U, s[0]->OutputCount()); | 62 EXPECT_EQ(1U, s[0]->OutputCount()); |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) { | 66 TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) { |
67 StreamBuilder m(this, kMachInt32, kMachInt64); | 67 StreamBuilder m(this, kMachInt32, kMachInt64); |
68 m.Return(m.TruncateInt64ToInt32(m.Parameter(0))); | 68 m.Return(m.TruncateInt64ToInt32(m.Parameter(0))); |
69 Stream s = m.Build(); | 69 Stream s = m.Build(); |
70 ASSERT_EQ(1U, s.size()); | 70 ASSERT_EQ(1U, s.size()); |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode()); | 1157 EXPECT_EQ(kX64Lzcnt32, s[0]->arch_opcode()); |
1158 ASSERT_EQ(1U, s[0]->InputCount()); | 1158 ASSERT_EQ(1U, s[0]->InputCount()); |
1159 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 1159 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
1160 ASSERT_EQ(1U, s[0]->OutputCount()); | 1160 ASSERT_EQ(1U, s[0]->OutputCount()); |
1161 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 1161 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
1162 } | 1162 } |
1163 | 1163 |
1164 } // namespace compiler | 1164 } // namespace compiler |
1165 } // namespace internal | 1165 } // namespace internal |
1166 } // namespace v8 | 1166 } // namespace v8 |
OLD | NEW |