mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-10 06:24:58 +00:00
[SelectionDAG] Use getActiveBits() and countTrailingZeros() to avoid creating temporary APInts with lshr and trunc. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300819 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5649a8228b
commit
bb107535ba
@ -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…
x
Reference in New Issue
Block a user