Lines Matching defs:C1
359 Constant *C0, *C1;
360 if (!match(I.getOperand(1), m_Constant(C1)))
380 match(ConstantExpr::getAdd(C0, C1),
396 // shift (binop (shift X, C0), Y), C1 -> binop (shift X, C0+C1), (shift Y, C1)
397 Constant *ShiftSumC = ConstantExpr::getAdd(C0, C1);
399 Value *NewShift2 = Builder.CreateBinOp(ShiftOpcode, Y, C1);
439 // C shift (A add nuw C1) --> (C shift C1) shift A
441 Constant *C, *C1;
443 match(Op1, m_NUWAddLike(m_Value(A), m_Constant(C1)))) {
444 Value *NewC = Builder.CreateBinOp(I.getOpcode(), C, C1);
518 /// that have constant shift amounts: OuterShift (InnerShift X, C1), C2.
530 // shl (shl X, C1), C2 --> shl X, C1 + C2
531 // lshr (lshr X, C1), C2 --> lshr X, C1 + C2
543 // lshr (shl X, C1), C2 --> and (shl X, C1 - C2), C3
544 // shl (lshr X, C1), C2 --> and (lshr X, C1 - C2), C3
623 /// Fold OuterShift (InnerShift X, C1), C2.
633 const APInt *C1;
634 match(InnerShift->getOperand(1), m_APInt(C1));
635 unsigned InnerShAmt = C1->getZExtValue();
650 // shl (shl X, C1), C2 --> shl X, C1 + C2
651 // lshr (lshr X, C1), C2 --> lshr X, C1 + C2
681 // lshr (shl X, C1), C2 --> shl X, C1 - C2
682 // shl (lshr X, C1), C2 --> lshr X, C1 - C2
767 Instruction *InstCombinerImpl::FoldShiftByConstant(Value *Op0, Constant *C1,
769 // (C2 << X) << C1 --> (C2 << C1) << X
770 // (C2 >> X) >> C1 --> (C2 >> C1) >> X
776 I.getOpcode(), Builder.CreateBinOp(I.getOpcode(), C2, C1), X);
793 if (!IsLeftShift && match(C1, m_SpecificIntAllowPoison(TypeBits - 1)) &&
806 if (!match(C1, m_APInt(Op1C)))
838 Builder.CreateBinOp(I.getOpcode(), Op0BO->getOperand(1), C1);
841 Builder.CreateBinOp(I.getOpcode(), Op0BO->getOperand(0), C1);
853 // shl (select C, (add X, C1), X), C2
856 // select C, (add Y, C1 << C2), Y
867 Builder.CreateBinOp(I.getOpcode(), TBO->getOperand(1), C1);
869 Value *NewShift = Builder.CreateBinOp(I.getOpcode(), FalseVal, C1);
884 Builder.CreateBinOp(I.getOpcode(), FBO->getOperand(1), C1);
886 Value *NewShift = Builder.CreateBinOp(I.getOpcode(), TrueVal, C1);
1059 const APInt *C1;
1060 if (match(Op0, m_Exact(m_Shr(m_Value(X), m_APInt(C1)))) &&
1061 C1->ult(BitWidth)) {
1062 unsigned ShrAmt = C1->getZExtValue();
1064 // If C1 < C: (X >>?,exact C1) << C --> X << (C - C1)
1076 // If C1 > C: (X >>?exact C1) << C --> X >>?exact (C1 - C)
1085 if (match(Op0, m_OneUse(m_Shr(m_Value(X), m_APInt(C1)))) &&
1086 C1->ult(BitWidth)) {
1087 unsigned ShrAmt = C1->getZExtValue();
1089 // If C1 < C: (X >>? C1) << C --> (X << (C - C1)) & (-1 << C)
1103 // If C1 > C: (X >>? C1) << C --> (X >>? (C1 - C)) & (-1 << C)
1118 match(Shr, m_Shr(m_Value(X), m_APInt(C1)))) {
1120 unsigned ShrAmtC = C1->getZExtValue();
1125 // If C1 > C:
1126 // (trunc (X >> C1)) << C --> (trunc (X >> (C1 - C))) && (-1 << C)
1127 // If C > C1:
1128 // (trunc (X >> C1)) << C --> (trunc (X << (C - C1))) && (-1 << C)
1197 // (C1 - X) << C --> (C1 << C) - (X << C)
1198 if (match(Op0, m_OneUse(m_Sub(m_APInt(C1), m_Value(X))))) {
1199 Constant *NewLHS = ConstantInt::get(Ty, C1->shl(*C));
1223 Constant *C1;
1224 if (match(Op1, m_ImmConstant(C1))) {
1227 // (X * C2) << C1 --> X * (C2 << C1)
1229 return BinaryOperator::CreateMul(X, Builder.CreateShl(C2, C1));
1231 // shl (zext i1 X), C1 --> select (X, 1 << C1, 0)
1233 auto *NewC = Builder.CreateShl(ConstantInt::get(Ty, 1), C1);
1359 const APInt *C1;
1360 if (match(Op0, m_Shl(m_Value(X), m_APInt(C1))) && C1->ult(BitWidth)) {
1361 if (C1->ult(ShAmtC)) {
1362 unsigned ShlAmtC = C1->getZExtValue();
1365 // (X <<nuw C1) >>u C --> X >>u (C - C1)
1371 // (X << C1) >>u C --> (X >>u (C - C1)) & (-1 >> C)
1376 } else if (C1->ugt(ShAmtC)) {
1377 unsigned ShlAmtC = C1->getZExtValue();
1380 // (X <<nuw C1) >>u C --> X <<nuw/nsw (C1 - C)
1387 // (X << C1) >>u C --> X << (C1 - C) & (-1 >> C)
1393 assert(*C1 == ShAmtC);
1470 match(TruncSrc, m_LShr(m_Value(X), m_APInt(C1)))) {
1472 unsigned AmtSum = ShAmtC + C1->getZExtValue();
1475 // (trunc (X >>u C1)) >>u C --> and (trunc (X >>u (C1 + C)), MaskC
1480 (TruncSrc->hasOneUse() || C1->uge(SrcWidth - BitWidth))) {
1616 Constant *C1, *C2;
1619 m_ZExtOrSelf(m_Sub(m_Constant(C1),
1623 !BitWidthSplat(C1, &OldAShr) || !BitWidthSplat(C2, &OldAShr))
1693 // We can't handle (X << C1) >>s C2. It shifts arbitrary bits in. However,
1694 // we can handle (X <<nsw C1) >>s C2 since it only shifts in sign bits.
1700 // (X <<nsw C1) >>s C2 --> X >>s (C2 - C1)
1707 // (X <<nsw C1) >>s C2 --> X <<nsw (C1 - C2)
1720 // (X >>s C1) >>s C2 --> X >>s (C1 + C2)