Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: test/unittests/compiler/select-lowering-unittest.cc

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/select-lowering.h" 5 #include "src/compiler/select-lowering.h"
6 #include "test/unittests/compiler/graph-unittest.h" 6 #include "test/unittests/compiler/graph-unittest.h"
7 #include "test/unittests/compiler/node-test-utils.h" 7 #include "test/unittests/compiler/node-test-utils.h"
8 #include "testing/gmock-support.h" 8 #include "testing/gmock-support.h"
9 9
10 using testing::AllOf; 10 using testing::AllOf;
(...skipping 16 matching lines...) Expand all
27 SelectLowering lowering_; 27 SelectLowering lowering_;
28 }; 28 };
29 29
30 30
31 TEST_F(SelectLoweringTest, SelectWithSameConditions) { 31 TEST_F(SelectLoweringTest, SelectWithSameConditions) {
32 Node* const p0 = Parameter(0); 32 Node* const p0 = Parameter(0);
33 Node* const p1 = Parameter(1); 33 Node* const p1 = Parameter(1);
34 Node* const p2 = Parameter(2); 34 Node* const p2 = Parameter(2);
35 Node* const p3 = Parameter(3); 35 Node* const p3 = Parameter(3);
36 Node* const p4 = Parameter(4); 36 Node* const p4 = Parameter(4);
37 Node* const s0 = graph()->NewNode(common()->Select(kMachInt32), p0, p1, p2); 37 Node* const s0 = graph()->NewNode(
38 common()->Select(MachineRepresentation::kWord32), p0, p1, p2);
38 39
39 Capture<Node*> branch; 40 Capture<Node*> branch;
40 Capture<Node*> merge; 41 Capture<Node*> merge;
41 { 42 {
42 Reduction const r = Reduce(s0); 43 Reduction const r = Reduce(s0);
43 ASSERT_TRUE(r.Changed()); 44 ASSERT_TRUE(r.Changed());
44 EXPECT_THAT( 45 EXPECT_THAT(
45 r.replacement(), 46 r.replacement(),
46 IsPhi( 47 IsPhi(
47 kMachInt32, p1, p2, 48 MachineRepresentation::kWord32, p1, p2,
48 AllOf(CaptureEq(&merge), 49 AllOf(CaptureEq(&merge),
49 IsMerge(IsIfTrue(CaptureEq(&branch)), 50 IsMerge(IsIfTrue(CaptureEq(&branch)),
50 IsIfFalse(AllOf(CaptureEq(&branch), 51 IsIfFalse(AllOf(CaptureEq(&branch),
51 IsBranch(p0, graph()->start()))))))); 52 IsBranch(p0, graph()->start())))))));
52 } 53 }
53 { 54 {
54 Reduction const r = 55 Reduction const r = Reduce(graph()->NewNode(
55 Reduce(graph()->NewNode(common()->Select(kMachInt32), p0, p3, p4)); 56 common()->Select(MachineRepresentation::kWord32), p0, p3, p4));
56 ASSERT_TRUE(r.Changed()); 57 ASSERT_TRUE(r.Changed());
57 EXPECT_THAT(r.replacement(), IsPhi(kMachInt32, p3, p4, CaptureEq(&merge))); 58 EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kWord32, p3, p4,
59 CaptureEq(&merge)));
58 } 60 }
59 { 61 {
60 // We must not reuse the diamond if it is reachable from either else/then 62 // We must not reuse the diamond if it is reachable from either else/then
61 // values of the Select, because the resulting graph can not be scheduled. 63 // values of the Select, because the resulting graph can not be scheduled.
62 Reduction const r = 64 Reduction const r = Reduce(graph()->NewNode(
63 Reduce(graph()->NewNode(common()->Select(kMachInt32), p0, s0, p0)); 65 common()->Select(MachineRepresentation::kWord32), p0, s0, p0));
64 ASSERT_TRUE(r.Changed()); 66 ASSERT_TRUE(r.Changed());
65 EXPECT_THAT(r.replacement(), 67 EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kWord32, s0, p0,
66 IsPhi(kMachInt32, s0, p0, Not(CaptureEq(&merge)))); 68 Not(CaptureEq(&merge))));
67 } 69 }
68 } 70 }
69 71
70 } // namespace compiler 72 } // namespace compiler
71 } // namespace internal 73 } // namespace internal
72 } // namespace v8 74 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/scheduler-unittest.cc ('k') | test/unittests/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698