Lines Matching full:right
170 if (m.right().Is(0)) return Replace(m.left().node()); // x ror 0 => x in Reduce()
173 base::bits::RotateRight32(m.left().Value(), m.right().Value())); in Reduce()
180 return ReplaceBool(m.left().Value() == m.right().Value()); in Reduce()
182 if (m.left().IsInt32Sub() && m.right().Is(0)) { // x - y == 0 => x == y in Reduce()
185 node->ReplaceInput(1, msub.right().node()); in Reduce()
195 return ReplaceBool(m.left().Value() == m.right().Value()); in Reduce()
197 if (m.left().IsInt64Sub() && m.right().Is(0)) { // x - y == 0 => x == y in Reduce()
200 node->ReplaceInput(1, msub.right().node()); in Reduce()
217 if (m.right().Is(0)) return Replace(m.right().node()); // x * 0 => 0 in Reduce()
218 if (m.right().Is(1)) return Replace(m.left().node()); // x * 1 => x in Reduce()
220 return ReplaceInt32(m.left().Value() * m.right().Value()); in Reduce()
222 if (m.right().Is(-1)) { // x * -1 => 0 - x in Reduce()
228 if (m.right().IsPowerOf2()) { // x * 2^n => x << n in Reduce()
229 node->ReplaceInput(1, Int32Constant(WhichPowerOf2(m.right().Value()))); in Reduce()
238 if (m.right().Is(2)) { in Reduce()
243 if (m.right().Is(-1)) { in Reduce()
262 return ReplaceBool(m.left().Value() < m.right().Value()); in Reduce()
265 if (m.left().IsWord32Or() && m.right().Is(0)) { in Reduce()
269 mleftmatcher.right().IsNegative()) { in Reduce()
278 return ReplaceBool(m.left().Value() <= m.right().Value()); in Reduce()
286 if (m.right().Is(0)) return ReplaceBool(false); // x < 0 => false in Reduce()
288 return ReplaceBool(m.left().Value() < m.right().Value()); in Reduce()
291 if (m.left().IsWord32Sar() && m.right().HasValue()) { in Reduce()
293 if (mleft.right().HasValue()) { in Reduce()
296 const uint32_t c = m.right().Value(); in Reduce()
297 const uint32_t k = mleft.right().Value() & 0x1F; in Reduce()
311 if (m.right().Is(kMaxUInt32)) return ReplaceBool(true); // x <= M => true in Reduce()
313 return ReplaceBool(m.left().Value() <= m.right().Value()); in Reduce()
320 if (allow_signalling_nan_ && m.right().Is(0) && in Reduce()
321 (copysign(1.0, m.right().Value()) > 0)) { in Reduce()
324 if (m.right().IsNaN()) { // x - NaN => NaN in Reduce()
326 return ReplaceFloat32(m.right().Value() - m.right().Value()); in Reduce()
333 return ReplaceFloat32(m.left().Value() - m.right().Value()); in Reduce()
338 m.right().IsFloat32RoundDown()) { in Reduce()
339 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat32Sub) { in Reduce()
340 Float32BinopMatcher mright0(m.right().InputAt(0)); in Reduce()
343 mright0.right().node())); in Reduce()
357 return ReplaceFloat64(m.left().Value() + m.right().Value()); in Reduce()
363 if (allow_signalling_nan_ && m.right().Is(0) && in Reduce()
364 (Double(m.right().Value()).Sign() > 0)) { in Reduce()
367 if (m.right().IsNaN()) { // x - NaN => NaN in Reduce()
369 return ReplaceFloat64(m.right().Value() - m.right().Value()); in Reduce()
376 return ReplaceFloat64(m.left().Value() - m.right().Value()); in Reduce()
381 m.right().IsFloat64RoundDown()) { in Reduce()
382 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub) { in Reduce()
383 Float64BinopMatcher mright0(m.right().InputAt(0)); in Reduce()
386 mright0.right().node())); in Reduce()
399 if (allow_signalling_nan_ && m.right().Is(1)) in Reduce()
401 if (m.right().Is(-1)) { // x * -1.0 => -0.0 - x in Reduce()
407 if (m.right().IsNaN()) { // x * NaN => NaN in Reduce()
409 return ReplaceFloat64(m.right().Value() - m.right().Value()); in Reduce()
412 return ReplaceFloat64(m.left().Value() * m.right().Value()); in Reduce()
414 if (m.right().Is(2)) { // x * 2.0 => x + x in Reduce()
423 if (allow_signalling_nan_ && m.right().Is(1)) in Reduce()
426 if (m.right().IsNaN()) { // x / NaN => NaN in Reduce()
428 return ReplaceFloat64(m.right().Value() - m.right().Value()); in Reduce()
435 return ReplaceFloat64(m.left().Value() / m.right().Value()); in Reduce()
437 if (allow_signalling_nan_ && m.right().Is(-1)) { // x / -1.0 => -x in Reduce()
442 if (m.right().IsNormal() && m.right().IsPositiveOrNegativePowerOf2()) { in Reduce()
446 node->ReplaceInput(1, Float64Constant(1.0 / m.right().Value())); in Reduce()
454 if (m.right().Is(0)) { // x % 0 => NaN in Reduce()
457 if (m.right().IsNaN()) { // x % NaN => NaN in Reduce()
458 return Replace(m.right().node()); in Reduce()
464 return ReplaceFloat64(Modulo(m.left().Value(), m.right().Value())); in Reduce()
500 if (m.right().IsNaN()) { in Reduce()
501 return Replace(m.right().node()); in Reduce()
508 base::ieee754::atan2(m.left().Value(), m.right().Value())); in Reduce()
560 return ReplaceFloat64(Pow(m.left().Value(), m.right().Value())); in Reduce()
561 } else if (m.right().Is(0.0)) { // x ** +-0.0 => 1.0 in Reduce()
563 } else if (m.right().Is(-2.0)) { // x ** -2.0 => 1 / (x * x) in Reduce()
568 } else if (m.right().Is(2.0)) { // x ** 2.0 => x * x in Reduce()
572 } else if (m.right().Is(-0.5)) { in Reduce()
578 } else if (m.right().Is(0.5)) { in Reduce()
702 if (m.right().Is(0)) return Replace(m.left().node()); // x + 0 => x in ReduceInt32Add()
705 bit_cast<uint32_t>(m.right().Value())); in ReduceInt32Add()
710 node->ReplaceInput(0, m.right().node()); in ReduceInt32Add()
711 node->ReplaceInput(1, mleft.right().node()); in ReduceInt32Add()
717 if (m.right().IsInt32Sub()) { in ReduceInt32Add()
718 Int32BinopMatcher mright(m.right().node()); in ReduceInt32Add()
720 node->ReplaceInput(1, mright.right().node()); in ReduceInt32Add()
732 if (m.right().Is(0)) return Replace(m.left().node()); // x + 0 => 0 in ReduceInt64Add()
735 bit_cast<uint64_t>(m.right().Value()))); in ReduceInt64Add()
743 if (m.right().Is(0)) return Replace(m.left().node()); // x - 0 => x in ReduceInt32Sub()
746 static_cast<uint32_t>(m.right().Value())); in ReduceInt32Sub()
749 if (m.right().HasValue()) { // x - K => x + -K in ReduceInt32Sub()
750 node->ReplaceInput(1, Int32Constant(-m.right().Value())); in ReduceInt32Sub()
761 if (m.right().Is(0)) return Replace(m.left().node()); // x - 0 => x in ReduceInt64Sub()
764 bit_cast<uint64_t>(m.right().Value()))); in ReduceInt64Sub()
767 if (m.right().HasValue()) { // x - K => x + -K in ReduceInt64Sub()
768 node->ReplaceInput(1, Int64Constant(-m.right().Value())); in ReduceInt64Sub()
779 if (m.right().Is(0)) return Replace(m.right().node()); // x / 0 => 0 in ReduceInt32Div()
780 if (m.right().Is(1)) return Replace(m.left().node()); // x / 1 => x in ReduceInt32Div()
783 base::bits::SignedDiv32(m.left().Value(), m.right().Value())); in ReduceInt32Div()
789 if (m.right().Is(-1)) { // x / -1 => 0 - x in ReduceInt32Div()
796 if (m.right().HasValue()) { in ReduceInt32Div()
797 int32_t const divisor = m.right().Value(); in ReduceInt32Div()
827 if (m.right().Is(0)) return Replace(m.right().node()); // x / 0 => 0 in ReduceUint32Div()
828 if (m.right().Is(1)) return Replace(m.left().node()); // x / 1 => x in ReduceUint32Div()
831 base::bits::UnsignedDiv32(m.left().Value(), m.right().Value())); in ReduceUint32Div()
837 if (m.right().HasValue()) { in ReduceUint32Div()
839 uint32_t const divisor = m.right().Value(); in ReduceUint32Div()
841 node->ReplaceInput(1, Uint32Constant(WhichPowerOf2(m.right().Value()))); in ReduceUint32Div()
856 if (m.right().Is(0)) return Replace(m.right().node()); // x % 0 => 0 in ReduceInt32Mod()
857 if (m.right().Is(1)) return ReplaceInt32(0); // x % 1 => 0 in ReduceInt32Mod()
858 if (m.right().Is(-1)) return ReplaceInt32(0); // x % -1 => 0 in ReduceInt32Mod()
862 base::bits::SignedMod32(m.left().Value(), m.right().Value())); in ReduceInt32Mod()
864 if (m.right().HasValue()) { in ReduceInt32Mod()
866 uint32_t const divisor = Abs(m.right().Value()); in ReduceInt32Mod()
893 if (m.right().Is(0)) return Replace(m.right().node()); // x % 0 => 0 in ReduceUint32Mod()
894 if (m.right().Is(1)) return ReplaceUint32(0); // x % 1 => 0 in ReduceUint32Mod()
898 base::bits::UnsignedMod32(m.left().Value(), m.right().Value())); in ReduceUint32Mod()
900 if (m.right().HasValue()) { in ReduceUint32Mod()
902 uint32_t const divisor = m.right().Value(); in ReduceUint32Mod()
904 node->ReplaceInput(1, Uint32Constant(m.right().Value() - 1)); in ReduceUint32Mod()
938 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && in ReduceStore()
939 (m.right().Value() & 0xFF) == 0xFF) || in ReduceStore()
941 (m.right().Value() & 0xFFFF) == 0xFFFF))) { in ReduceStore()
950 m.right().IsInRange(1, 24)) || in ReduceStore()
952 m.right().IsInRange(1, 16)))) { in ReduceStore()
954 if (mleft.right().Is(m.right().Value())) { in ReduceStore()
976 m.right().Value(), &val); in ReduceProjection()
979 if (m.right().Is(0)) { in ReduceProjection()
980 return Replace(index == 0 ? m.left().node() : m.right().node()); in ReduceProjection()
990 m.right().Value(), &val); in ReduceProjection()
993 if (m.right().Is(0)) { in ReduceProjection()
994 return Replace(index == 0 ? m.left().node() : m.right().node()); in ReduceProjection()
1004 m.right().Value(), &val); in ReduceProjection()
1007 if (m.right().Is(0)) { in ReduceProjection()
1008 return Replace(m.right().node()); in ReduceProjection()
1010 if (m.right().Is(1)) { in ReduceProjection()
1030 if (m.right().IsWord32And()) { in ReduceWord32Shifts()
1031 Int32BinopMatcher mright(m.right().node()); in ReduceWord32Shifts()
1032 if (mright.right().Is(0x1F)) { in ReduceWord32Shifts()
1045 if (m.right().Is(0)) return Replace(m.left().node()); // x << 0 => x in ReduceWord32Shl()
1047 return ReplaceInt32(m.left().Value() << m.right().Value()); in ReduceWord32Shl()
1049 if (m.right().IsInRange(1, 31)) { in ReduceWord32Shl()
1054 if (mleft.right().Is(m.right().Value())) { in ReduceWord32Shl()
1057 Uint32Constant(~((1U << m.right().Value()) - 1U))); in ReduceWord32Shl()
1070 if (m.right().Is(0)) return Replace(m.left().node()); // x << 0 => x in ReduceWord64Shl()
1072 return ReplaceInt64(m.left().Value() << m.right().Value()); in ReduceWord64Shl()
1079 if (m.right().Is(0)) return Replace(m.left().node()); // x >>> 0 => x in ReduceWord32Shr()
1081 return ReplaceInt32(m.left().Value() >> m.right().Value()); in ReduceWord32Shr()
1083 if (m.left().IsWord32And() && m.right().HasValue()) { in ReduceWord32Shr()
1085 if (mleft.right().HasValue()) { in ReduceWord32Shr()
1086 uint32_t shift = m.right().Value() & 0x1F; in ReduceWord32Shr()
1087 uint32_t mask = mleft.right().Value(); in ReduceWord32Shr()
1100 if (m.right().Is(0)) return Replace(m.left().node()); // x >>> 0 => x in ReduceWord64Shr()
1102 return ReplaceInt64(m.left().Value() >> m.right().Value()); in ReduceWord64Shr()
1109 if (m.right().Is(0)) return Replace(m.left().node()); // x >> 0 => x in ReduceWord32Sar()
1111 return ReplaceInt32(m.left().Value() >> m.right().Value()); in ReduceWord32Sar()
1116 if (m.right().Is(31) && mleft.right().Is(31)) { in ReduceWord32Sar()
1127 if (m.right().Is(24) && mleft.right().Is(24) && in ReduceWord32Sar()
1132 if (m.right().Is(16) && mleft.right().Is(16) && in ReduceWord32Sar()
1144 if (m.right().Is(0)) return Replace(m.left().node()); // x >> 0 => x in ReduceWord64Sar()
1146 return ReplaceInt64(m.left().Value() >> m.right().Value()); in ReduceWord64Sar()
1154 if (m.right().Is(0)) return Replace(m.right().node()); // x & 0 => 0 in ReduceWord32And()
1155 if (m.right().Is(-1)) return Replace(m.left().node()); // x & -1 => x in ReduceWord32And()
1156 if (m.left().IsComparison() && m.right().Is(1)) { // CMP & 1 => CMP in ReduceWord32And()
1160 return ReplaceInt32(m.left().Value() & m.right().Value()); in ReduceWord32And()
1163 if (m.left().IsWord32And() && m.right().HasValue()) { in ReduceWord32And()
1165 if (mleft.right().HasValue()) { // (x & K) & K => x & K in ReduceWord32And()
1168 1, Int32Constant(m.right().Value() & mleft.right().Value())); in ReduceWord32And()
1173 if (m.right().IsNegativePowerOf2()) { in ReduceWord32And()
1174 int32_t const mask = m.right().Value(); in ReduceWord32And()
1177 if (mleft.right().HasValue() && in ReduceWord32And()
1178 (mleft.right().Value() & 0x1F) >= in ReduceWord32And()
1185 if (mleft.right().HasValue() && in ReduceWord32And()
1186 (mleft.right().Value() & mask) == mleft.right().Value()) { in ReduceWord32And()
1188 node->ReplaceInput(0, Word32And(mleft.left().node(), m.right().node())); in ReduceWord32And()
1189 node->ReplaceInput(1, mleft.right().node()); in ReduceWord32And()
1196 if (mleftleft.right().IsMultipleOf(-mask)) { in ReduceWord32And()
1199 Word32And(mleft.right().node(), m.right().node())); in ReduceWord32And()
1206 if (mleft.right().IsInt32Mul()) { in ReduceWord32And()
1207 Int32BinopMatcher mleftright(mleft.right().node()); in ReduceWord32And()
1208 if (mleftright.right().IsMultipleOf(-mask)) { in ReduceWord32And()
1211 Word32And(mleft.left().node(), m.right().node())); in ReduceWord32And()
1220 if (mleftleft.right().Is(base::bits::CountTrailingZeros(mask))) { in ReduceWord32And()
1223 Word32And(mleft.right().node(), m.right().node())); in ReduceWord32And()
1230 if (mleft.right().IsWord32Shl()) { in ReduceWord32And()
1231 Int32BinopMatcher mleftright(mleft.right().node()); in ReduceWord32And()
1232 if (mleftright.right().Is(base::bits::CountTrailingZeros(mask))) { in ReduceWord32And()
1235 Word32And(mleft.left().node(), m.right().node())); in ReduceWord32And()
1244 if (mleft.right().IsMultipleOf(-mask)) { in ReduceWord32And()
1265 if (m.left().IsWord32Shl() && m.right().IsWord32Shr()) { in TryMatchWord32Ror()
1267 shr = m.right().node(); in TryMatchWord32Ror()
1268 } else if (m.left().IsWord32Shr() && m.right().IsWord32Shl()) { in TryMatchWord32Ror()
1269 shl = m.right().node(); in TryMatchWord32Ror()
1279 if (mshl.right().HasValue() && mshr.right().HasValue()) { in TryMatchWord32Ror()
1281 if (mshl.right().Value() + mshr.right().Value() != 32) return NoChange(); in TryMatchWord32Ror()
1285 if (mshl.right().IsInt32Sub()) { in TryMatchWord32Ror()
1286 sub = mshl.right().node(); in TryMatchWord32Ror()
1287 y = mshr.right().node(); in TryMatchWord32Ror()
1288 } else if (mshr.right().IsInt32Sub()) { in TryMatchWord32Ror()
1289 sub = mshr.right().node(); in TryMatchWord32Ror()
1290 y = mshl.right().node(); in TryMatchWord32Ror()
1296 if (!msub.left().Is(32) || msub.right().node() != y) return NoChange(); in TryMatchWord32Ror()
1300 node->ReplaceInput(1, mshr.right().node()); in TryMatchWord32Ror()
1308 if (m.right().Is(0)) return Replace(m.left().node()); // x | 0 => x in ReduceWord32Or()
1309 if (m.right().Is(-1)) return Replace(m.right().node()); // x | -1 => -1 in ReduceWord32Or()
1311 return ReplaceInt32(m.left().Value() | m.right().Value()); in ReduceWord32Or()
1321 if (m.right().Is(0)) return Replace(m.left().node()); // x ^ 0 => x in ReduceWord32Xor()
1323 return ReplaceInt32(m.left().Value() ^ m.right().Value()); in ReduceWord32Xor()
1326 if (m.left().IsWord32Xor() && m.right().Is(-1)) { in ReduceWord32Xor()
1328 if (mleft.right().Is(-1)) { // (x ^ -1) ^ -1 => x in ReduceWord32Xor()
1387 m.right().IsChangeFloat32ToFloat64()) || in ReduceFloat64Compare()
1389 IsFloat64RepresentableAsFloat32(m.right())) || in ReduceFloat64Compare()
1391 m.right().IsChangeFloat32ToFloat64())) { in ReduceFloat64Compare()
1410 1, m.right().HasValue() in ReduceFloat64Compare()
1411 ? Float32Constant(static_cast<float>(m.right().Value())) in ReduceFloat64Compare()
1412 : m.right().InputAt(0)); in ReduceFloat64Compare()