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 11 matching lines...) Expand all Loading... |
22 using testing::Capture; | 22 using testing::Capture; |
23 using testing::CaptureEq; | 23 using testing::CaptureEq; |
24 | 24 |
25 namespace v8 { | 25 namespace v8 { |
26 namespace internal { | 26 namespace internal { |
27 namespace compiler { | 27 namespace compiler { |
28 | 28 |
29 class Int64LoweringTest : public GraphTest { | 29 class Int64LoweringTest : public GraphTest { |
30 public: | 30 public: |
31 Int64LoweringTest() | 31 Int64LoweringTest() |
32 : GraphTest(), machine_(zone(), MachineRepresentation::kWord32) { | 32 : GraphTest(), |
| 33 machine_(zone(), MachineRepresentation::kWord32, |
| 34 MachineOperatorBuilder::Flag::kAllOptionalOps) { |
33 value_[0] = 0x1234567890abcdef; | 35 value_[0] = 0x1234567890abcdef; |
34 value_[1] = 0x1edcba098765432f; | 36 value_[1] = 0x1edcba098765432f; |
35 value_[2] = 0x1133557799886644; | 37 value_[2] = 0x1133557799886644; |
36 } | 38 } |
37 | 39 |
38 MachineOperatorBuilder* machine() { return &machine_; } | 40 MachineOperatorBuilder* machine() { return &machine_; } |
39 | 41 |
40 void LowerGraph(Node* node, Signature<MachineRepresentation>* signature) { | 42 void LowerGraph(Node* node, Signature<MachineRepresentation>* signature) { |
41 Node* ret = graph()->NewNode(common()->Return(), node, graph()->start(), | 43 Node* ret = graph()->NewNode(common()->Return(), node, graph()->start(), |
42 graph()->start()); | 44 graph()->start()); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 EXPECT_THAT( | 507 EXPECT_THAT( |
506 graph()->end()->InputAt(1), | 508 graph()->end()->InputAt(1), |
507 IsReturn2(IsWord32And(IsInt32Constant(low_word_value(0)), | 509 IsReturn2(IsWord32And(IsInt32Constant(low_word_value(0)), |
508 IsWord32And(IsInt32Constant(low_word_value(0)), | 510 IsWord32And(IsInt32Constant(low_word_value(0)), |
509 IsInt32Constant(low_word_value(1)))), | 511 IsInt32Constant(low_word_value(1)))), |
510 IsWord32And(IsInt32Constant(high_word_value(0)), | 512 IsWord32And(IsInt32Constant(high_word_value(0)), |
511 IsWord32And(IsInt32Constant(high_word_value(0)), | 513 IsWord32And(IsInt32Constant(high_word_value(0)), |
512 IsInt32Constant(high_word_value(1)))), | 514 IsInt32Constant(high_word_value(1)))), |
513 start(), start())); | 515 start(), start())); |
514 } | 516 } |
| 517 |
| 518 TEST_F(Int64LoweringTest, I64Popcnt) { |
| 519 LowerGraph(graph()->NewNode(machine()->Word64PopcntPlaceholder(), |
| 520 Int64Constant(value(0))), |
| 521 MachineRepresentation::kWord64); |
| 522 |
| 523 EXPECT_THAT( |
| 524 graph()->end()->InputAt(1), |
| 525 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), |
| 526 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), |
| 527 IsInt32Constant(0), start(), start())); |
| 528 } |
515 } // namespace compiler | 529 } // namespace compiler |
516 } // namespace internal | 530 } // namespace internal |
517 } // namespace v8 | 531 } // namespace v8 |
OLD | NEW |