forked from OSchip/llvm-project
[SelectionDAG] Use getActiveBits() and countTrailingZeros() to avoid creating temporary APInts with lshr and trunc. NFCI
llvm-svn: 300819
This commit is contained in:
parent
ff04109ca2
commit
d3884b8402
|
@ -839,7 +839,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
|||
SDValue InnerOp = InOp.getNode()->getOperand(0);
|
||||
EVT InnerVT = InnerOp.getValueType();
|
||||
unsigned InnerBits = InnerVT.getSizeInBits();
|
||||
if (ShAmt < InnerBits && NewMask.lshr(InnerBits) == 0 &&
|
||||
if (ShAmt < InnerBits && NewMask.getActiveBits() <= InnerBits &&
|
||||
isTypeDesirableForOp(ISD::SHL, InnerVT)) {
|
||||
EVT ShTy = getShiftAmountTy(InnerVT, DL);
|
||||
if (!APInt(BitWidth, ShAmt).isIntN(ShTy.getSizeInBits()))
|
||||
|
@ -865,9 +865,8 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
|||
->getZExtValue();
|
||||
if (InnerShAmt < ShAmt &&
|
||||
InnerShAmt < InnerBits &&
|
||||
NewMask.lshr(std::min(InnerBits - InnerShAmt + ShAmt,
|
||||
BitWidth)) == 0 &&
|
||||
NewMask.trunc(ShAmt) == 0) {
|
||||
NewMask.getActiveBits() <= (InnerBits - InnerShAmt + ShAmt) &&
|
||||
NewMask.countTrailingZeros() >= ShAmt) {
|
||||
SDValue NewSA =
|
||||
TLO.DAG.getConstant(ShAmt - InnerShAmt, dl,
|
||||
Op.getOperand(1).getValueType());
|
||||
|
|
Loading…
Reference in New Issue