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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 ASSERT_EQ(2U, s[0]->InputCount()); | 594 ASSERT_EQ(2U, s[0]->InputCount()); |
595 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 595 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
596 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), eax)); | 596 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), eax)); |
597 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 597 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
598 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1))); | 598 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1))); |
599 ASSERT_EQ(1U, s[0]->OutputCount()); | 599 ASSERT_EQ(1U, s[0]->OutputCount()); |
600 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 600 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
601 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), edx)); | 601 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), edx)); |
602 } | 602 } |
603 | 603 |
| 604 |
| 605 TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
| 606 { |
| 607 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
| 608 Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); |
| 609 Node* mul = m.Float64Mul(add, m.Parameter(1)); |
| 610 Node* sub = m.Float64Sub(mul, add); |
| 611 Node* ret = m.Float64Div(mul, sub); |
| 612 m.Return(ret); |
| 613 Stream s = m.Build(AVX); |
| 614 ASSERT_EQ(4U, s.size()); |
| 615 EXPECT_EQ(kAVXFloat64Add, s[0]->arch_opcode()); |
| 616 EXPECT_EQ(kAVXFloat64Mul, s[1]->arch_opcode()); |
| 617 EXPECT_EQ(kAVXFloat64Sub, s[2]->arch_opcode()); |
| 618 EXPECT_EQ(kAVXFloat64Div, s[3]->arch_opcode()); |
| 619 } |
| 620 { |
| 621 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
| 622 Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); |
| 623 Node* mul = m.Float64Mul(add, m.Parameter(1)); |
| 624 Node* sub = m.Float64Sub(mul, add); |
| 625 Node* ret = m.Float64Div(mul, sub); |
| 626 m.Return(ret); |
| 627 Stream s = m.Build(); |
| 628 ASSERT_EQ(4U, s.size()); |
| 629 EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode()); |
| 630 EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode()); |
| 631 EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode()); |
| 632 EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode()); |
| 633 } |
| 634 } |
| 635 |
604 } // namespace compiler | 636 } // namespace compiler |
605 } // namespace internal | 637 } // namespace internal |
606 } // namespace v8 | 638 } // namespace v8 |
OLD | NEW |