OLD | NEW |
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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/machine-operator.h" | 7 #include "src/compiler/machine-operator.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 virtual ~NodeMatcherTest() {} | 22 virtual ~NodeMatcherTest() {} |
23 | 23 |
24 MachineOperatorBuilder* machine() { return &machine_; } | 24 MachineOperatorBuilder* machine() { return &machine_; } |
25 | 25 |
26 private: | 26 private: |
27 MachineOperatorBuilder machine_; | 27 MachineOperatorBuilder machine_; |
28 }; | 28 }; |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 void CheckScaledWithOffsetMatch(ScaledWithOffsetMatcher* matcher, Node* scaled, | 32 template <class Matcher> |
| 33 void CheckScaledWithOffsetMatch(Matcher* matcher, Node* scaled, |
33 int scale_exponent, Node* offset, | 34 int scale_exponent, Node* offset, |
34 Node* constant) { | 35 Node* constant) { |
35 EXPECT_TRUE(matcher->matches()); | 36 EXPECT_TRUE(matcher->matches()); |
36 EXPECT_EQ(scaled, matcher->scaled()); | 37 EXPECT_EQ(scaled, matcher->scaled()); |
37 EXPECT_EQ(scale_exponent, matcher->scale_exponent()); | 38 EXPECT_EQ(scale_exponent, matcher->scale_exponent()); |
38 EXPECT_EQ(offset, matcher->offset()); | 39 EXPECT_EQ(offset, matcher->offset()); |
39 EXPECT_EQ(constant, matcher->constant()); | 40 EXPECT_EQ(constant, matcher->constant()); |
40 } | 41 } |
41 }; | 42 }; |
42 | 43 |
43 | 44 |
44 TEST_F(NodeMatcherTest, ScaledWithOffsetMatcher) { | 45 TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { |
45 graph()->SetStart(graph()->NewNode(common()->Start(0))); | 46 graph()->SetStart(graph()->NewNode(common()->Start(0))); |
46 | 47 |
47 const Operator* c0_op = common()->Int32Constant(0); | 48 const Operator* c0_op = common()->Int32Constant(0); |
48 Node* c0 = graph()->NewNode(c0_op); | 49 Node* c0 = graph()->NewNode(c0_op); |
49 USE(c0); | 50 USE(c0); |
50 const Operator* c1_op = common()->Int32Constant(1); | 51 const Operator* c1_op = common()->Int32Constant(1); |
51 Node* c1 = graph()->NewNode(c1_op); | 52 Node* c1 = graph()->NewNode(c1_op); |
52 USE(c1); | 53 USE(c1); |
53 const Operator* c2_op = common()->Int32Constant(2); | 54 const Operator* c2_op = common()->Int32Constant(2); |
54 Node* c2 = graph()->NewNode(c2_op); | 55 Node* c2 = graph()->NewNode(c2_op); |
55 USE(c2); | 56 USE(c2); |
56 const Operator* c3_op = common()->Int32Constant(3); | 57 const Operator* c3_op = common()->Int32Constant(3); |
57 Node* c3 = graph()->NewNode(c3_op); | 58 Node* c3 = graph()->NewNode(c3_op); |
58 USE(c3); | 59 USE(c3); |
59 const Operator* c4_op = common()->Int32Constant(4); | 60 const Operator* c4_op = common()->Int32Constant(4); |
60 Node* c4 = graph()->NewNode(c4_op); | 61 Node* c4 = graph()->NewNode(c4_op); |
61 USE(c4); | 62 USE(c4); |
62 const Operator* c8_op = common()->Int32Constant(8); | 63 const Operator* c8_op = common()->Int32Constant(8); |
63 Node* c8 = graph()->NewNode(c8_op); | 64 Node* c8 = graph()->NewNode(c8_op); |
64 USE(c8); | 65 USE(c8); |
| 66 const Operator* c15_op = common()->Int32Constant(15); |
| 67 Node* c15 = graph()->NewNode(c15_op); |
| 68 USE(c15); |
65 | 69 |
66 const Operator* o0_op = common()->Parameter(0); | 70 const Operator* o0_op = common()->Parameter(0); |
67 Node* o0 = graph()->NewNode(o0_op, graph()->start()); | 71 Node* o0 = graph()->NewNode(o0_op, graph()->start()); |
68 USE(o0); | 72 USE(o0); |
69 const Operator* o1_op = common()->Parameter(1); | 73 const Operator* o1_op = common()->Parameter(1); |
70 Node* o1 = graph()->NewNode(o1_op, graph()->start()); | 74 Node* o1 = graph()->NewNode(o1_op, graph()->start()); |
71 USE(o0); | 75 USE(o0); |
72 | 76 |
73 const Operator* p1_op = common()->Parameter(3); | 77 const Operator* p1_op = common()->Parameter(3); |
74 Node* p1 = graph()->NewNode(p1_op, graph()->start()); | 78 Node* p1 = graph()->NewNode(p1_op, graph()->start()); |
75 USE(p1); | 79 USE(p1); |
76 | 80 |
77 const Operator* a_op = machine()->Int32Add(); | 81 const Operator* a_op = machine()->Int32Add(); |
78 USE(a_op); | 82 USE(a_op); |
79 | 83 |
80 const Operator* m_op = machine()->Int32Mul(); | 84 const Operator* m_op = machine()->Int32Mul(); |
81 Node* m1 = graph()->NewNode(m_op, p1, c1); | 85 Node* m1 = graph()->NewNode(m_op, p1, c1); |
82 Node* m2 = graph()->NewNode(m_op, p1, c2); | 86 Node* m2 = graph()->NewNode(m_op, p1, c2); |
83 Node* m4 = graph()->NewNode(m_op, p1, c4); | 87 Node* m4 = graph()->NewNode(m_op, p1, c4); |
84 Node* m8 = graph()->NewNode(m_op, p1, c8); | 88 Node* m8 = graph()->NewNode(m_op, p1, c8); |
85 Node* m3 = graph()->NewNode(m_op, p1, c3); | 89 Node* m3 = graph()->NewNode(m_op, p1, c3); |
| 90 USE(m1); |
| 91 USE(m2); |
| 92 USE(m4); |
| 93 USE(m8); |
| 94 USE(m3); |
86 | 95 |
87 const Operator* s_op = machine()->Word32Shl(); | 96 const Operator* s_op = machine()->Word32Shl(); |
88 Node* s0 = graph()->NewNode(s_op, p1, c0); | 97 Node* s0 = graph()->NewNode(s_op, p1, c0); |
89 Node* s1 = graph()->NewNode(s_op, p1, c1); | 98 Node* s1 = graph()->NewNode(s_op, p1, c1); |
90 Node* s2 = graph()->NewNode(s_op, p1, c2); | 99 Node* s2 = graph()->NewNode(s_op, p1, c2); |
91 Node* s3 = graph()->NewNode(s_op, p1, c3); | 100 Node* s3 = graph()->NewNode(s_op, p1, c3); |
92 Node* s4 = graph()->NewNode(s_op, p1, c4); | 101 Node* s4 = graph()->NewNode(s_op, p1, c4); |
| 102 USE(s0); |
| 103 USE(s1); |
| 104 USE(s2); |
| 105 USE(s3); |
| 106 USE(s4); |
93 | 107 |
94 // 1 INPUT | 108 // 1 INPUT |
95 | 109 |
96 // Only relevant test cases is checking for non-match. | 110 // Only relevant test cases is checking for non-match. |
97 ScaledWithOffsetMatcher match0(c0); | 111 ScaledWithOffset32Matcher match0(c15); |
98 EXPECT_FALSE(match0.matches()); | 112 EXPECT_FALSE(match0.matches()); |
99 | 113 |
100 // 2 INPUT | 114 // 2 INPUT |
101 | 115 |
102 // (O0 + O1) -> [O0, 0, O1, NULL] | 116 // (O0 + O1) -> [O0, 0, O1, NULL] |
103 ScaledWithOffsetMatcher match1(graph()->NewNode(a_op, o0, o1)); | 117 ScaledWithOffset32Matcher match1(graph()->NewNode(a_op, o0, o1)); |
104 CheckScaledWithOffsetMatch(&match1, o1, 0, o0, NULL); | 118 CheckScaledWithOffsetMatch(&match1, o1, 0, o0, NULL); |
105 | 119 |
106 // (O0 + C0) -> [NULL, 0, O0, C0] | 120 // (O0 + C15) -> [NULL, 0, O0, C15] |
107 ScaledWithOffsetMatcher match2(graph()->NewNode(a_op, o0, c0)); | 121 ScaledWithOffset32Matcher match2(graph()->NewNode(a_op, o0, c15)); |
108 CheckScaledWithOffsetMatch(&match2, NULL, 0, o0, c0); | 122 CheckScaledWithOffsetMatch(&match2, NULL, 0, o0, c15); |
109 | 123 |
110 // (C0 + O0) -> [NULL, 0, O0, C0] | 124 // (C15 + O0) -> [NULL, 0, O0, C15] |
111 ScaledWithOffsetMatcher match3(graph()->NewNode(a_op, c0, o0)); | 125 ScaledWithOffset32Matcher match3(graph()->NewNode(a_op, c15, o0)); |
112 CheckScaledWithOffsetMatch(&match3, NULL, 0, o0, c0); | 126 CheckScaledWithOffsetMatch(&match3, NULL, 0, o0, c15); |
113 | 127 |
114 // (O0 + M1) -> [p1, 0, O0, NULL] | 128 // (O0 + M1) -> [p1, 0, O0, NULL] |
115 ScaledWithOffsetMatcher match4(graph()->NewNode(a_op, o0, m1)); | 129 ScaledWithOffset32Matcher match4(graph()->NewNode(a_op, o0, m1)); |
116 CheckScaledWithOffsetMatch(&match4, p1, 0, o0, NULL); | 130 CheckScaledWithOffsetMatch(&match4, p1, 0, o0, NULL); |
117 | 131 |
118 // (M1 + O0) -> [p1, 0, O0, NULL] | 132 // (M1 + O0) -> [p1, 0, O0, NULL] |
119 m1 = graph()->NewNode(m_op, p1, c1); | 133 m1 = graph()->NewNode(m_op, p1, c1); |
120 ScaledWithOffsetMatcher match5(graph()->NewNode(a_op, m1, o0)); | 134 ScaledWithOffset32Matcher match5(graph()->NewNode(a_op, m1, o0)); |
121 CheckScaledWithOffsetMatch(&match5, p1, 0, o0, NULL); | 135 CheckScaledWithOffsetMatch(&match5, p1, 0, o0, NULL); |
122 | 136 |
123 // (C0 + M1) -> [P1, 0, NULL, C0] | 137 // (C15 + M1) -> [P1, 0, NULL, C15] |
124 m1 = graph()->NewNode(m_op, p1, c1); | 138 m1 = graph()->NewNode(m_op, p1, c1); |
125 ScaledWithOffsetMatcher match6(graph()->NewNode(a_op, c0, m1)); | 139 ScaledWithOffset32Matcher match6(graph()->NewNode(a_op, c15, m1)); |
126 CheckScaledWithOffsetMatch(&match6, p1, 0, NULL, c0); | 140 CheckScaledWithOffsetMatch(&match6, p1, 0, NULL, c15); |
127 | 141 |
128 // (M1 + C0) -> [P1, 0, NULL, C0] | 142 // (M1 + C15) -> [P1, 0, NULL, C15] |
129 m1 = graph()->NewNode(m_op, p1, c1); | 143 m1 = graph()->NewNode(m_op, p1, c1); |
130 ScaledWithOffsetMatcher match7(graph()->NewNode(a_op, m1, c0)); | 144 ScaledWithOffset32Matcher match7(graph()->NewNode(a_op, m1, c15)); |
131 CheckScaledWithOffsetMatch(&match7, p1, 0, NULL, c0); | 145 CheckScaledWithOffsetMatch(&match7, p1, 0, NULL, c15); |
132 | 146 |
133 // (O0 + S0) -> [p1, 0, O0, NULL] | 147 // (O0 + S0) -> [p1, 0, O0, NULL] |
134 ScaledWithOffsetMatcher match8(graph()->NewNode(a_op, o0, s0)); | 148 ScaledWithOffset32Matcher match8(graph()->NewNode(a_op, o0, s0)); |
135 CheckScaledWithOffsetMatch(&match8, p1, 0, o0, NULL); | 149 CheckScaledWithOffsetMatch(&match8, p1, 0, o0, NULL); |
136 | 150 |
137 // (S0 + O0) -> [p1, 0, O0, NULL] | 151 // (S0 + O0) -> [p1, 0, O0, NULL] |
138 s0 = graph()->NewNode(s_op, p1, c0); | 152 s0 = graph()->NewNode(s_op, p1, c0); |
139 ScaledWithOffsetMatcher match9(graph()->NewNode(a_op, s0, o0)); | 153 ScaledWithOffset32Matcher match9(graph()->NewNode(a_op, s0, o0)); |
140 CheckScaledWithOffsetMatch(&match9, p1, 0, o0, NULL); | 154 CheckScaledWithOffsetMatch(&match9, p1, 0, o0, NULL); |
141 | 155 |
142 // (C0 + S0) -> [P1, 0, NULL, C0] | 156 // (C15 + S0) -> [P1, 0, NULL, C15] |
143 s0 = graph()->NewNode(s_op, p1, c0); | 157 s0 = graph()->NewNode(s_op, p1, c0); |
144 ScaledWithOffsetMatcher match10(graph()->NewNode(a_op, c0, s0)); | 158 ScaledWithOffset32Matcher match10(graph()->NewNode(a_op, c15, s0)); |
145 CheckScaledWithOffsetMatch(&match10, p1, 0, NULL, c0); | 159 CheckScaledWithOffsetMatch(&match10, p1, 0, NULL, c15); |
146 | 160 |
147 // (S0 + C0) -> [P1, 0, NULL, C0] | 161 // (S0 + C15) -> [P1, 0, NULL, C15] |
148 s0 = graph()->NewNode(s_op, p1, c0); | 162 s0 = graph()->NewNode(s_op, p1, c0); |
149 ScaledWithOffsetMatcher match11(graph()->NewNode(a_op, s0, c0)); | 163 ScaledWithOffset32Matcher match11(graph()->NewNode(a_op, s0, c15)); |
150 CheckScaledWithOffsetMatch(&match11, p1, 0, NULL, c0); | 164 CheckScaledWithOffsetMatch(&match11, p1, 0, NULL, c15); |
151 | 165 |
152 // (O0 + M2) -> [p1, 1, O0, NULL] | 166 // (O0 + M2) -> [p1, 1, O0, NULL] |
153 ScaledWithOffsetMatcher match12(graph()->NewNode(a_op, o0, m2)); | 167 ScaledWithOffset32Matcher match12(graph()->NewNode(a_op, o0, m2)); |
154 CheckScaledWithOffsetMatch(&match12, p1, 1, o0, NULL); | 168 CheckScaledWithOffsetMatch(&match12, p1, 1, o0, NULL); |
155 | 169 |
156 // (M2 + O0) -> [p1, 1, O0, NULL] | 170 // (M2 + O0) -> [p1, 1, O0, NULL] |
157 m2 = graph()->NewNode(m_op, p1, c2); | 171 m2 = graph()->NewNode(m_op, p1, c2); |
158 ScaledWithOffsetMatcher match13(graph()->NewNode(a_op, m2, o0)); | 172 ScaledWithOffset32Matcher match13(graph()->NewNode(a_op, m2, o0)); |
159 CheckScaledWithOffsetMatch(&match13, p1, 1, o0, NULL); | 173 CheckScaledWithOffsetMatch(&match13, p1, 1, o0, NULL); |
160 | 174 |
161 // (C0 + M2) -> [P1, 1, NULL, C0] | 175 // (C15 + M2) -> [P1, 1, NULL, C15] |
162 m2 = graph()->NewNode(m_op, p1, c2); | 176 m2 = graph()->NewNode(m_op, p1, c2); |
163 ScaledWithOffsetMatcher match14(graph()->NewNode(a_op, c0, m2)); | 177 ScaledWithOffset32Matcher match14(graph()->NewNode(a_op, c15, m2)); |
164 CheckScaledWithOffsetMatch(&match14, p1, 1, NULL, c0); | 178 CheckScaledWithOffsetMatch(&match14, p1, 1, NULL, c15); |
165 | 179 |
166 // (M2 + C0) -> [P1, 1, NULL, C0] | 180 // (M2 + C15) -> [P1, 1, NULL, C15] |
167 m2 = graph()->NewNode(m_op, p1, c2); | 181 m2 = graph()->NewNode(m_op, p1, c2); |
168 ScaledWithOffsetMatcher match15(graph()->NewNode(a_op, m2, c0)); | 182 ScaledWithOffset32Matcher match15(graph()->NewNode(a_op, m2, c15)); |
169 CheckScaledWithOffsetMatch(&match15, p1, 1, NULL, c0); | 183 CheckScaledWithOffsetMatch(&match15, p1, 1, NULL, c15); |
170 | 184 |
171 // (O0 + S1) -> [p1, 1, O0, NULL] | 185 // (O0 + S1) -> [p1, 1, O0, NULL] |
172 ScaledWithOffsetMatcher match16(graph()->NewNode(a_op, o0, s1)); | 186 ScaledWithOffset32Matcher match16(graph()->NewNode(a_op, o0, s1)); |
173 CheckScaledWithOffsetMatch(&match16, p1, 1, o0, NULL); | 187 CheckScaledWithOffsetMatch(&match16, p1, 1, o0, NULL); |
174 | 188 |
175 // (S1 + O0) -> [p1, 1, O0, NULL] | 189 // (S1 + O0) -> [p1, 1, O0, NULL] |
176 s1 = graph()->NewNode(s_op, p1, c1); | 190 s1 = graph()->NewNode(s_op, p1, c1); |
177 ScaledWithOffsetMatcher match17(graph()->NewNode(a_op, s1, o0)); | 191 ScaledWithOffset32Matcher match17(graph()->NewNode(a_op, s1, o0)); |
178 CheckScaledWithOffsetMatch(&match17, p1, 1, o0, NULL); | 192 CheckScaledWithOffsetMatch(&match17, p1, 1, o0, NULL); |
179 | 193 |
180 // (C0 + S1) -> [P1, 1, NULL, C0] | 194 // (C15 + S1) -> [P1, 1, NULL, C15] |
181 s1 = graph()->NewNode(s_op, p1, c1); | 195 s1 = graph()->NewNode(s_op, p1, c1); |
182 ScaledWithOffsetMatcher match18(graph()->NewNode(a_op, c0, s1)); | 196 ScaledWithOffset32Matcher match18(graph()->NewNode(a_op, c15, s1)); |
183 CheckScaledWithOffsetMatch(&match18, p1, 1, NULL, c0); | 197 CheckScaledWithOffsetMatch(&match18, p1, 1, NULL, c15); |
184 | 198 |
185 // (S1 + C0) -> [P1, 1, NULL, C0] | 199 // (S1 + C15) -> [P1, 1, NULL, C15] |
186 s1 = graph()->NewNode(s_op, p1, c1); | 200 s1 = graph()->NewNode(s_op, p1, c1); |
187 ScaledWithOffsetMatcher match19(graph()->NewNode(a_op, s1, c0)); | 201 ScaledWithOffset32Matcher match19(graph()->NewNode(a_op, s1, c15)); |
188 CheckScaledWithOffsetMatch(&match19, p1, 1, NULL, c0); | 202 CheckScaledWithOffsetMatch(&match19, p1, 1, NULL, c15); |
189 | 203 |
190 // (O0 + M4) -> [p1, 2, O0, NULL] | 204 // (O0 + M4) -> [p1, 2, O0, NULL] |
191 ScaledWithOffsetMatcher match20(graph()->NewNode(a_op, o0, m4)); | 205 ScaledWithOffset32Matcher match20(graph()->NewNode(a_op, o0, m4)); |
192 CheckScaledWithOffsetMatch(&match20, p1, 2, o0, NULL); | 206 CheckScaledWithOffsetMatch(&match20, p1, 2, o0, NULL); |
193 | 207 |
194 // (M4 + O0) -> [p1, 2, O0, NULL] | 208 // (M4 + O0) -> [p1, 2, O0, NULL] |
195 m4 = graph()->NewNode(m_op, p1, c4); | 209 m4 = graph()->NewNode(m_op, p1, c4); |
196 ScaledWithOffsetMatcher match21(graph()->NewNode(a_op, m4, o0)); | 210 ScaledWithOffset32Matcher match21(graph()->NewNode(a_op, m4, o0)); |
197 CheckScaledWithOffsetMatch(&match21, p1, 2, o0, NULL); | 211 CheckScaledWithOffsetMatch(&match21, p1, 2, o0, NULL); |
198 | 212 |
199 // (C0 + M4) -> [p1, 2, NULL, C0] | 213 // (C15 + M4) -> [p1, 2, NULL, C15] |
200 m4 = graph()->NewNode(m_op, p1, c4); | 214 m4 = graph()->NewNode(m_op, p1, c4); |
201 ScaledWithOffsetMatcher match22(graph()->NewNode(a_op, c0, m4)); | 215 ScaledWithOffset32Matcher match22(graph()->NewNode(a_op, c15, m4)); |
202 CheckScaledWithOffsetMatch(&match22, p1, 2, NULL, c0); | 216 CheckScaledWithOffsetMatch(&match22, p1, 2, NULL, c15); |
203 | 217 |
204 // (M4 + C0) -> [p1, 2, NULL, C0] | 218 // (M4 + C15) -> [p1, 2, NULL, C15] |
205 m4 = graph()->NewNode(m_op, p1, c4); | 219 m4 = graph()->NewNode(m_op, p1, c4); |
206 ScaledWithOffsetMatcher match23(graph()->NewNode(a_op, m4, c0)); | 220 ScaledWithOffset32Matcher match23(graph()->NewNode(a_op, m4, c15)); |
207 CheckScaledWithOffsetMatch(&match23, p1, 2, NULL, c0); | 221 CheckScaledWithOffsetMatch(&match23, p1, 2, NULL, c15); |
208 | 222 |
209 // (O0 + S2) -> [p1, 2, O0, NULL] | 223 // (O0 + S2) -> [p1, 2, O0, NULL] |
210 ScaledWithOffsetMatcher match24(graph()->NewNode(a_op, o0, s2)); | 224 ScaledWithOffset32Matcher match24(graph()->NewNode(a_op, o0, s2)); |
211 CheckScaledWithOffsetMatch(&match24, p1, 2, o0, NULL); | 225 CheckScaledWithOffsetMatch(&match24, p1, 2, o0, NULL); |
212 | 226 |
213 // (S2 + O0) -> [p1, 2, O0, NULL] | 227 // (S2 + O0) -> [p1, 2, O0, NULL] |
214 s2 = graph()->NewNode(s_op, p1, c2); | 228 s2 = graph()->NewNode(s_op, p1, c2); |
215 ScaledWithOffsetMatcher match25(graph()->NewNode(a_op, s2, o0)); | 229 ScaledWithOffset32Matcher match25(graph()->NewNode(a_op, s2, o0)); |
216 CheckScaledWithOffsetMatch(&match25, p1, 2, o0, NULL); | 230 CheckScaledWithOffsetMatch(&match25, p1, 2, o0, NULL); |
217 | 231 |
218 // (C0 + S2) -> [p1, 2, NULL, C0] | 232 // (C15 + S2) -> [p1, 2, NULL, C15] |
219 s2 = graph()->NewNode(s_op, p1, c2); | 233 s2 = graph()->NewNode(s_op, p1, c2); |
220 ScaledWithOffsetMatcher match26(graph()->NewNode(a_op, c0, s2)); | 234 ScaledWithOffset32Matcher match26(graph()->NewNode(a_op, c15, s2)); |
221 CheckScaledWithOffsetMatch(&match26, p1, 2, NULL, c0); | 235 CheckScaledWithOffsetMatch(&match26, p1, 2, NULL, c15); |
222 | 236 |
223 // (S2 + C0) -> [p1, 2, NULL, C0] | 237 // (S2 + C15) -> [p1, 2, NULL, C15] |
224 s2 = graph()->NewNode(s_op, p1, c2); | 238 s2 = graph()->NewNode(s_op, p1, c2); |
225 ScaledWithOffsetMatcher match27(graph()->NewNode(a_op, s2, c0)); | 239 ScaledWithOffset32Matcher match27(graph()->NewNode(a_op, s2, c15)); |
226 CheckScaledWithOffsetMatch(&match27, p1, 2, NULL, c0); | 240 CheckScaledWithOffsetMatch(&match27, p1, 2, NULL, c15); |
227 | 241 |
228 // (O0 + M8) -> [p1, 2, O0, NULL] | 242 // (O0 + M8) -> [p1, 2, O0, NULL] |
229 ScaledWithOffsetMatcher match28(graph()->NewNode(a_op, o0, m8)); | 243 ScaledWithOffset32Matcher match28(graph()->NewNode(a_op, o0, m8)); |
230 CheckScaledWithOffsetMatch(&match28, p1, 3, o0, NULL); | 244 CheckScaledWithOffsetMatch(&match28, p1, 3, o0, NULL); |
231 | 245 |
232 // (M8 + O0) -> [p1, 2, O0, NULL] | 246 // (M8 + O0) -> [p1, 2, O0, NULL] |
233 m8 = graph()->NewNode(m_op, p1, c8); | 247 m8 = graph()->NewNode(m_op, p1, c8); |
234 ScaledWithOffsetMatcher match29(graph()->NewNode(a_op, m8, o0)); | 248 ScaledWithOffset32Matcher match29(graph()->NewNode(a_op, m8, o0)); |
235 CheckScaledWithOffsetMatch(&match29, p1, 3, o0, NULL); | 249 CheckScaledWithOffsetMatch(&match29, p1, 3, o0, NULL); |
236 | 250 |
237 // (C0 + M8) -> [p1, 2, NULL, C0] | 251 // (C15 + M8) -> [p1, 2, NULL, C15] |
238 m8 = graph()->NewNode(m_op, p1, c8); | 252 m8 = graph()->NewNode(m_op, p1, c8); |
239 ScaledWithOffsetMatcher match30(graph()->NewNode(a_op, c0, m8)); | 253 ScaledWithOffset32Matcher match30(graph()->NewNode(a_op, c15, m8)); |
240 CheckScaledWithOffsetMatch(&match30, p1, 3, NULL, c0); | 254 CheckScaledWithOffsetMatch(&match30, p1, 3, NULL, c15); |
241 | 255 |
242 // (M8 + C0) -> [p1, 2, NULL, C0] | 256 // (M8 + C15) -> [p1, 2, NULL, C15] |
243 m8 = graph()->NewNode(m_op, p1, c8); | 257 m8 = graph()->NewNode(m_op, p1, c8); |
244 ScaledWithOffsetMatcher match31(graph()->NewNode(a_op, m8, c0)); | 258 ScaledWithOffset32Matcher match31(graph()->NewNode(a_op, m8, c15)); |
245 CheckScaledWithOffsetMatch(&match31, p1, 3, NULL, c0); | 259 CheckScaledWithOffsetMatch(&match31, p1, 3, NULL, c15); |
246 | 260 |
247 // (O0 + S3) -> [p1, 2, O0, NULL] | 261 // (O0 + S3) -> [p1, 2, O0, NULL] |
248 ScaledWithOffsetMatcher match32(graph()->NewNode(a_op, o0, s3)); | 262 ScaledWithOffset32Matcher match32(graph()->NewNode(a_op, o0, s3)); |
249 CheckScaledWithOffsetMatch(&match32, p1, 3, o0, NULL); | 263 CheckScaledWithOffsetMatch(&match32, p1, 3, o0, NULL); |
250 | 264 |
251 // (S3 + O0) -> [p1, 2, O0, NULL] | 265 // (S3 + O0) -> [p1, 2, O0, NULL] |
252 s3 = graph()->NewNode(s_op, p1, c3); | 266 s3 = graph()->NewNode(s_op, p1, c3); |
253 ScaledWithOffsetMatcher match33(graph()->NewNode(a_op, s3, o0)); | 267 ScaledWithOffset32Matcher match33(graph()->NewNode(a_op, s3, o0)); |
254 CheckScaledWithOffsetMatch(&match33, p1, 3, o0, NULL); | 268 CheckScaledWithOffsetMatch(&match33, p1, 3, o0, NULL); |
255 | 269 |
256 // (C0 + S3) -> [p1, 2, NULL, C0] | 270 // (C15 + S3) -> [p1, 2, NULL, C15] |
257 s3 = graph()->NewNode(s_op, p1, c3); | 271 s3 = graph()->NewNode(s_op, p1, c3); |
258 ScaledWithOffsetMatcher match34(graph()->NewNode(a_op, c0, s3)); | 272 ScaledWithOffset32Matcher match34(graph()->NewNode(a_op, c15, s3)); |
259 CheckScaledWithOffsetMatch(&match34, p1, 3, NULL, c0); | 273 CheckScaledWithOffsetMatch(&match34, p1, 3, NULL, c15); |
260 | 274 |
261 // (S3 + C0) -> [p1, 2, NULL, C0] | 275 // (S3 + C15) -> [p1, 2, NULL, C15] |
262 s3 = graph()->NewNode(s_op, p1, c3); | 276 s3 = graph()->NewNode(s_op, p1, c3); |
263 ScaledWithOffsetMatcher match35(graph()->NewNode(a_op, s3, c0)); | 277 ScaledWithOffset32Matcher match35(graph()->NewNode(a_op, s3, c15)); |
264 CheckScaledWithOffsetMatch(&match35, p1, 3, NULL, c0); | 278 CheckScaledWithOffsetMatch(&match35, p1, 3, NULL, c15); |
265 | 279 |
266 // 2 INPUT - NEGATIVE CASES | 280 // 2 INPUT - NEGATIVE CASES |
267 | 281 |
268 // (M3 + O1) -> [O0, 0, M3, NULL] | 282 // (M3 + O1) -> [O0, 0, M3, NULL] |
269 ScaledWithOffsetMatcher match36(graph()->NewNode(a_op, o1, m3)); | 283 ScaledWithOffset32Matcher match36(graph()->NewNode(a_op, o1, m3)); |
270 CheckScaledWithOffsetMatch(&match36, m3, 0, o1, NULL); | 284 CheckScaledWithOffsetMatch(&match36, m3, 0, o1, NULL); |
271 | 285 |
272 // (S4 + O1) -> [O0, 0, S4, NULL] | 286 // (S4 + O1) -> [O0, 0, S4, NULL] |
273 ScaledWithOffsetMatcher match37(graph()->NewNode(a_op, o1, s4)); | 287 ScaledWithOffset32Matcher match37(graph()->NewNode(a_op, o1, s4)); |
274 CheckScaledWithOffsetMatch(&match37, s4, 0, o1, NULL); | 288 CheckScaledWithOffsetMatch(&match37, s4, 0, o1, NULL); |
275 | 289 |
276 // 3 INPUT | 290 // 3 INPUT |
277 | 291 |
278 // (C0 + S3) + O0 -> [p1, 2, o0, c0] | 292 // (C15 + S3) + O0 -> [p1, 2, o0, c15] |
279 s3 = graph()->NewNode(s_op, p1, c3); | 293 s3 = graph()->NewNode(s_op, p1, c3); |
280 ScaledWithOffsetMatcher match38( | 294 ScaledWithOffset32Matcher match38( |
281 graph()->NewNode(a_op, graph()->NewNode(a_op, c0, s3), o0)); | 295 graph()->NewNode(a_op, graph()->NewNode(a_op, c15, s3), o0)); |
282 CheckScaledWithOffsetMatch(&match38, p1, 3, o0, c0); | 296 CheckScaledWithOffsetMatch(&match38, p1, 3, o0, c15); |
283 | 297 |
284 // (O0 + C0) + S3 -> [p1, 2, o0, c0] | 298 // (O0 + C15) + S3 -> [p1, 2, o0, c15] |
285 s3 = graph()->NewNode(s_op, p1, c3); | 299 s3 = graph()->NewNode(s_op, p1, c3); |
286 ScaledWithOffsetMatcher match39( | 300 ScaledWithOffset32Matcher match39( |
287 graph()->NewNode(a_op, graph()->NewNode(a_op, o0, c0), s3)); | 301 graph()->NewNode(a_op, graph()->NewNode(a_op, o0, c15), s3)); |
288 CheckScaledWithOffsetMatch(&match39, p1, 3, o0, c0); | 302 CheckScaledWithOffsetMatch(&match39, p1, 3, o0, c15); |
289 | 303 |
290 // (S3 + O0) + C0 -> [p1, 2, o0, c0] | 304 // (S3 + O0) + C15 -> [p1, 2, o0, c15] |
291 s3 = graph()->NewNode(s_op, p1, c3); | 305 s3 = graph()->NewNode(s_op, p1, c3); |
292 ScaledWithOffsetMatcher match40( | 306 ScaledWithOffset32Matcher match40( |
293 graph()->NewNode(a_op, graph()->NewNode(a_op, s3, o0), c0)); | 307 graph()->NewNode(a_op, graph()->NewNode(a_op, s3, o0), c15)); |
294 CheckScaledWithOffsetMatch(&match40, p1, 3, o0, c0); | 308 CheckScaledWithOffsetMatch(&match40, p1, 3, o0, c15); |
295 | 309 |
296 // C0 + (S3 + O0) -> [p1, 2, o0, c0] | 310 // C15 + (S3 + O0) -> [p1, 2, o0, c15] |
297 s3 = graph()->NewNode(s_op, p1, c3); | 311 s3 = graph()->NewNode(s_op, p1, c3); |
298 ScaledWithOffsetMatcher match41( | 312 ScaledWithOffset32Matcher match41( |
299 graph()->NewNode(a_op, c0, graph()->NewNode(a_op, s3, o0))); | 313 graph()->NewNode(a_op, c15, graph()->NewNode(a_op, s3, o0))); |
300 CheckScaledWithOffsetMatch(&match41, p1, 3, o0, c0); | 314 CheckScaledWithOffsetMatch(&match41, p1, 3, o0, c15); |
301 | 315 |
302 // O0 + (C0 + S3) -> [p1, 2, o0, c0] | 316 // O0 + (C15 + S3) -> [p1, 2, o0, c15] |
303 s3 = graph()->NewNode(s_op, p1, c3); | 317 s3 = graph()->NewNode(s_op, p1, c3); |
304 ScaledWithOffsetMatcher match42( | 318 ScaledWithOffset32Matcher match42( |
305 graph()->NewNode(a_op, o0, graph()->NewNode(a_op, c0, s3))); | 319 graph()->NewNode(a_op, o0, graph()->NewNode(a_op, c15, s3))); |
306 CheckScaledWithOffsetMatch(&match42, p1, 3, o0, c0); | 320 CheckScaledWithOffsetMatch(&match42, p1, 3, o0, c15); |
307 | 321 |
308 // S3 + (O0 + C0) -> [p1, 2, o0, c0] | 322 // S3 + (O0 + C15) -> [p1, 2, o0, c15] |
309 s3 = graph()->NewNode(s_op, p1, c3); | 323 s3 = graph()->NewNode(s_op, p1, c3); |
310 ScaledWithOffsetMatcher match43( | 324 ScaledWithOffset32Matcher match43( |
311 graph()->NewNode(a_op, s3, graph()->NewNode(a_op, o0, c0))); | 325 graph()->NewNode(a_op, s3, graph()->NewNode(a_op, o0, c15))); |
312 CheckScaledWithOffsetMatch(&match43, p1, 3, o0, c0); | 326 CheckScaledWithOffsetMatch(&match43, p1, 3, o0, c15); |
313 } | 327 } |
314 | 328 |
| 329 |
| 330 TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { |
| 331 graph()->SetStart(graph()->NewNode(common()->Start(0))); |
| 332 |
| 333 const Operator* c0_op = common()->Int64Constant(0); |
| 334 Node* c0 = graph()->NewNode(c0_op); |
| 335 USE(c0); |
| 336 const Operator* c1_op = common()->Int64Constant(1); |
| 337 Node* c1 = graph()->NewNode(c1_op); |
| 338 USE(c1); |
| 339 const Operator* c2_op = common()->Int64Constant(2); |
| 340 Node* c2 = graph()->NewNode(c2_op); |
| 341 USE(c2); |
| 342 const Operator* c3_op = common()->Int64Constant(3); |
| 343 Node* c3 = graph()->NewNode(c3_op); |
| 344 USE(c3); |
| 345 const Operator* c4_op = common()->Int64Constant(4); |
| 346 Node* c4 = graph()->NewNode(c4_op); |
| 347 USE(c4); |
| 348 const Operator* c8_op = common()->Int64Constant(8); |
| 349 Node* c8 = graph()->NewNode(c8_op); |
| 350 USE(c8); |
| 351 const Operator* c15_op = common()->Int64Constant(15); |
| 352 Node* c15 = graph()->NewNode(c15_op); |
| 353 USE(c15); |
| 354 |
| 355 const Operator* o0_op = common()->Parameter(0); |
| 356 Node* o0 = graph()->NewNode(o0_op, graph()->start()); |
| 357 USE(o0); |
| 358 const Operator* o1_op = common()->Parameter(1); |
| 359 Node* o1 = graph()->NewNode(o1_op, graph()->start()); |
| 360 USE(o0); |
| 361 |
| 362 const Operator* p1_op = common()->Parameter(3); |
| 363 Node* p1 = graph()->NewNode(p1_op, graph()->start()); |
| 364 USE(p1); |
| 365 |
| 366 const Operator* a_op = machine()->Int64Add(); |
| 367 USE(a_op); |
| 368 |
| 369 const Operator* m_op = machine()->Int64Mul(); |
| 370 Node* m1 = graph()->NewNode(m_op, p1, c1); |
| 371 Node* m2 = graph()->NewNode(m_op, p1, c2); |
| 372 Node* m4 = graph()->NewNode(m_op, p1, c4); |
| 373 Node* m8 = graph()->NewNode(m_op, p1, c8); |
| 374 Node* m3 = graph()->NewNode(m_op, p1, c3); |
| 375 USE(m1); |
| 376 USE(m2); |
| 377 USE(m4); |
| 378 USE(m8); |
| 379 USE(m3); |
| 380 |
| 381 const Operator* s_op = machine()->Word64Shl(); |
| 382 Node* s0 = graph()->NewNode(s_op, p1, c0); |
| 383 Node* s1 = graph()->NewNode(s_op, p1, c1); |
| 384 Node* s2 = graph()->NewNode(s_op, p1, c2); |
| 385 Node* s3 = graph()->NewNode(s_op, p1, c3); |
| 386 Node* s4 = graph()->NewNode(s_op, p1, c4); |
| 387 USE(s0); |
| 388 USE(s1); |
| 389 USE(s2); |
| 390 USE(s3); |
| 391 USE(s4); |
| 392 |
| 393 // 1 INPUT |
| 394 |
| 395 // Only relevant test cases is checking for non-match. |
| 396 ScaledWithOffset64Matcher match0(c15); |
| 397 EXPECT_FALSE(match0.matches()); |
| 398 |
| 399 // 2 INPUT |
| 400 |
| 401 // (O0 + O1) -> [O0, 0, O1, NULL] |
| 402 ScaledWithOffset64Matcher match1(graph()->NewNode(a_op, o0, o1)); |
| 403 CheckScaledWithOffsetMatch(&match1, o1, 0, o0, NULL); |
| 404 |
| 405 // (O0 + C15) -> [NULL, 0, O0, C15] |
| 406 ScaledWithOffset64Matcher match2(graph()->NewNode(a_op, o0, c15)); |
| 407 CheckScaledWithOffsetMatch(&match2, NULL, 0, o0, c15); |
| 408 |
| 409 // (C15 + O0) -> [NULL, 0, O0, C15] |
| 410 ScaledWithOffset64Matcher match3(graph()->NewNode(a_op, c15, o0)); |
| 411 CheckScaledWithOffsetMatch(&match3, NULL, 0, o0, c15); |
| 412 |
| 413 // (O0 + M1) -> [p1, 0, O0, NULL] |
| 414 ScaledWithOffset64Matcher match4(graph()->NewNode(a_op, o0, m1)); |
| 415 CheckScaledWithOffsetMatch(&match4, p1, 0, o0, NULL); |
| 416 |
| 417 // (M1 + O0) -> [p1, 0, O0, NULL] |
| 418 m1 = graph()->NewNode(m_op, p1, c1); |
| 419 ScaledWithOffset64Matcher match5(graph()->NewNode(a_op, m1, o0)); |
| 420 CheckScaledWithOffsetMatch(&match5, p1, 0, o0, NULL); |
| 421 |
| 422 // (C15 + M1) -> [P1, 0, NULL, C15] |
| 423 m1 = graph()->NewNode(m_op, p1, c1); |
| 424 ScaledWithOffset64Matcher match6(graph()->NewNode(a_op, c15, m1)); |
| 425 CheckScaledWithOffsetMatch(&match6, p1, 0, NULL, c15); |
| 426 |
| 427 // (M1 + C15) -> [P1, 0, NULL, C15] |
| 428 m1 = graph()->NewNode(m_op, p1, c1); |
| 429 ScaledWithOffset64Matcher match7(graph()->NewNode(a_op, m1, c15)); |
| 430 CheckScaledWithOffsetMatch(&match7, p1, 0, NULL, c15); |
| 431 |
| 432 // (O0 + S0) -> [p1, 0, O0, NULL] |
| 433 ScaledWithOffset64Matcher match8(graph()->NewNode(a_op, o0, s0)); |
| 434 CheckScaledWithOffsetMatch(&match8, p1, 0, o0, NULL); |
| 435 |
| 436 // (S0 + O0) -> [p1, 0, O0, NULL] |
| 437 s0 = graph()->NewNode(s_op, p1, c0); |
| 438 ScaledWithOffset64Matcher match9(graph()->NewNode(a_op, s0, o0)); |
| 439 CheckScaledWithOffsetMatch(&match9, p1, 0, o0, NULL); |
| 440 |
| 441 // (C15 + S0) -> [P1, 0, NULL, C15] |
| 442 s0 = graph()->NewNode(s_op, p1, c0); |
| 443 ScaledWithOffset64Matcher match10(graph()->NewNode(a_op, c15, s0)); |
| 444 CheckScaledWithOffsetMatch(&match10, p1, 0, NULL, c15); |
| 445 |
| 446 // (S0 + C15) -> [P1, 0, NULL, C15] |
| 447 s0 = graph()->NewNode(s_op, p1, c0); |
| 448 ScaledWithOffset64Matcher match11(graph()->NewNode(a_op, s0, c15)); |
| 449 CheckScaledWithOffsetMatch(&match11, p1, 0, NULL, c15); |
| 450 |
| 451 // (O0 + M2) -> [p1, 1, O0, NULL] |
| 452 ScaledWithOffset64Matcher match12(graph()->NewNode(a_op, o0, m2)); |
| 453 CheckScaledWithOffsetMatch(&match12, p1, 1, o0, NULL); |
| 454 |
| 455 // (M2 + O0) -> [p1, 1, O0, NULL] |
| 456 m2 = graph()->NewNode(m_op, p1, c2); |
| 457 ScaledWithOffset64Matcher match13(graph()->NewNode(a_op, m2, o0)); |
| 458 CheckScaledWithOffsetMatch(&match13, p1, 1, o0, NULL); |
| 459 |
| 460 // (C15 + M2) -> [P1, 1, NULL, C15] |
| 461 m2 = graph()->NewNode(m_op, p1, c2); |
| 462 ScaledWithOffset64Matcher match14(graph()->NewNode(a_op, c15, m2)); |
| 463 CheckScaledWithOffsetMatch(&match14, p1, 1, NULL, c15); |
| 464 |
| 465 // (M2 + C15) -> [P1, 1, NULL, C15] |
| 466 m2 = graph()->NewNode(m_op, p1, c2); |
| 467 ScaledWithOffset64Matcher match15(graph()->NewNode(a_op, m2, c15)); |
| 468 CheckScaledWithOffsetMatch(&match15, p1, 1, NULL, c15); |
| 469 |
| 470 // (O0 + S1) -> [p1, 1, O0, NULL] |
| 471 ScaledWithOffset64Matcher match16(graph()->NewNode(a_op, o0, s1)); |
| 472 CheckScaledWithOffsetMatch(&match16, p1, 1, o0, NULL); |
| 473 |
| 474 // (S1 + O0) -> [p1, 1, O0, NULL] |
| 475 s1 = graph()->NewNode(s_op, p1, c1); |
| 476 ScaledWithOffset64Matcher match17(graph()->NewNode(a_op, s1, o0)); |
| 477 CheckScaledWithOffsetMatch(&match17, p1, 1, o0, NULL); |
| 478 |
| 479 // (C15 + S1) -> [P1, 1, NULL, C15] |
| 480 s1 = graph()->NewNode(s_op, p1, c1); |
| 481 ScaledWithOffset64Matcher match18(graph()->NewNode(a_op, c15, s1)); |
| 482 CheckScaledWithOffsetMatch(&match18, p1, 1, NULL, c15); |
| 483 |
| 484 // (S1 + C15) -> [P1, 1, NULL, C15] |
| 485 s1 = graph()->NewNode(s_op, p1, c1); |
| 486 ScaledWithOffset64Matcher match19(graph()->NewNode(a_op, s1, c15)); |
| 487 CheckScaledWithOffsetMatch(&match19, p1, 1, NULL, c15); |
| 488 |
| 489 // (O0 + M4) -> [p1, 2, O0, NULL] |
| 490 ScaledWithOffset64Matcher match20(graph()->NewNode(a_op, o0, m4)); |
| 491 CheckScaledWithOffsetMatch(&match20, p1, 2, o0, NULL); |
| 492 |
| 493 // (M4 + O0) -> [p1, 2, O0, NULL] |
| 494 m4 = graph()->NewNode(m_op, p1, c4); |
| 495 ScaledWithOffset64Matcher match21(graph()->NewNode(a_op, m4, o0)); |
| 496 CheckScaledWithOffsetMatch(&match21, p1, 2, o0, NULL); |
| 497 |
| 498 // (C15 + M4) -> [p1, 2, NULL, C15] |
| 499 m4 = graph()->NewNode(m_op, p1, c4); |
| 500 ScaledWithOffset64Matcher match22(graph()->NewNode(a_op, c15, m4)); |
| 501 CheckScaledWithOffsetMatch(&match22, p1, 2, NULL, c15); |
| 502 |
| 503 // (M4 + C15) -> [p1, 2, NULL, C15] |
| 504 m4 = graph()->NewNode(m_op, p1, c4); |
| 505 ScaledWithOffset64Matcher match23(graph()->NewNode(a_op, m4, c15)); |
| 506 CheckScaledWithOffsetMatch(&match23, p1, 2, NULL, c15); |
| 507 |
| 508 // (O0 + S2) -> [p1, 2, O0, NULL] |
| 509 ScaledWithOffset64Matcher match24(graph()->NewNode(a_op, o0, s2)); |
| 510 CheckScaledWithOffsetMatch(&match24, p1, 2, o0, NULL); |
| 511 |
| 512 // (S2 + O0) -> [p1, 2, O0, NULL] |
| 513 s2 = graph()->NewNode(s_op, p1, c2); |
| 514 ScaledWithOffset64Matcher match25(graph()->NewNode(a_op, s2, o0)); |
| 515 CheckScaledWithOffsetMatch(&match25, p1, 2, o0, NULL); |
| 516 |
| 517 // (C15 + S2) -> [p1, 2, NULL, C15] |
| 518 s2 = graph()->NewNode(s_op, p1, c2); |
| 519 ScaledWithOffset64Matcher match26(graph()->NewNode(a_op, c15, s2)); |
| 520 CheckScaledWithOffsetMatch(&match26, p1, 2, NULL, c15); |
| 521 |
| 522 // (S2 + C15) -> [p1, 2, NULL, C15] |
| 523 s2 = graph()->NewNode(s_op, p1, c2); |
| 524 ScaledWithOffset64Matcher match27(graph()->NewNode(a_op, s2, c15)); |
| 525 CheckScaledWithOffsetMatch(&match27, p1, 2, NULL, c15); |
| 526 |
| 527 // (O0 + M8) -> [p1, 2, O0, NULL] |
| 528 ScaledWithOffset64Matcher match28(graph()->NewNode(a_op, o0, m8)); |
| 529 CheckScaledWithOffsetMatch(&match28, p1, 3, o0, NULL); |
| 530 |
| 531 // (M8 + O0) -> [p1, 2, O0, NULL] |
| 532 m8 = graph()->NewNode(m_op, p1, c8); |
| 533 ScaledWithOffset64Matcher match29(graph()->NewNode(a_op, m8, o0)); |
| 534 CheckScaledWithOffsetMatch(&match29, p1, 3, o0, NULL); |
| 535 |
| 536 // (C15 + M8) -> [p1, 2, NULL, C15] |
| 537 m8 = graph()->NewNode(m_op, p1, c8); |
| 538 ScaledWithOffset64Matcher match30(graph()->NewNode(a_op, c15, m8)); |
| 539 CheckScaledWithOffsetMatch(&match30, p1, 3, NULL, c15); |
| 540 |
| 541 // (M8 + C15) -> [p1, 2, NULL, C15] |
| 542 m8 = graph()->NewNode(m_op, p1, c8); |
| 543 ScaledWithOffset64Matcher match31(graph()->NewNode(a_op, m8, c15)); |
| 544 CheckScaledWithOffsetMatch(&match31, p1, 3, NULL, c15); |
| 545 |
| 546 // (O0 + S3) -> [p1, 2, O0, NULL] |
| 547 ScaledWithOffset64Matcher match64(graph()->NewNode(a_op, o0, s3)); |
| 548 CheckScaledWithOffsetMatch(&match64, p1, 3, o0, NULL); |
| 549 |
| 550 // (S3 + O0) -> [p1, 2, O0, NULL] |
| 551 s3 = graph()->NewNode(s_op, p1, c3); |
| 552 ScaledWithOffset64Matcher match33(graph()->NewNode(a_op, s3, o0)); |
| 553 CheckScaledWithOffsetMatch(&match33, p1, 3, o0, NULL); |
| 554 |
| 555 // (C15 + S3) -> [p1, 2, NULL, C15] |
| 556 s3 = graph()->NewNode(s_op, p1, c3); |
| 557 ScaledWithOffset64Matcher match34(graph()->NewNode(a_op, c15, s3)); |
| 558 CheckScaledWithOffsetMatch(&match34, p1, 3, NULL, c15); |
| 559 |
| 560 // (S3 + C15) -> [p1, 2, NULL, C15] |
| 561 s3 = graph()->NewNode(s_op, p1, c3); |
| 562 ScaledWithOffset64Matcher match35(graph()->NewNode(a_op, s3, c15)); |
| 563 CheckScaledWithOffsetMatch(&match35, p1, 3, NULL, c15); |
| 564 |
| 565 // 2 INPUT - NEGATIVE CASES |
| 566 |
| 567 // (M3 + O1) -> [O0, 0, M3, NULL] |
| 568 ScaledWithOffset64Matcher match36(graph()->NewNode(a_op, o1, m3)); |
| 569 CheckScaledWithOffsetMatch(&match36, m3, 0, o1, NULL); |
| 570 |
| 571 // (S4 + O1) -> [O0, 0, S4, NULL] |
| 572 ScaledWithOffset64Matcher match37(graph()->NewNode(a_op, o1, s4)); |
| 573 CheckScaledWithOffsetMatch(&match37, s4, 0, o1, NULL); |
| 574 |
| 575 // 3 INPUT |
| 576 |
| 577 // (C15 + S3) + O0 -> [p1, 2, o0, c15] |
| 578 s3 = graph()->NewNode(s_op, p1, c3); |
| 579 ScaledWithOffset64Matcher match38( |
| 580 graph()->NewNode(a_op, graph()->NewNode(a_op, c15, s3), o0)); |
| 581 CheckScaledWithOffsetMatch(&match38, p1, 3, o0, c15); |
| 582 |
| 583 // (O0 + C15) + S3 -> [p1, 2, o0, c15] |
| 584 s3 = graph()->NewNode(s_op, p1, c3); |
| 585 ScaledWithOffset64Matcher match39( |
| 586 graph()->NewNode(a_op, graph()->NewNode(a_op, o0, c15), s3)); |
| 587 CheckScaledWithOffsetMatch(&match39, p1, 3, o0, c15); |
| 588 |
| 589 // (S3 + O0) + C15 -> [p1, 2, o0, c15] |
| 590 s3 = graph()->NewNode(s_op, p1, c3); |
| 591 ScaledWithOffset64Matcher match40( |
| 592 graph()->NewNode(a_op, graph()->NewNode(a_op, s3, o0), c15)); |
| 593 CheckScaledWithOffsetMatch(&match40, p1, 3, o0, c15); |
| 594 |
| 595 // C15 + (S3 + O0) -> [p1, 2, o0, c15] |
| 596 s3 = graph()->NewNode(s_op, p1, c3); |
| 597 ScaledWithOffset64Matcher match41( |
| 598 graph()->NewNode(a_op, c15, graph()->NewNode(a_op, s3, o0))); |
| 599 CheckScaledWithOffsetMatch(&match41, p1, 3, o0, c15); |
| 600 |
| 601 // O0 + (C15 + S3) -> [p1, 2, o0, c15] |
| 602 s3 = graph()->NewNode(s_op, p1, c3); |
| 603 ScaledWithOffset64Matcher match42( |
| 604 graph()->NewNode(a_op, o0, graph()->NewNode(a_op, c15, s3))); |
| 605 CheckScaledWithOffsetMatch(&match42, p1, 3, o0, c15); |
| 606 |
| 607 // S3 + (O0 + C15) -> [p1, 2, o0, c15] |
| 608 s3 = graph()->NewNode(s_op, p1, c3); |
| 609 ScaledWithOffset64Matcher match43( |
| 610 graph()->NewNode(a_op, s3, graph()->NewNode(a_op, o0, c15))); |
| 611 CheckScaledWithOffsetMatch(&match43, p1, 3, o0, c15); |
| 612 } |
| 613 |
| 614 |
315 } // namespace compiler | 615 } // namespace compiler |
316 } // namespace internal | 616 } // namespace internal |
317 } // namespace v8 | 617 } // namespace v8 |
OLD | NEW |