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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 EXPECT_THAT(graph()->end()->InputAt(1), | 489 EXPECT_THAT(graph()->end()->InputAt(1), |
488 IsReturn2(IsInt32Constant(low_word_value(0)), IsInt32Constant(0), | 490 IsReturn2(IsInt32Constant(low_word_value(0)), IsInt32Constant(0), |
489 start(), start())); | 491 start(), start())); |
490 } | 492 } |
491 // kExprF64ReinterpretI64: | 493 // kExprF64ReinterpretI64: |
492 // kExprI64ReinterpretF64: | 494 // kExprI64ReinterpretF64: |
493 | 495 |
494 // kExprI64Clz: | 496 // kExprI64Clz: |
495 // kExprI64Ctz: | 497 // kExprI64Ctz: |
496 // kExprI64Popcnt: | 498 // kExprI64Popcnt: |
| 499 TEST_F(Int64LoweringTest, I64Popcnt) { |
| 500 LowerGraph(graph()->NewNode(machine()->Word64PopcntPlaceholder(), |
| 501 Int64Constant(value(0))), |
| 502 MachineRepresentation::kWord64); |
| 503 |
| 504 EXPECT_THAT( |
| 505 graph()->end()->InputAt(1), |
| 506 IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))), |
| 507 IsWord32Popcnt(IsInt32Constant(high_word_value(0)))), |
| 508 IsInt32Constant(0), start(), start())); |
| 509 } |
497 } // namespace compiler | 510 } // namespace compiler |
498 } // namespace internal | 511 } // namespace internal |
499 } // namespace v8 | 512 } // namespace v8 |
OLD | NEW |