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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // ----------------------------------------------------------------------------- | 85 // ----------------------------------------------------------------------------- |
86 // Conversions. | 86 // Conversions. |
87 | 87 |
88 | 88 |
89 TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { | 89 TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { |
90 StreamBuilder m(this, kMachFloat32, kMachFloat64); | 90 StreamBuilder m(this, kMachFloat32, kMachFloat64); |
91 m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); | 91 m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); |
92 Stream s = m.Build(); | 92 Stream s = m.Build(); |
93 ASSERT_EQ(1U, s.size()); | 93 ASSERT_EQ(1U, s.size()); |
94 EXPECT_EQ(kSSECvtss2sd, s[0]->arch_opcode()); | 94 EXPECT_EQ(kSSEFloat32ToFloat64, s[0]->arch_opcode()); |
95 EXPECT_EQ(1U, s[0]->InputCount()); | 95 EXPECT_EQ(1U, s[0]->InputCount()); |
96 EXPECT_EQ(1U, s[0]->OutputCount()); | 96 EXPECT_EQ(1U, s[0]->OutputCount()); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { | 100 TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { |
101 StreamBuilder m(this, kMachFloat64, kMachFloat32); | 101 StreamBuilder m(this, kMachFloat64, kMachFloat32); |
102 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); | 102 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); |
103 Stream s = m.Build(); | 103 Stream s = m.Build(); |
104 ASSERT_EQ(1U, s.size()); | 104 ASSERT_EQ(1U, s.size()); |
105 EXPECT_EQ(kSSECvtsd2ss, s[0]->arch_opcode()); | 105 EXPECT_EQ(kSSEFloat64ToFloat32, s[0]->arch_opcode()); |
106 EXPECT_EQ(1U, s[0]->InputCount()); | 106 EXPECT_EQ(1U, s[0]->InputCount()); |
107 EXPECT_EQ(1U, s[0]->OutputCount()); | 107 EXPECT_EQ(1U, s[0]->OutputCount()); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 // ----------------------------------------------------------------------------- | 111 // ----------------------------------------------------------------------------- |
112 // Better left operand for commutative binops | 112 // Better left operand for commutative binops |
113 | 113 |
114 | 114 |
115 TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) { | 115 TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) { |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 EXPECT_EQ(kIA32Lzcnt, s[0]->arch_opcode()); | 700 EXPECT_EQ(kIA32Lzcnt, s[0]->arch_opcode()); |
701 ASSERT_EQ(1U, s[0]->InputCount()); | 701 ASSERT_EQ(1U, s[0]->InputCount()); |
702 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 702 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
703 ASSERT_EQ(1U, s[0]->OutputCount()); | 703 ASSERT_EQ(1U, s[0]->OutputCount()); |
704 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 704 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
705 } | 705 } |
706 | 706 |
707 } // namespace compiler | 707 } // namespace compiler |
708 } // namespace internal | 708 } // namespace internal |
709 } // namespace v8 | 709 } // namespace v8 |
OLD | NEW |