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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "test/unittests/compiler/instruction-selector-unittest.h" | 7 #include "test/unittests/compiler/instruction-selector-unittest.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3262 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 3262 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
3263 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 3263 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
3264 ASSERT_EQ(1U, s[0]->OutputCount()); | 3264 ASSERT_EQ(1U, s[0]->OutputCount()); |
3265 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 3265 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
3266 } | 3266 } |
3267 | 3267 |
3268 TEST_F(InstructionSelectorTest, Float32Neg) { | 3268 TEST_F(InstructionSelectorTest, Float32Neg) { |
3269 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); | 3269 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); |
3270 Node* const p0 = m.Parameter(0); | 3270 Node* const p0 = m.Parameter(0); |
3271 // Don't use m.Float32Neg() as that generates an explicit sub. | 3271 // Don't use m.Float32Neg() as that generates an explicit sub. |
3272 Node* const n = m.AddNode(m.machine()->Float32Neg().op(), m.Parameter(0)); | 3272 Node* const n = m.AddNode(m.machine()->Float32Neg(), m.Parameter(0)); |
3273 m.Return(n); | 3273 m.Return(n); |
3274 Stream s = m.Build(); | 3274 Stream s = m.Build(); |
3275 ASSERT_EQ(1U, s.size()); | 3275 ASSERT_EQ(1U, s.size()); |
3276 EXPECT_EQ(kArmVnegF32, s[0]->arch_opcode()); | 3276 EXPECT_EQ(kArmVnegF32, s[0]->arch_opcode()); |
3277 ASSERT_EQ(1U, s[0]->InputCount()); | 3277 ASSERT_EQ(1U, s[0]->InputCount()); |
3278 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 3278 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
3279 ASSERT_EQ(1U, s[0]->OutputCount()); | 3279 ASSERT_EQ(1U, s[0]->OutputCount()); |
3280 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 3280 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
3281 } | 3281 } |
3282 | 3282 |
3283 TEST_F(InstructionSelectorTest, Float64Neg) { | 3283 TEST_F(InstructionSelectorTest, Float64Neg) { |
3284 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); | 3284 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); |
3285 Node* const p0 = m.Parameter(0); | 3285 Node* const p0 = m.Parameter(0); |
3286 // Don't use m.Float64Neg() as that generates an explicit sub. | 3286 // Don't use m.Float64Neg() as that generates an explicit sub. |
3287 Node* const n = m.AddNode(m.machine()->Float64Neg().op(), m.Parameter(0)); | 3287 Node* const n = m.AddNode(m.machine()->Float64Neg(), m.Parameter(0)); |
3288 m.Return(n); | 3288 m.Return(n); |
3289 Stream s = m.Build(); | 3289 Stream s = m.Build(); |
3290 ASSERT_EQ(1U, s.size()); | 3290 ASSERT_EQ(1U, s.size()); |
3291 EXPECT_EQ(kArmVnegF64, s[0]->arch_opcode()); | 3291 EXPECT_EQ(kArmVnegF64, s[0]->arch_opcode()); |
3292 ASSERT_EQ(1U, s[0]->InputCount()); | 3292 ASSERT_EQ(1U, s[0]->InputCount()); |
3293 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 3293 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
3294 ASSERT_EQ(1U, s[0]->OutputCount()); | 3294 ASSERT_EQ(1U, s[0]->OutputCount()); |
3295 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 3295 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
3296 } | 3296 } |
3297 | 3297 |
3298 } // namespace compiler | 3298 } // namespace compiler |
3299 } // namespace internal | 3299 } // namespace internal |
3300 } // namespace v8 | 3300 } // namespace v8 |
OLD | NEW |