Lines Matching refs:DemandedMask

58   APInt DemandedMask(APInt::getAllOnesValue(BitWidth));  in SimplifyDemandedInstructionBits()  local
60 Value *V = SimplifyDemandedUseBits(&Inst, DemandedMask, KnownZero, KnownOne, in SimplifyDemandedInstructionBits()
71 bool InstCombiner::SimplifyDemandedBits(Use &U, APInt DemandedMask, in SimplifyDemandedBits() argument
75 Value *NewVal = SimplifyDemandedUseBits(U.get(), DemandedMask, KnownZero, in SimplifyDemandedBits()
104 Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, in SimplifyDemandedUseBits() argument
110 uint32_t BitWidth = DemandedMask.getBitWidth(); in SimplifyDemandedUseBits()
120 KnownOne = CI->getValue() & DemandedMask; in SimplifyDemandedUseBits()
121 KnownZero = ~KnownOne & DemandedMask; in SimplifyDemandedUseBits()
127 KnownZero = DemandedMask; in SimplifyDemandedUseBits()
133 if (DemandedMask == 0) { // Not demanding any bits from V. in SimplifyDemandedUseBits()
169 if ((DemandedMask & ~LHSKnownZero & RHSKnownOne) == in SimplifyDemandedUseBits()
170 (DemandedMask & ~LHSKnownZero)) in SimplifyDemandedUseBits()
172 if ((DemandedMask & ~RHSKnownZero & LHSKnownOne) == in SimplifyDemandedUseBits()
173 (DemandedMask & ~RHSKnownZero)) in SimplifyDemandedUseBits()
177 if ((DemandedMask & (RHSKnownZero|LHSKnownZero)) == DemandedMask) in SimplifyDemandedUseBits()
193 if ((DemandedMask & ~LHSKnownOne & RHSKnownZero) == in SimplifyDemandedUseBits()
194 (DemandedMask & ~LHSKnownOne)) in SimplifyDemandedUseBits()
196 if ((DemandedMask & ~RHSKnownOne & LHSKnownZero) == in SimplifyDemandedUseBits()
197 (DemandedMask & ~RHSKnownOne)) in SimplifyDemandedUseBits()
202 if ((DemandedMask & (~RHSKnownZero) & LHSKnownOne) == in SimplifyDemandedUseBits()
203 (DemandedMask & (~RHSKnownZero))) in SimplifyDemandedUseBits()
205 if ((DemandedMask & (~LHSKnownZero) & RHSKnownOne) == in SimplifyDemandedUseBits()
206 (DemandedMask & (~LHSKnownZero))) in SimplifyDemandedUseBits()
219 if ((DemandedMask & RHSKnownZero) == DemandedMask) in SimplifyDemandedUseBits()
221 if ((DemandedMask & LHSKnownZero) == DemandedMask) in SimplifyDemandedUseBits()
235 DemandedMask = APInt::getAllOnesValue(BitWidth); in SimplifyDemandedUseBits()
243 if (SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, RHSKnownZero, in SimplifyDemandedUseBits()
245 SimplifyDemandedBits(I->getOperandUse(0), DemandedMask & ~RHSKnownZero, in SimplifyDemandedUseBits()
253 if ((DemandedMask & ((RHSKnownZero | LHSKnownZero)| in SimplifyDemandedUseBits()
254 (RHSKnownOne & LHSKnownOne))) == DemandedMask) in SimplifyDemandedUseBits()
259 if ((DemandedMask & ~LHSKnownZero & RHSKnownOne) == in SimplifyDemandedUseBits()
260 (DemandedMask & ~LHSKnownZero)) in SimplifyDemandedUseBits()
262 if ((DemandedMask & ~RHSKnownZero & LHSKnownOne) == in SimplifyDemandedUseBits()
263 (DemandedMask & ~RHSKnownZero)) in SimplifyDemandedUseBits()
267 if ((DemandedMask & (RHSKnownZero|LHSKnownZero)) == DemandedMask) in SimplifyDemandedUseBits()
271 if (ShrinkDemandedConstant(I, 1, DemandedMask & ~LHSKnownZero)) in SimplifyDemandedUseBits()
281 if (SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, RHSKnownZero, in SimplifyDemandedUseBits()
283 SimplifyDemandedBits(I->getOperandUse(0), DemandedMask & ~RHSKnownOne, in SimplifyDemandedUseBits()
291 if ((DemandedMask & ((RHSKnownZero & LHSKnownZero)| in SimplifyDemandedUseBits()
292 (RHSKnownOne | LHSKnownOne))) == DemandedMask) in SimplifyDemandedUseBits()
297 if ((DemandedMask & ~LHSKnownOne & RHSKnownZero) == in SimplifyDemandedUseBits()
298 (DemandedMask & ~LHSKnownOne)) in SimplifyDemandedUseBits()
300 if ((DemandedMask & ~RHSKnownOne & LHSKnownZero) == in SimplifyDemandedUseBits()
301 (DemandedMask & ~RHSKnownOne)) in SimplifyDemandedUseBits()
306 if ((DemandedMask & (~RHSKnownZero) & LHSKnownOne) == in SimplifyDemandedUseBits()
307 (DemandedMask & (~RHSKnownZero))) in SimplifyDemandedUseBits()
309 if ((DemandedMask & (~LHSKnownZero) & RHSKnownOne) == in SimplifyDemandedUseBits()
310 (DemandedMask & (~LHSKnownZero))) in SimplifyDemandedUseBits()
314 if (ShrinkDemandedConstant(I, 1, DemandedMask)) in SimplifyDemandedUseBits()
323 if (SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, RHSKnownZero, in SimplifyDemandedUseBits()
325 SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, LHSKnownZero, in SimplifyDemandedUseBits()
340 if ((DemandedMask & (IKnownZero|IKnownOne)) == DemandedMask) in SimplifyDemandedUseBits()
345 if ((DemandedMask & RHSKnownZero) == DemandedMask) in SimplifyDemandedUseBits()
347 if ((DemandedMask & LHSKnownZero) == DemandedMask) in SimplifyDemandedUseBits()
353 if ((DemandedMask & ~RHSKnownZero & ~LHSKnownZero) == 0) { in SimplifyDemandedUseBits()
364 if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) { in SimplifyDemandedUseBits()
368 ~RHSKnownOne & DemandedMask); in SimplifyDemandedUseBits()
376 if (ShrinkDemandedConstant(I, 1, DemandedMask)) in SimplifyDemandedUseBits()
387 (LHSKnownOne & RHSKnownOne & DemandedMask) != 0) { in SimplifyDemandedUseBits()
390 APInt NewMask = ~(LHSKnownOne & RHSKnownOne & DemandedMask); in SimplifyDemandedUseBits()
416 if (SimplifyDemandedBits(I->getOperandUse(2), DemandedMask, RHSKnownZero, in SimplifyDemandedUseBits()
418 SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, LHSKnownZero, in SimplifyDemandedUseBits()
425 if (ShrinkDemandedConstant(I, 1, DemandedMask) || in SimplifyDemandedUseBits()
426 ShrinkDemandedConstant(I, 2, DemandedMask)) in SimplifyDemandedUseBits()
435 DemandedMask = DemandedMask.zext(truncBf); in SimplifyDemandedUseBits()
438 if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, KnownZero, in SimplifyDemandedUseBits()
441 DemandedMask = DemandedMask.trunc(BitWidth); in SimplifyDemandedUseBits()
464 if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, KnownZero, in SimplifyDemandedUseBits()
473 DemandedMask = DemandedMask.trunc(SrcBitWidth); in SimplifyDemandedUseBits()
476 if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, KnownZero, in SimplifyDemandedUseBits()
479 DemandedMask = DemandedMask.zext(BitWidth); in SimplifyDemandedUseBits()
491 APInt InputDemandedBits = DemandedMask & in SimplifyDemandedUseBits()
497 if ((NewBits & DemandedMask) != 0) in SimplifyDemandedUseBits()
516 if (KnownZero[SrcBitWidth-1] || (NewBits & ~DemandedMask) == NewBits) { in SimplifyDemandedUseBits()
529 unsigned NLZ = DemandedMask.countLeadingZeros(); in SimplifyDemandedUseBits()
560 Value *R = SimplifyShrShlDemandedBits(Shr, I, DemandedMask, in SimplifyDemandedUseBits()
568 APInt DemandedMaskIn(DemandedMask.lshr(ShiftAmt)); in SimplifyDemandedUseBits()
594 APInt DemandedMaskIn(DemandedMask.shl(ShiftAmt)); in SimplifyDemandedUseBits()
619 if (DemandedMask == 1) { in SimplifyDemandedUseBits()
628 if (DemandedMask.isSignBit()) in SimplifyDemandedUseBits()
635 APInt DemandedMaskIn(DemandedMask.shl(ShiftAmt)); in SimplifyDemandedUseBits()
638 if (DemandedMask.countLeadingZeros() <= ShiftAmt) in SimplifyDemandedUseBits()
663 (HighBits & ~DemandedMask) == HighBits) { in SimplifyDemandedUseBits()
682 if (DemandedMask.ult(RA)) // srem won't affect demanded bits in SimplifyDemandedUseBits()
711 if (DemandedMask.isNegative() && KnownZero.isNonNegative()) { in SimplifyDemandedUseBits()
732 KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & DemandedMask; in SimplifyDemandedUseBits()
742 unsigned NLZ = DemandedMask.countLeadingZeros(); in SimplifyDemandedUseBits()
743 unsigned NTZ = DemandedMask.countTrailingZeros(); in SimplifyDemandedUseBits()
782 if ((DemandedMask & (KnownZero|KnownOne)) == DemandedMask) in SimplifyDemandedUseBits()
805 Instruction *Shl, APInt DemandedMask, APInt &KnownZero, APInt &KnownOne) { in SimplifyShrShlDemandedBits() argument
823 KnownZero &= DemandedMask; in SimplifyShrShlDemandedBits()
840 if ((BitMask1 & DemandedMask) == (BitMask2 & DemandedMask)) { in SimplifyShrShlDemandedBits()