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 "src/compiler/instruction-selector-unittest.h" | 5 #include "src/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 Stream s = m.Build(); | 68 Stream s = m.Build(); |
69 ASSERT_EQ(1U, s.size()); | 69 ASSERT_EQ(1U, s.size()); |
70 EXPECT_EQ(kIA32Sub, s[0]->arch_opcode()); | 70 EXPECT_EQ(kIA32Sub, s[0]->arch_opcode()); |
71 ASSERT_EQ(2U, s[0]->InputCount()); | 71 ASSERT_EQ(2U, s[0]->InputCount()); |
72 EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); | 72 EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 // ----------------------------------------------------------------------------- | 77 // ----------------------------------------------------------------------------- |
| 78 // Conversions. |
| 79 |
| 80 |
| 81 TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { |
| 82 StreamBuilder m(this, kMachFloat32, kMachFloat64); |
| 83 m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); |
| 84 Stream s = m.Build(); |
| 85 ASSERT_EQ(1U, s.size()); |
| 86 EXPECT_EQ(kSSECvtss2sd, s[0]->arch_opcode()); |
| 87 EXPECT_EQ(1U, s[0]->InputCount()); |
| 88 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 89 } |
| 90 |
| 91 |
| 92 TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { |
| 93 StreamBuilder m(this, kMachFloat64, kMachFloat32); |
| 94 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); |
| 95 Stream s = m.Build(); |
| 96 ASSERT_EQ(1U, s.size()); |
| 97 EXPECT_EQ(kSSECvtsd2ss, s[0]->arch_opcode()); |
| 98 EXPECT_EQ(1U, s[0]->InputCount()); |
| 99 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 100 } |
| 101 |
| 102 |
| 103 // ----------------------------------------------------------------------------- |
78 // Loads and stores | 104 // Loads and stores |
79 | 105 |
80 namespace { | 106 namespace { |
81 | 107 |
82 struct MemoryAccess { | 108 struct MemoryAccess { |
83 MachineType type; | 109 MachineType type; |
84 ArchOpcode load_opcode; | 110 ArchOpcode load_opcode; |
85 ArchOpcode store_opcode; | 111 ArchOpcode store_opcode; |
86 }; | 112 }; |
87 | 113 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 228 } |
203 | 229 |
204 | 230 |
205 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, | 231 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
206 InstructionSelectorMemoryAccessTest, | 232 InstructionSelectorMemoryAccessTest, |
207 ::testing::ValuesIn(kMemoryAccesses)); | 233 ::testing::ValuesIn(kMemoryAccesses)); |
208 | 234 |
209 } // namespace compiler | 235 } // namespace compiler |
210 } // namespace internal | 236 } // namespace internal |
211 } // namespace v8 | 237 } // namespace v8 |
OLD | NEW |