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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 graph()->NewNode(machine()->TruncateInt64ToInt32(), | 485 graph()->NewNode(machine()->TruncateInt64ToInt32(), |
486 Int64Constant(value(0)))), | 486 Int64Constant(value(0)))), |
487 MachineRepresentation::kWord64); | 487 MachineRepresentation::kWord64); |
488 | 488 |
489 EXPECT_THAT(graph()->end()->InputAt(1), | 489 EXPECT_THAT(graph()->end()->InputAt(1), |
490 IsReturn2(IsInt32Constant(low_word_value(0)), IsInt32Constant(0), | 490 IsReturn2(IsInt32Constant(low_word_value(0)), IsInt32Constant(0), |
491 start(), start())); | 491 start(), start())); |
492 } | 492 } |
493 // kExprF64ReinterpretI64: | 493 // kExprF64ReinterpretI64: |
494 // kExprI64ReinterpretF64: | 494 // kExprI64ReinterpretF64: |
| 495 TEST_F(Int64LoweringTest, I64ReinterpretF64) { |
| 496 LowerGraph(graph()->NewNode(machine()->BitcastFloat64ToInt64(), |
| 497 Float64Constant(bit_cast<double>(value(0)))), |
| 498 MachineRepresentation::kWord64); |
495 | 499 |
| 500 Capture<Node*> stack_slot; |
| 501 Matcher<Node*> stack_slot_matcher = |
| 502 IsStackSlot(MachineRepresentation::kWord64); |
| 503 |
| 504 Capture<Node*> store; |
| 505 Matcher<Node*> store_matcher = IsStore( |
| 506 StoreRepresentation(MachineRepresentation::kFloat64, |
| 507 WriteBarrierKind::kNoWriteBarrier), |
| 508 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), IsInt32Constant(0), |
| 509 IsFloat64Constant(bit_cast<double>(value(0))), start(), start()); |
| 510 |
| 511 EXPECT_THAT( |
| 512 graph()->end()->InputAt(1), |
| 513 IsReturn2(IsLoad(MachineType::Int32(), |
| 514 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), |
| 515 IsInt32Constant(0), |
| 516 AllOf(CaptureEq(&store), store_matcher), start()), |
| 517 IsLoad(MachineType::Int32(), |
| 518 AllOf(CaptureEq(&stack_slot), stack_slot_matcher), |
| 519 IsInt32Constant(0x4), |
| 520 AllOf(CaptureEq(&store), store_matcher), start()), |
| 521 start(), start())); |
| 522 } |
496 // kExprI64Clz: | 523 // kExprI64Clz: |
497 // kExprI64Ctz: | 524 // kExprI64Ctz: |
498 // kExprI64Popcnt: | 525 // kExprI64Popcnt: |
499 | 526 |
500 TEST_F(Int64LoweringTest, Dfs) { | 527 TEST_F(Int64LoweringTest, Dfs) { |
501 Node* common = Int64Constant(value(0)); | 528 Node* common = Int64Constant(value(0)); |
502 LowerGraph(graph()->NewNode(machine()->Word64And(), common, | 529 LowerGraph(graph()->NewNode(machine()->Word64And(), common, |
503 graph()->NewNode(machine()->Word64And(), common, | 530 graph()->NewNode(machine()->Word64And(), common, |
504 Int64Constant(value(1)))), | 531 Int64Constant(value(1)))), |
505 MachineRepresentation::kWord64); | 532 MachineRepresentation::kWord64); |
(...skipping 16 matching lines...) Expand all Loading... |
522 | 549 |
523 EXPECT_THAT( | 550 EXPECT_THAT( |
524 graph()->end()->InputAt(1), | 551 graph()->end()->InputAt(1), |
525 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), | 552 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), |
526 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), | 553 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), |
527 IsInt32Constant(0), start(), start())); | 554 IsInt32Constant(0), start(), start())); |
528 } | 555 } |
529 } // namespace compiler | 556 } // namespace compiler |
530 } // namespace internal | 557 } // namespace internal |
531 } // namespace v8 | 558 } // namespace v8 |
OLD | NEW |