Lines Matching defs:c1
421 /// of folding (mul (add x, c1), c2) -> (add (mul x, c2), c1*c2).
422 /// MulNode is the original multiply, AddNode is (add x, c1),
822 // reassoc. (op (op x, c1), c2) -> (op x, (op c1, c2))
828 // reassoc. (op (op x, c1), y) -> (op (op x, y), c1) iff x+c1 has one
842 // reassoc. (op c2, (op x, c1)) -> (op x, (op c1, c2))
848 // reassoc. (op x, (op y, c1)) -> (op (op x, y), c1) iff x+c1 has one
1659 // fold (add c1, c2) -> c1+c2
1666 // fold ((c1-A)+c2) -> (c1+c2)-A
1873 // fold (sub c1, c2) -> c1-c2
1897 // fold C2-(A+C1) -> (C2-C1)-A
1941 // fold (sub Sym+c1, Sym+c2) -> c1-c2
2036 // fold (mul c1, c2) -> c1*c2
2084 // (mul (shl X, c1), c2) -> (mul X, c2 << c1)
2115 // fold (mul (add x, c1), c2) -> (add (mul x, c2), c1*c2)
2234 // fold (sdiv c1, c2) -> c1/c2
2333 // fold (udiv c1, c2) -> c1/c2
2394 // fold (rem c1, c2) -> c1%c2
2687 // fold (add c1, c2) -> c1+c2
2937 // Look for (and (add x, c1), (lshr y, c2)). If C1 wasn't a legal
3079 // fold (and c1, c2) -> c1&c2
3667 // (or (and X, C1), (and Y, C2)) -> (and (or X, Y), C3) if possible.
3672 // but not in C1 are already zero. Likewise for Y.
3678 // C2 but not in C1 are already zero. Likewise for Y.
3806 // fold (or c1, c2) -> c1|c2
3837 // Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2)
3838 // iff (c1 & c2) == 0.
3841 ConstantSDNode *C1 = cast<ConstantSDNode>(N0.getOperand(1));
3842 if ((C1->getAPIntValue() & N1C->getAPIntValue()) != 0) {
3844 N1C, C1))
4059 // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1)
4060 // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2)
4152 // fold (xor c1, c2) -> c1^c2
4233 // fold (xor (xor x, c1), c2) -> (xor x, (xor c1, c2))
4436 // fold (shl c1, c2) -> c1<<c2
4466 // fold (shl (shl x, c1), c2) -> 0 or (shl x, (add c1, c2))
4469 uint64_t c1 = N0C1->getZExtValue();
4472 if (c1 + c2 >= OpSizeInBits)
4475 DAG.getConstant(c1 + c2, DL, N1.getValueType()));
4479 // fold (shl (ext (shl x, c1)), c2) -> (ext (shl x, (add c1, c2)))
4490 uint64_t c1 = N0Op0C1->getZExtValue();
4496 if (c1 + c2 >= OpSizeInBits)
4501 DAG.getConstant(c1 + c2, DL, N1.getValueType()));
4513 uint64_t c1 = N0Op0C1->getZExtValue();
4514 if (c1 < VT.getScalarSizeInBits()) {
4516 if (c1 == c2) {
4530 // fold (shl (sr[la] exact X, C1), C2) -> (shl X, (C2-C1)) if C1 <= C2
4531 // fold (shl (sr[la] exact X, C1), C2) -> (sr[la] X, (C2-C1)) if C1 > C2
4535 uint64_t C1 = N0C1->getZExtValue();
4538 if (C1 <= C2)
4540 DAG.getConstant(C2 - C1, DL, N1.getValueType()));
4542 DAG.getConstant(C1 - C2, DL, N1.getValueType()));
4546 // fold (shl (srl x, c1), c2) -> (and (shl x, (sub c2, c1), MASK) or
4547 // (and (srl x, (sub c1, c2), MASK)
4552 uint64_t c1 = N0C1->getZExtValue();
4553 if (c1 < OpSizeInBits) {
4555 APInt Mask = APInt::getHighBitsSet(OpSizeInBits, OpSizeInBits - c1);
4557 if (c2 > c1) {
4558 Mask = Mask.shl(c2 - c1);
4561 DAG.getConstant(c2 - c1, DL, N1.getValueType()));
4563 Mask = Mask.lshr(c1 - c2);
4566 DAG.getConstant(c1 - c2, DL, N1.getValueType()));
4574 // fold (shl (sra x, c1), c1) -> (and x, (shl -1, c1))
4586 // fold (shl (add x, c1), c2) -> (add (shl x, c2), c1 << c2)
4598 // fold (shl (mul x, c1), c2) -> (mul x, c1 << c2)
4629 // fold (sra c1, c2) -> (sra c1, c2)
4645 // fold (sra (shl x, c1), c1) -> sext_inreg for some c1 and target supports
4659 // fold (sra (sra x, c1), c2) -> (sra x, (add c1, c2))
4661 if (ConstantSDNode *C1 = isConstOrConstSplat(N0.getOperand(1))) {
4662 unsigned Sum = N1C->getZExtValue() + C1->getZExtValue();
4719 // fold (sra (trunc (srl x, c1)), c2) -> (trunc (sra x, c1 + c2))
4720 // if c1 is equal to the number of bits the trunc removes
4775 // fold (srl c1, c2) -> c1 >>u c2
4793 // fold (srl (srl x, c1), c2) -> 0 or (srl x, (add c1, c2))
4796 uint64_t c1 = N01C->getZExtValue();
4799 if (c1 + c2 >= OpSizeInBits)
4802 DAG.getConstant(c1 + c2, DL, N1.getValueType()));
4806 // fold (srl (trunc (srl x, c1)), c2) -> 0 or (trunc (srl x, (add c1, c2)))
4810 uint64_t c1 =
4816 // This is only valid if the OpSizeInBits + c1 = size of inner shift.
4817 if (c1 + OpSizeInBits == InnerShiftSize) {
4819 if (c1 + c2 >= InnerShiftSize)
4824 DAG.getConstant(c1 + c2, DL,
4965 // fold (bswap c1) -> c2
4987 // fold (ctlz c1) -> c2
4997 // fold (ctlz_zero_undef c1) -> c2
5007 // fold (cttz c1) -> c2
5017 // fold (cttz_zero_undef c1) -> c2
5027 // fold (ctpop c1) -> c2
5148 // select(C0|C1, x, y) <=> select(C0, x, select(C1, x, y))
5149 // select(C0&C1, x, y) <=> select(C0, select(C1, x, y), y)
5791 // fold (sext c1) -> c1
5792 // fold (zext c1) -> c1
5793 // fold (aext c1) -> c1
6951 // fold (sext_in_reg c1) -> c1
7083 // fold (truncate c1) -> c1
8313 // fold (fadd c1, c2) -> c1 + c2
8344 // fold (fadd (fadd x, c1), c2) -> (fadd x, (fadd c1, c2))
8461 // fold (fsub c1, c2) -> c1-c2
8523 // This just handles C1 * C2 for vectors. Other vector folds are below.
8528 // fold (fmul c1, c2) -> c1*c2
8546 // fold (fmul (fmul x, c1), c2) -> (fmul x, (fmul c1, c2))
8654 // (fma x, c1, (fmul x, c2)) -> (fmul x, c1+c2)
8663 // (fma (fmul x, c1), c2, y) -> (fma x, c1*c2, y)
8791 // fold (fdiv c1, c2) -> c1/c2
8893 // fold (frem c1, c2) -> fmod(c1,c2)
8941 // copysign(x, c1) -> fabs(x) iff ispos(c1)
8942 // copysign(x, c1) -> fneg(fabs(x)) iff isneg(c1)
8984 // fold (sint_to_fp c1) -> c1fp
9038 // fold (uint_to_fp c1) -> c1fp
9119 // fold (fp_to_sint c1fp) -> c1
9130 // fold (fp_to_uint c1fp) -> c1
9260 // fold (fceil c1) -> fceil(c1)
9271 // fold (ftrunc c1) -> ftrunc(c1)
9282 // fold (ffloor c1) -> ffloor(c1)
9357 const APFloat &C1 = N1CFP->getValueAPF();
9358 return DAG.getConstantFP(minnum(C0, C1), SDLoc(N), VT);
9378 const APFloat &C1 = N1CFP->getValueAPF();
9379 return DAG.getConstantFP(maxnum(C0, C1), SDLoc(N), VT);
9394 // fold (fabs c1) -> fabs(c1)
9507 // will convert it back to (X & C1) >> C2.
11140 // of folding (mul (add x, c1), c2) -> (add (mul x, c2), c1*c2).
11141 // MulNode is the original multiply, AddNode is (add x, c1),
11144 // If the (add x, c1) has multiple uses, we could increase
11149 // (A + c1) * c3
11182 // AddNode = (A + c1) <-- MulVar is A.
11194 // AddNode = (A + c1)