OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 "src/compiler/int64-lowering.h" | 5 #include "src/compiler/int64-lowering.h" |
6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 | 10 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 IsInt32Add(IsWord32Clz(IsInt32Constant(low_word_value(0))), | 583 IsInt32Add(IsWord32Clz(IsInt32Constant(low_word_value(0))), |
584 IsInt32Constant(32)), | 584 IsInt32Constant(32)), |
585 IsWord32Clz(IsInt32Constant(high_word_value(0))), | 585 IsWord32Clz(IsInt32Constant(high_word_value(0))), |
586 IsMerge( | 586 IsMerge( |
587 IsIfTrue(AllOf(CaptureEq(&branch_capture), branch_matcher)), | 587 IsIfTrue(AllOf(CaptureEq(&branch_capture), branch_matcher)), |
588 IsIfFalse( | 588 IsIfFalse( |
589 AllOf(CaptureEq(&branch_capture), branch_matcher)))), | 589 AllOf(CaptureEq(&branch_capture), branch_matcher)))), |
590 IsInt32Constant(0), start(), start())); | 590 IsInt32Constant(0), start(), start())); |
591 } | 591 } |
592 // kExprI64Ctz: | 592 // kExprI64Ctz: |
| 593 TEST_F(Int64LoweringTest, I64Ctz) { |
| 594 LowerGraph(graph()->NewNode(machine()->Word64CtzPlaceholder(), |
| 595 Int64Constant(value(0))), |
| 596 MachineRepresentation::kWord64); |
| 597 Capture<Node*> branch_capture; |
| 598 Matcher<Node*> branch_matcher = IsBranch( |
| 599 IsWord32Equal(IsInt32Constant(low_word_value(0)), IsInt32Constant(0)), |
| 600 start()); |
| 601 EXPECT_THAT( |
| 602 graph()->end()->InputAt(1), |
| 603 IsReturn2( |
| 604 IsPhi(MachineRepresentation::kWord32, |
| 605 IsInt32Add(IsWord32Ctz(IsInt32Constant(high_word_value(0))), |
| 606 IsInt32Constant(32)), |
| 607 IsWord32Ctz(IsInt32Constant(low_word_value(0))), |
| 608 IsMerge( |
| 609 IsIfTrue(AllOf(CaptureEq(&branch_capture), branch_matcher)), |
| 610 IsIfFalse( |
| 611 AllOf(CaptureEq(&branch_capture), branch_matcher)))), |
| 612 IsInt32Constant(0), start(), start())); |
| 613 } |
593 // kExprI64Popcnt: | 614 // kExprI64Popcnt: |
594 | 615 |
595 TEST_F(Int64LoweringTest, Dfs) { | 616 TEST_F(Int64LoweringTest, Dfs) { |
596 Node* common = Int64Constant(value(0)); | 617 Node* common = Int64Constant(value(0)); |
597 LowerGraph(graph()->NewNode(machine()->Word64And(), common, | 618 LowerGraph(graph()->NewNode(machine()->Word64And(), common, |
598 graph()->NewNode(machine()->Word64And(), common, | 619 graph()->NewNode(machine()->Word64And(), common, |
599 Int64Constant(value(1)))), | 620 Int64Constant(value(1)))), |
600 MachineRepresentation::kWord64); | 621 MachineRepresentation::kWord64); |
601 | 622 |
602 EXPECT_THAT( | 623 EXPECT_THAT( |
(...skipping 14 matching lines...) Expand all Loading... |
617 | 638 |
618 EXPECT_THAT( | 639 EXPECT_THAT( |
619 graph()->end()->InputAt(1), | 640 graph()->end()->InputAt(1), |
620 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), | 641 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), |
621 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), | 642 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), |
622 IsInt32Constant(0), start(), start())); | 643 IsInt32Constant(0), start(), start())); |
623 } | 644 } |
624 } // namespace compiler | 645 } // namespace compiler |
625 } // namespace internal | 646 } // namespace internal |
626 } // namespace v8 | 647 } // namespace v8 |
OLD | NEW |