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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), | 544 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), |
545 IsInt32Constant(0), | 545 IsInt32Constant(0), |
546 AllOf(CaptureEq(&store), store_matcher), start()), | 546 AllOf(CaptureEq(&store), store_matcher), start()), |
547 IsLoad(MachineType::Int32(), | 547 IsLoad(MachineType::Int32(), |
548 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), | 548 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), |
549 IsInt32Constant(0x4), | 549 IsInt32Constant(0x4), |
550 AllOf(CaptureEq(&store), store_matcher), start()), | 550 AllOf(CaptureEq(&store), store_matcher), start()), |
551 start(), start())); | 551 start(), start())); |
552 } | 552 } |
553 // kExprI64Clz: | 553 // kExprI64Clz: |
| 554 TEST_F(Int64LoweringTest, I64Clz) { |
| 555 LowerGraph(graph()->NewNode(machine()->Word64Clz(), Int64Constant(value(0))), |
| 556 MachineRepresentation::kWord64); |
| 557 |
| 558 Capture<Node*> branch_capture; |
| 559 Matcher<Node*> branch_matcher = IsBranch( |
| 560 IsWord32Equal(IsInt32Constant(high_word_value(0)), IsInt32Constant(0)), |
| 561 start()); |
| 562 |
| 563 EXPECT_THAT( |
| 564 graph()->end()->InputAt(1), |
| 565 IsReturn2( |
| 566 IsPhi(MachineRepresentation::kWord32, |
| 567 IsInt32Add(IsWord32Clz(IsInt32Constant(low_word_value(0))), |
| 568 IsInt32Constant(32)), |
| 569 IsWord32Clz(IsInt32Constant(high_word_value(0))), |
| 570 IsMerge( |
| 571 IsIfTrue(AllOf(CaptureEq(&branch_capture), branch_matcher)), |
| 572 IsIfFalse( |
| 573 AllOf(CaptureEq(&branch_capture), branch_matcher)))), |
| 574 IsInt32Constant(0), start(), start())); |
| 575 } |
554 // kExprI64Ctz: | 576 // kExprI64Ctz: |
555 // kExprI64Popcnt: | 577 // kExprI64Popcnt: |
556 | 578 |
557 TEST_F(Int64LoweringTest, Dfs) { | 579 TEST_F(Int64LoweringTest, Dfs) { |
558 Node* common = Int64Constant(value(0)); | 580 Node* common = Int64Constant(value(0)); |
559 LowerGraph(graph()->NewNode(machine()->Word64And(), common, | 581 LowerGraph(graph()->NewNode(machine()->Word64And(), common, |
560 graph()->NewNode(machine()->Word64And(), common, | 582 graph()->NewNode(machine()->Word64And(), common, |
561 Int64Constant(value(1)))), | 583 Int64Constant(value(1)))), |
562 MachineRepresentation::kWord64); | 584 MachineRepresentation::kWord64); |
563 | 585 |
(...skipping 15 matching lines...) Expand all Loading... |
579 | 601 |
580 EXPECT_THAT( | 602 EXPECT_THAT( |
581 graph()->end()->InputAt(1), | 603 graph()->end()->InputAt(1), |
582 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), | 604 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), |
583 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), | 605 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), |
584 IsInt32Constant(0), start(), start())); | 606 IsInt32Constant(0), start(), start())); |
585 } | 607 } |
586 } // namespace compiler | 608 } // namespace compiler |
587 } // namespace internal | 609 } // namespace internal |
588 } // namespace v8 | 610 } // namespace v8 |
OLD | NEW |