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 4255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4266 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 4266 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
4267 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 4267 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
4268 ASSERT_EQ(1U, s[0]->OutputCount()); | 4268 ASSERT_EQ(1U, s[0]->OutputCount()); |
4269 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 4269 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
4270 } | 4270 } |
4271 | 4271 |
4272 TEST_F(InstructionSelectorTest, Float32Neg) { | 4272 TEST_F(InstructionSelectorTest, Float32Neg) { |
4273 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); | 4273 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); |
4274 Node* const p0 = m.Parameter(0); | 4274 Node* const p0 = m.Parameter(0); |
4275 // Don't use m.Float32Neg() as that generates an explicit sub. | 4275 // Don't use m.Float32Neg() as that generates an explicit sub. |
4276 Node* const n = m.AddNode(m.machine()->Float32Neg().op(), m.Parameter(0)); | 4276 Node* const n = m.AddNode(m.machine()->Float32Neg(), m.Parameter(0)); |
4277 m.Return(n); | 4277 m.Return(n); |
4278 Stream s = m.Build(); | 4278 Stream s = m.Build(); |
4279 ASSERT_EQ(1U, s.size()); | 4279 ASSERT_EQ(1U, s.size()); |
4280 EXPECT_EQ(kArm64Float32Neg, s[0]->arch_opcode()); | 4280 EXPECT_EQ(kArm64Float32Neg, s[0]->arch_opcode()); |
4281 ASSERT_EQ(1U, s[0]->InputCount()); | 4281 ASSERT_EQ(1U, s[0]->InputCount()); |
4282 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 4282 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
4283 ASSERT_EQ(1U, s[0]->OutputCount()); | 4283 ASSERT_EQ(1U, s[0]->OutputCount()); |
4284 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 4284 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
4285 } | 4285 } |
4286 | 4286 |
4287 TEST_F(InstructionSelectorTest, Float64Neg) { | 4287 TEST_F(InstructionSelectorTest, Float64Neg) { |
4288 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); | 4288 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
4289 Node* const p0 = m.Parameter(0); | 4289 Node* const p0 = m.Parameter(0); |
4290 // Don't use m.Float64Neg() as that generates an explicit sub. | 4290 // Don't use m.Float64Neg() as that generates an explicit sub. |
4291 Node* const n = m.AddNode(m.machine()->Float64Neg().op(), m.Parameter(0)); | 4291 Node* const n = m.AddNode(m.machine()->Float64Neg(), m.Parameter(0)); |
4292 m.Return(n); | 4292 m.Return(n); |
4293 Stream s = m.Build(); | 4293 Stream s = m.Build(); |
4294 ASSERT_EQ(1U, s.size()); | 4294 ASSERT_EQ(1U, s.size()); |
4295 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); | 4295 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); |
4296 ASSERT_EQ(1U, s[0]->InputCount()); | 4296 ASSERT_EQ(1U, s[0]->InputCount()); |
4297 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 4297 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
4298 ASSERT_EQ(1U, s[0]->OutputCount()); | 4298 ASSERT_EQ(1U, s[0]->OutputCount()); |
4299 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 4299 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
4300 } | 4300 } |
4301 | 4301 |
4302 } // namespace compiler | 4302 } // namespace compiler |
4303 } // namespace internal | 4303 } // namespace internal |
4304 } // namespace v8 | 4304 } // namespace v8 |
OLD | NEW |