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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
9 #include "src/compiler/schedule.h" | 9 #include "src/compiler/schedule.h" |
10 #include "src/flags.h" | 10 #include "src/flags.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind()); | 192 EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind()); |
193 EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0))); | 193 EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0))); |
194 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); | 194 EXPECT_EQ(kArchRet, s[1]->arch_opcode()); |
195 EXPECT_EQ(1U, s[1]->InputCount()); | 195 EXPECT_EQ(1U, s[1]->InputCount()); |
196 } | 196 } |
197 | 197 |
198 | 198 |
199 // ----------------------------------------------------------------------------- | 199 // ----------------------------------------------------------------------------- |
200 // Conversions. | 200 // Conversions. |
201 | 201 |
202 | 202 TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToWord32WithParameter) { |
203 TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) { | |
204 StreamBuilder m(this, MachineType::Int32(), MachineType::Float64()); | 203 StreamBuilder m(this, MachineType::Int32(), MachineType::Float64()); |
205 m.Return( | 204 m.Return(m.TruncateFloat64ToWord32(m.Parameter(0))); |
206 m.TruncateFloat64ToInt32(TruncationMode::kJavaScript, m.Parameter(0))); | |
207 Stream s = m.Build(kAllInstructions); | 205 Stream s = m.Build(kAllInstructions); |
208 ASSERT_EQ(4U, s.size()); | 206 ASSERT_EQ(4U, s.size()); |
209 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); | 207 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); |
210 EXPECT_EQ(kArchTruncateDoubleToI, s[1]->arch_opcode()); | 208 EXPECT_EQ(kArchTruncateDoubleToI, s[1]->arch_opcode()); |
211 EXPECT_EQ(1U, s[1]->InputCount()); | 209 EXPECT_EQ(1U, s[1]->InputCount()); |
212 EXPECT_EQ(1U, s[1]->OutputCount()); | 210 EXPECT_EQ(1U, s[1]->OutputCount()); |
213 EXPECT_EQ(kArchRet, s[2]->arch_opcode()); | 211 EXPECT_EQ(kArchRet, s[2]->arch_opcode()); |
214 } | 212 } |
215 | 213 |
216 | 214 |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); | 621 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); |
624 // Continuation. | 622 // Continuation. |
625 | 623 |
626 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 624 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
627 EXPECT_EQ(index, s.size()); | 625 EXPECT_EQ(index, s.size()); |
628 } | 626 } |
629 | 627 |
630 } // namespace compiler | 628 } // namespace compiler |
631 } // namespace internal | 629 } // namespace internal |
632 } // namespace v8 | 630 } // namespace v8 |
OLD | NEW |