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 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); | 2414 EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); |
2415 EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode()); | 2415 EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode()); |
2416 ASSERT_EQ(2U, s[0]->InputCount()); | 2416 ASSERT_EQ(2U, s[0]->InputCount()); |
2417 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 2417 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
2418 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 2418 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
2419 ASSERT_EQ(1U, s[0]->OutputCount()); | 2419 ASSERT_EQ(1U, s[0]->OutputCount()); |
2420 } | 2420 } |
2421 } | 2421 } |
2422 | 2422 |
2423 | 2423 |
| 2424 TEST_F(InstructionSelectorTest, Word32EqualZeroWithWord32Equal) { |
| 2425 { |
| 2426 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
| 2427 Node* const p0 = m.Parameter(0); |
| 2428 Node* const p1 = m.Parameter(1); |
| 2429 m.Return(m.Word32Equal(m.Word32Equal(p0, p1), m.Int32Constant(0))); |
| 2430 Stream s = m.Build(); |
| 2431 ASSERT_EQ(1U, s.size()); |
| 2432 EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); |
| 2433 ASSERT_EQ(2U, s[0]->InputCount()); |
| 2434 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 2435 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
| 2436 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 2437 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 2438 EXPECT_EQ(kNotEqual, s[0]->flags_condition()); |
| 2439 } |
| 2440 { |
| 2441 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
| 2442 Node* const p0 = m.Parameter(0); |
| 2443 Node* const p1 = m.Parameter(1); |
| 2444 m.Return(m.Word32Equal(m.Int32Constant(0), m.Word32Equal(p0, p1))); |
| 2445 Stream s = m.Build(); |
| 2446 ASSERT_EQ(1U, s.size()); |
| 2447 EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); |
| 2448 ASSERT_EQ(2U, s[0]->InputCount()); |
| 2449 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 2450 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
| 2451 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 2452 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 2453 EXPECT_EQ(kNotEqual, s[0]->flags_condition()); |
| 2454 } |
| 2455 } |
| 2456 |
| 2457 |
2424 // ----------------------------------------------------------------------------- | 2458 // ----------------------------------------------------------------------------- |
2425 // Miscellaneous | 2459 // Miscellaneous |
2426 | 2460 |
2427 | 2461 |
2428 static const MachInst2 kLogicalWithNotRHSs[] = { | 2462 static const MachInst2 kLogicalWithNotRHSs[] = { |
2429 {&RawMachineAssembler::Word32And, "Word32And", kArm64Bic32, kMachInt32}, | 2463 {&RawMachineAssembler::Word32And, "Word32And", kArm64Bic32, kMachInt32}, |
2430 {&RawMachineAssembler::Word64And, "Word64And", kArm64Bic, kMachInt64}, | 2464 {&RawMachineAssembler::Word64And, "Word64And", kArm64Bic, kMachInt64}, |
2431 {&RawMachineAssembler::Word32Or, "Word32Or", kArm64Orn32, kMachInt32}, | 2465 {&RawMachineAssembler::Word32Or, "Word32Or", kArm64Orn32, kMachInt32}, |
2432 {&RawMachineAssembler::Word64Or, "Word64Or", kArm64Orn, kMachInt64}, | 2466 {&RawMachineAssembler::Word64Or, "Word64Or", kArm64Orn, kMachInt64}, |
2433 {&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eon32, kMachInt32}, | 2467 {&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eon32, kMachInt32}, |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); | 3031 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); |
2998 ASSERT_EQ(1U, s[0]->InputCount()); | 3032 ASSERT_EQ(1U, s[0]->InputCount()); |
2999 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 3033 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
3000 ASSERT_EQ(1U, s[0]->OutputCount()); | 3034 ASSERT_EQ(1U, s[0]->OutputCount()); |
3001 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 3035 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
3002 } | 3036 } |
3003 | 3037 |
3004 } // namespace compiler | 3038 } // namespace compiler |
3005 } // namespace internal | 3039 } // namespace internal |
3006 } // namespace v8 | 3040 } // namespace v8 |
OLD | NEW |