Lines Matching defs:DemandedBits
514 const APInt &DemandedBits,
522 if (DemandedBits.isZero() || DemandedElts.isZero())
526 if (targetShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO))
542 if (Opcode == ISD::XOR && DemandedBits.isSubsetOf(C))
545 if (!C.isSubsetOf(DemandedBits)) {
547 SDValue NewC = TLO.DAG.getConstant(DemandedBits & C, DL, VT);
561 const APInt &DemandedBits,
567 return ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO);
575 const APInt &DemandedBits,
602 unsigned DemandedSize = DemandedBits.getActiveBits();
620 bool TargetLowering::SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits,
627 bool Simplified = SimplifyDemandedBits(Op, DemandedBits, Known, TLO);
635 bool TargetLowering::SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits,
644 SimplifyDemandedBits(Op, DemandedBits, DemandedElts, Known, TLO);
652 bool TargetLowering::SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits,
665 return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, Known, TLO, Depth,
671 SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts,
684 if (DemandedBits == 0 || DemandedElts == 0)
689 unsigned BitWidth = DemandedBits.getBitWidth();
706 Src, DemandedBits, DemandedElts, DAG, Depth + 1))
717 APInt Sub = DemandedBits.extractBits(NumSrcEltBits, BitOffset);
740 DemandedSrcBits.insertBits(DemandedBits, Offset);
765 if (DemandedBits.isSubsetOf(LHSKnown.Zero | RHSKnown.One))
767 if (DemandedBits.isSubsetOf(RHSKnown.Zero | LHSKnown.One))
778 if (DemandedBits.isSubsetOf(LHSKnown.One | RHSKnown.Zero))
780 if (DemandedBits.isSubsetOf(RHSKnown.One | LHSKnown.Zero))
790 if (DemandedBits.isSubsetOf(RHSKnown.Zero))
792 if (DemandedBits.isSubsetOf(LHSKnown.Zero))
805 unsigned UpperDemandedBits = BitWidth - DemandedBits.countr_zero();
818 if (DemandedBits.isSignMask() &&
837 if (DemandedBits.getActiveBits() <= ExBits &&
859 DemandedBits.getActiveBits() <= SrcVT.getScalarSizeInBits()) {
923 Op, DemandedBits, DemandedElts, DAG, Depth))
931 SDValue Op, const APInt &DemandedBits, SelectionDAG &DAG,
940 return SimplifyMultipleUseDemandedBits(Op, DemandedBits, DemandedElts, DAG,
947 APInt DemandedBits = APInt::getAllOnes(Op.getScalarValueSizeInBits());
948 return SimplifyMultipleUseDemandedBits(Op, DemandedBits, DemandedElts, DAG,
957 const APInt &DemandedBits,
1044 if (NumSigned >= 1 && DemandedBits.isSignBitClear()) {
1118 APInt DemandedBits = OriginalDemandedBits;
1150 // Allow multiple uses, just set the DemandedBits/Elts to all bits.
1151 DemandedBits = APInt::getAllOnes(BitWidth);
1173 APInt SrcDemandedBits = DemandedBits.zext(SrcBitWidth);
1190 APInt DemandedSclBits = DemandedBits.zextOrTrunc(Scl.getValueSizeInBits());
1237 APInt DemandedSclBits = DemandedBits.zextOrTrunc(NumSclBits);
1244 if (SimplifyDemandedBits(Vec, DemandedBits, DemandedVecElts, KnownVec, TLO,
1267 if (SimplifyDemandedBits(Sub, DemandedBits, DemandedSubElts, KnownSub, TLO,
1270 if (SimplifyDemandedBits(Src, DemandedBits, DemandedSrcElts, KnownSrc, TLO,
1282 if (!DemandedBits.isAllOnes() || !DemandedSubElts.isAllOnes() ||
1285 Sub, DemandedBits, DemandedSubElts, TLO.DAG, Depth + 1);
1287 Src, DemandedBits, DemandedSrcElts, TLO.DAG, Depth + 1);
1309 if (SimplifyDemandedBits(Src, DemandedBits, DemandedSrcElts, Known, TLO,
1314 if (!DemandedBits.isAllOnes() || !DemandedSrcElts.isAllOnes()) {
1316 Src, DemandedBits, DemandedSrcElts, TLO.DAG, Depth + 1);
1336 if (SimplifyDemandedBits(Op.getOperand(i), DemandedBits, DemandedSubElts,
1362 if (SimplifyDemandedBits(Op0, DemandedBits, DemandedLHS, Known2, TLO,
1368 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedRHS, Known2, TLO,
1376 Op0, DemandedBits, DemandedLHS, TLO.DAG, Depth + 1);
1378 Op1, DemandedBits, DemandedRHS, TLO.DAG, Depth + 1);
1400 if ((LHSKnown.Zero & DemandedBits) ==
1401 (~RHSC->getAPIntValue() & DemandedBits))
1406 if (ShrinkDemandedConstant(Op, ~LHSKnown.Zero & DemandedBits,
1423 // iff 'C' is Undef/Constant and AND(X,M) == X (for DemandedBits).
1435 if (DemandedBits.isSubsetOf(KnownSubMask.One)) {
1445 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedElts, Known, TLO,
1448 if (SimplifyDemandedBits(Op0, ~Known.Zero & DemandedBits, DemandedElts,
1454 if (DemandedBits.isSubsetOf(Known2.Zero | Known.One))
1456 if (DemandedBits.isSubsetOf(Known.Zero | Known2.One))
1459 if (DemandedBits.isSubsetOf(Known.Zero | Known2.Zero))
1462 if (ShrinkDemandedConstant(Op, ~Known2.Zero & DemandedBits, DemandedElts,
1466 if (ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO))
1470 if (!DemandedBits.isAllOnes() || !DemandedElts.isAllOnes()) {
1472 Op0, DemandedBits, DemandedElts, TLO.DAG, Depth + 1);
1474 Op1, DemandedBits, DemandedElts, TLO.DAG, Depth + 1);
1490 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedElts, Known, TLO,
1499 if (SimplifyDemandedBits(Op0, ~Known.One & DemandedBits, DemandedElts,
1510 if (DemandedBits.isSubsetOf(Known2.One | Known.Zero))
1512 if (DemandedBits.isSubsetOf(Known.One | Known2.Zero))
1515 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO))
1518 if (ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO))
1522 if (!DemandedBits.isAllOnes() || !DemandedElts.isAllOnes()) {
1524 Op0, DemandedBits, DemandedElts, TLO.DAG, Depth + 1);
1526 Op1, DemandedBits, DemandedElts, TLO.DAG, Depth + 1);
1569 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedElts, Known, TLO,
1572 if (SimplifyDemandedBits(Op0, DemandedBits, DemandedElts, Known2, TLO,
1578 if (DemandedBits.isSubsetOf(Known.Zero))
1580 if (DemandedBits.isSubsetOf(Known2.Zero))
1583 if (ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO))
1589 if (DemandedBits.isSubsetOf(Known.Zero | Known2.Zero))
1601 TLO.DAG.getConstant(~C->getAPIntValue() & DemandedBits, dl, VT);
1608 if (!C->isAllOnes() && DemandedBits.isSubsetOf(C->getAPIntValue())) {
1626 if ((DemandedBits & C->getAPIntValue()) == (DemandedBits & Ones) &&
1643 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO))
1647 if (!DemandedBits.isAllOnes() || !DemandedElts.isAllOnes()) {
1649 Op0, DemandedBits, DemandedElts, TLO.DAG, Depth + 1);
1651 Op1, DemandedBits, DemandedElts, TLO.DAG, Depth + 1);
1664 if (SimplifyDemandedBits(Op.getOperand(2), DemandedBits, DemandedElts,
1667 if (SimplifyDemandedBits(Op.getOperand(1), DemandedBits, DemandedElts,
1672 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO))
1679 if (SimplifyDemandedBits(Op.getOperand(2), DemandedBits, DemandedElts,
1682 if (SimplifyDemandedBits(Op.getOperand(1), DemandedBits, DemandedElts,
1690 if (SimplifyDemandedBits(Op.getOperand(3), DemandedBits, DemandedElts,
1693 if (SimplifyDemandedBits(Op.getOperand(2), DemandedBits, DemandedElts,
1698 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO))
1711 if (DemandedBits.isSignMask() &&
1748 if (!DemandedBits.intersects(APInt::getLowBitsSet(BitWidth, ShAmt))) {
1772 if (ShAmt < InnerBits && DemandedBits.getActiveBits() <= InnerBits &&
1793 DemandedBits.getActiveBits() <=
1795 DemandedBits.countr_zero() >= ShAmt) {
1807 APInt InDemandedMask = DemandedBits.lshr(ShAmt);
1838 if (ShAmt < DemandedBits.getActiveBits() && !VT.isVector() &&
1842 unsigned DemandedSize = DemandedBits.getActiveBits();
1868 DemandedBits.countLeadingOnes() >= HalfWidth) {
1897 if (unsigned CTLZ = DemandedBits.countl_zero()) {
1922 unsigned UpperDemandedBits = BitWidth - DemandedBits.countr_zero();
1944 if (!DemandedBits.intersects(APInt::getHighBitsSet(BitWidth, ShAmt))) {
1961 APInt InDemandedMask = (DemandedBits << ShAmt);
2014 if (SDValue AVG = combineShiftToAVG(Op, TLO, *this, DemandedBits,
2027 unsigned NumHiDemandedBits = BitWidth - DemandedBits.countr_zero();
2036 if (DemandedBits.isOne())
2074 APInt InDemandedMask = (DemandedBits << ShAmt);
2083 if (DemandedBits.countl_zero() < ShAmt)
2095 DemandedBits.countl_zero() >= ShAmt) {
2102 int Log2 = DemandedBits.exactLogBase2();
2125 if (SDValue AVG = combineShiftToAVG(Op, TLO, *this, DemandedBits,
2144 if (SimplifyDemandedBits(IsFSHL ? Op0 : Op1, DemandedBits, DemandedElts,
2152 APInt Demanded0 = DemandedBits.lshr(IsFSHL ? Amt : (BitWidth - Amt));
2153 APInt Demanded1 = DemandedBits << (IsFSHL ? (BitWidth - Amt) : Amt);
2209 APInt Demanded0 = DemandedBits.rotr(IsROTL ? Amt : RevAmt);
2220 DemandedBits.countr_zero() >= (IsROTL ? Amt : RevAmt)) {
2225 DemandedBits.countl_zero() >= (IsROTL ? RevAmt : Amt)) {
2254 unsigned NumDemandedUpperBits = BitWidth - DemandedBits.countr_zero();
2295 APInt DemandedSrcBits = DemandedBits.reverseBits();
2308 unsigned NLZ = DemandedBits.countl_zero();
2309 unsigned NTZ = DemandedBits.countr_zero();
2329 APInt DemandedSrcBits = DemandedBits.byteSwap();
2341 if (DemandedBits.isOne() && !TLO.LegalOps && !VT.isVector())
2354 if (DemandedBits.isSignMask()) {
2371 if (DemandedBits.getActiveBits() <= ExVTBits)
2374 APInt InputDemandedBits = DemandedBits.getLoBits(ExVTBits);
2405 APInt MaskLo = DemandedBits.getLoBits(HalfBitWidth).trunc(HalfBitWidth);
2406 APInt MaskHi = DemandedBits.getHiBits(HalfBitWidth).trunc(HalfBitWidth);
2431 if (DemandedBits.getActiveBits() <= InBits) {
2445 APInt InDemandedBits = DemandedBits.trunc(InBits);
2476 APInt InDemandedBits = DemandedBits.trunc(InBits);
2483 if (DemandedBits.getActiveBits() <= InBits) {
2544 APInt InDemandedBits = DemandedBits.trunc(InBits);
2564 APInt TruncMask = DemandedBits.zext(OperandBitWidth);
2610 if (!(HighBits & DemandedBits)) {
2630 if (SimplifyDemandedBits(Op.getOperand(0), ~InMask | DemandedBits, Known,
2656 APInt DemandedSrcBits = DemandedBits;
2689 DemandedBits == APInt::getSignMask(Op.getValueSizeInBits()) &&
2720 APInt Sub = DemandedBits.extractBits(NumSrcEltBits, BitOffset);
2747 DemandedSrcBits.insertBits(DemandedBits, Offset);
2782 if (DemandedBits.isPowerOf2()) {
2786 unsigned CTZ = DemandedBits.countr_zero();
2797 if (Op.getOperand(0) == Op.getOperand(1) && DemandedBits.ult(4)) {
2809 unsigned DemandedBitsLZ = DemandedBits.countl_zero();
2823 ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO)) {
2835 if (Op.getOpcode() == ISD::SUB && DemandedBits.isOne() &&
2934 if (SimplifyDemandedBitsForTargetNode(Op, DemandedBits, DemandedElts,
2948 DemandedBits.isSubsetOf(Known.Zero | Known.One)) {
3705 APInt DemandedBits = APInt::getAllOnes(EltSizeInBits);
3706 if (SimplifyDemandedBits(Op, DemandedBits, OriginalDemandedElts, Known,
3792 SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts,
3805 SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts,