Lines Matching refs:m
50 Int32BinopMatcher m(node); in Reduce() local
51 if (m.right().Is(0)) return Replace(m.right().node()); // x & 0 => 0 in Reduce()
52 if (m.right().Is(-1)) return Replace(m.left().node()); // x & -1 => x in Reduce()
53 if (m.IsFoldable()) { // K & K => K in Reduce()
54 return ReplaceInt32(m.left().Value() & m.right().Value()); in Reduce()
56 if (m.LeftEqualsRight()) return Replace(m.left().node()); // x & x => x in Reduce()
60 Int32BinopMatcher m(node); in Reduce() local
61 if (m.right().Is(0)) return Replace(m.left().node()); // x | 0 => x in Reduce()
62 if (m.right().Is(-1)) return Replace(m.right().node()); // x | -1 => -1 in Reduce()
63 if (m.IsFoldable()) { // K | K => K in Reduce()
64 return ReplaceInt32(m.left().Value() | m.right().Value()); in Reduce()
66 if (m.LeftEqualsRight()) return Replace(m.left().node()); // x | x => x in Reduce()
67 if (m.left().IsWord32Shl() && m.right().IsWord32Shr()) { in Reduce()
68 Int32BinopMatcher mleft(m.left().node()); in Reduce()
69 Int32BinopMatcher mright(m.right().node()); in Reduce()
92 if (m.left().IsWord32Shr() && m.right().IsWord32Shl()) { in Reduce()
94 Int32BinopMatcher mleft(m.left().node()); in Reduce()
95 Int32BinopMatcher mright(m.right().node()); in Reduce()
120 Int32BinopMatcher m(node); in Reduce() local
121 if (m.right().Is(0)) return Replace(m.left().node()); // x ^ 0 => x in Reduce()
122 if (m.IsFoldable()) { // K ^ K => K in Reduce()
123 return ReplaceInt32(m.left().Value() ^ m.right().Value()); in Reduce()
125 if (m.LeftEqualsRight()) return ReplaceInt32(0); // x ^ x => 0 in Reduce()
129 Int32BinopMatcher m(node); in Reduce() local
130 if (m.right().Is(0)) return Replace(m.left().node()); // x << 0 => x in Reduce()
131 if (m.IsFoldable()) { // K << K => K in Reduce()
132 return ReplaceInt32(m.left().Value() << m.right().Value()); in Reduce()
137 Uint32BinopMatcher m(node); in Reduce() local
138 if (m.right().Is(0)) return Replace(m.left().node()); // x >>> 0 => x in Reduce()
139 if (m.IsFoldable()) { // K >>> K => K in Reduce()
140 return ReplaceInt32(m.left().Value() >> m.right().Value()); in Reduce()
145 Int32BinopMatcher m(node); in Reduce() local
146 if (m.right().Is(0)) return Replace(m.left().node()); // x >> 0 => x in Reduce()
147 if (m.IsFoldable()) { // K >> K => K in Reduce()
148 return ReplaceInt32(m.left().Value() >> m.right().Value()); in Reduce()
153 Int32BinopMatcher m(node); in Reduce() local
154 if (m.right().Is(0)) return Replace(m.left().node()); // x ror 0 => x in Reduce()
155 if (m.IsFoldable()) { // K ror K => K in Reduce()
157 base::bits::RotateRight32(m.left().Value(), m.right().Value())); in Reduce()
162 Int32BinopMatcher m(node); in Reduce() local
163 if (m.IsFoldable()) { // K == K => K in Reduce()
164 return ReplaceBool(m.left().Value() == m.right().Value()); in Reduce()
166 if (m.left().IsInt32Sub() && m.right().Is(0)) { // x - y == 0 => x == y in Reduce()
167 Int32BinopMatcher msub(m.left().node()); in Reduce()
173 if (m.LeftEqualsRight()) return ReplaceBool(true); // x == x => true in Reduce()
177 Int32BinopMatcher m(node); in Reduce() local
178 if (m.right().Is(0)) return Replace(m.left().node()); // x + 0 => x in Reduce()
179 if (m.IsFoldable()) { // K + K => K in Reduce()
180 return ReplaceInt32(static_cast<uint32_t>(m.left().Value()) + in Reduce()
181 static_cast<uint32_t>(m.right().Value())); in Reduce()
186 Int32BinopMatcher m(node); in Reduce() local
187 if (m.right().Is(0)) return Replace(m.left().node()); // x - 0 => x in Reduce()
188 if (m.IsFoldable()) { // K - K => K in Reduce()
189 return ReplaceInt32(static_cast<uint32_t>(m.left().Value()) - in Reduce()
190 static_cast<uint32_t>(m.right().Value())); in Reduce()
192 if (m.LeftEqualsRight()) return ReplaceInt32(0); // x - x => 0 in Reduce()
196 Int32BinopMatcher m(node); in Reduce() local
197 if (m.right().Is(0)) return Replace(m.right().node()); // x * 0 => 0 in Reduce()
198 if (m.right().Is(1)) return Replace(m.left().node()); // x * 1 => x in Reduce()
199 if (m.IsFoldable()) { // K * K => K in Reduce()
200 return ReplaceInt32(m.left().Value() * m.right().Value()); in Reduce()
202 if (m.right().Is(-1)) { // x * -1 => 0 - x in Reduce()
205 node->ReplaceInput(1, m.left().node()); in Reduce()
208 if (m.right().IsPowerOf2()) { // x * 2^n => x << n in Reduce()
210 node->ReplaceInput(1, Int32Constant(WhichPowerOf2(m.right().Value()))); in Reduce()
216 Int32BinopMatcher m(node); in Reduce() local
217 if (m.right().Is(1)) return Replace(m.left().node()); // x / 1 => x in Reduce()
222 if (m.IsFoldable() && !m.right().Is(0)) { // K / K => K in Reduce()
223 if (m.right().Is(-1)) return ReplaceInt32(-m.left().Value()); in Reduce()
224 return ReplaceInt32(m.left().Value() / m.right().Value()); in Reduce()
226 if (m.right().Is(-1)) { // x / -1 => 0 - x in Reduce()
229 node->ReplaceInput(1, m.left().node()); in Reduce()
235 Uint32BinopMatcher m(node); in Reduce() local
236 if (m.right().Is(1)) return Replace(m.left().node()); // x / 1 => x in Reduce()
240 if (m.IsFoldable() && !m.right().Is(0)) { // K / K => K in Reduce()
241 return ReplaceInt32(m.left().Value() / m.right().Value()); in Reduce()
243 if (m.right().IsPowerOf2()) { // x / 2^n => x >> n in Reduce()
245 node->ReplaceInput(1, Int32Constant(WhichPowerOf2(m.right().Value()))); in Reduce()
251 Int32BinopMatcher m(node); in Reduce() local
252 if (m.right().Is(1)) return ReplaceInt32(0); // x % 1 => 0 in Reduce()
253 if (m.right().Is(-1)) return ReplaceInt32(0); // x % -1 => 0 in Reduce()
258 if (m.IsFoldable() && !m.right().Is(0)) { // K % K => K in Reduce()
259 return ReplaceInt32(m.left().Value() % m.right().Value()); in Reduce()
264 Uint32BinopMatcher m(node); in Reduce() local
265 if (m.right().Is(1)) return ReplaceInt32(0); // x % 1 => 0 in Reduce()
269 if (m.IsFoldable() && !m.right().Is(0)) { // K % K => K in Reduce()
270 return ReplaceInt32(m.left().Value() % m.right().Value()); in Reduce()
272 if (m.right().IsPowerOf2()) { // x % 2^n => x & 2^n-1 in Reduce()
274 node->ReplaceInput(1, Int32Constant(m.right().Value() - 1)); in Reduce()
280 Int32BinopMatcher m(node); in Reduce() local
281 if (m.IsFoldable()) { // K < K => K in Reduce()
282 return ReplaceBool(m.left().Value() < m.right().Value()); in Reduce()
284 if (m.left().IsInt32Sub() && m.right().Is(0)) { // x - y < 0 => x < y in Reduce()
285 Int32BinopMatcher msub(m.left().node()); in Reduce()
290 if (m.left().Is(0) && m.right().IsInt32Sub()) { // 0 < x - y => y < x in Reduce()
291 Int32BinopMatcher msub(m.right().node()); in Reduce()
296 if (m.LeftEqualsRight()) return ReplaceBool(false); // x < x => false in Reduce()
300 Int32BinopMatcher m(node); in Reduce() local
301 if (m.IsFoldable()) { // K <= K => K in Reduce()
302 return ReplaceBool(m.left().Value() <= m.right().Value()); in Reduce()
304 if (m.left().IsInt32Sub() && m.right().Is(0)) { // x - y <= 0 => x <= y in Reduce()
305 Int32BinopMatcher msub(m.left().node()); in Reduce()
310 if (m.left().Is(0) && m.right().IsInt32Sub()) { // 0 <= x - y => y <= x in Reduce()
311 Int32BinopMatcher msub(m.right().node()); in Reduce()
316 if (m.LeftEqualsRight()) return ReplaceBool(true); // x <= x => true in Reduce()
320 Uint32BinopMatcher m(node); in Reduce() local
321 if (m.left().Is(kMaxUInt32)) return ReplaceBool(false); // M < x => false in Reduce()
322 if (m.right().Is(0)) return ReplaceBool(false); // x < 0 => false in Reduce()
323 if (m.IsFoldable()) { // K < K => K in Reduce()
324 return ReplaceBool(m.left().Value() < m.right().Value()); in Reduce()
326 if (m.LeftEqualsRight()) return ReplaceBool(false); // x < x => false in Reduce()
330 Uint32BinopMatcher m(node); in Reduce() local
331 if (m.left().Is(0)) return ReplaceBool(true); // 0 <= x => true in Reduce()
332 if (m.right().Is(kMaxUInt32)) return ReplaceBool(true); // x <= M => true in Reduce()
333 if (m.IsFoldable()) { // K <= K => K in Reduce()
334 return ReplaceBool(m.left().Value() <= m.right().Value()); in Reduce()
336 if (m.LeftEqualsRight()) return ReplaceBool(true); // x <= x => true in Reduce()
340 Float64BinopMatcher m(node); in Reduce() local
341 if (m.IsFoldable()) { // K + K => K in Reduce()
342 return ReplaceFloat64(m.left().Value() + m.right().Value()); in Reduce()
347 Float64BinopMatcher m(node); in Reduce() local
348 if (m.IsFoldable()) { // K - K => K in Reduce()
349 return ReplaceFloat64(m.left().Value() - m.right().Value()); in Reduce()
354 Float64BinopMatcher m(node); in Reduce() local
355 if (m.right().Is(1)) return Replace(m.left().node()); // x * 1.0 => x in Reduce()
356 if (m.right().IsNaN()) { // x * NaN => NaN in Reduce()
357 return Replace(m.right().node()); in Reduce()
359 if (m.IsFoldable()) { // K * K => K in Reduce()
360 return ReplaceFloat64(m.left().Value() * m.right().Value()); in Reduce()
365 Float64BinopMatcher m(node); in Reduce() local
366 if (m.right().Is(1)) return Replace(m.left().node()); // x / 1.0 => x in Reduce()
367 if (m.right().IsNaN()) { // x / NaN => NaN in Reduce()
368 return Replace(m.right().node()); in Reduce()
370 if (m.left().IsNaN()) { // NaN / x => NaN in Reduce()
371 return Replace(m.left().node()); in Reduce()
373 if (m.IsFoldable()) { // K / K => K in Reduce()
374 return ReplaceFloat64(m.left().Value() / m.right().Value()); in Reduce()
379 Float64BinopMatcher m(node); in Reduce() local
380 if (m.right().IsNaN()) { // x % NaN => NaN in Reduce()
381 return Replace(m.right().node()); in Reduce()
383 if (m.left().IsNaN()) { // NaN % x => NaN in Reduce()
384 return Replace(m.left().node()); in Reduce()
386 if (m.IsFoldable()) { // K % K => K in Reduce()
387 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); in Reduce()
392 Float32Matcher m(node->InputAt(0)); in Reduce() local
393 if (m.HasValue()) return ReplaceFloat64(m.Value()); in Reduce()
397 Float64Matcher m(node->InputAt(0)); in Reduce() local
398 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); in Reduce()
399 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); in Reduce()
403 Float64Matcher m(node->InputAt(0)); in Reduce() local
404 if (m.HasValue()) return ReplaceInt32(FastD2UI(m.Value())); in Reduce()
405 if (m.IsChangeUint32ToFloat64()) return Replace(m.node()->InputAt(0)); in Reduce()
409 Int32Matcher m(node->InputAt(0)); in Reduce() local
410 if (m.HasValue()) return ReplaceFloat64(FastI2D(m.Value())); in Reduce()
414 Int32Matcher m(node->InputAt(0)); in Reduce() local
415 if (m.HasValue()) return ReplaceInt64(m.Value()); in Reduce()
419 Uint32Matcher m(node->InputAt(0)); in Reduce() local
420 if (m.HasValue()) return ReplaceFloat64(FastUI2D(m.Value())); in Reduce()
424 Uint32Matcher m(node->InputAt(0)); in Reduce() local
425 if (m.HasValue()) return ReplaceInt64(static_cast<uint64_t>(m.Value())); in Reduce()
429 Float64Matcher m(node->InputAt(0)); in Reduce() local
430 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); in Reduce()
431 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); in Reduce()
435 Int64Matcher m(node->InputAt(0)); in Reduce() local
436 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); in Reduce()
437 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); in Reduce()
441 Float64Matcher m(node->InputAt(0)); in Reduce() local
442 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); in Reduce()
443 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); in Reduce()
457 Int32BinopMatcher m(node); in ReduceProjection() local
458 if (m.IsFoldable()) { in ReduceProjection()
460 bool ovf = base::bits::SignedAddOverflow32(m.left().Value(), in ReduceProjection()
461 m.right().Value(), &val); in ReduceProjection()
464 if (m.right().Is(0)) { in ReduceProjection()
465 return (index == 0) ? Replace(m.left().node()) : ReplaceInt32(0); in ReduceProjection()
471 Int32BinopMatcher m(node); in ReduceProjection() local
472 if (m.IsFoldable()) { in ReduceProjection()
474 bool ovf = base::bits::SignedSubOverflow32(m.left().Value(), in ReduceProjection()
475 m.right().Value(), &val); in ReduceProjection()
478 if (m.right().Is(0)) { in ReduceProjection()
479 return (index == 0) ? Replace(m.left().node()) : ReplaceInt32(0); in ReduceProjection()