mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-13 06:38:44 +00:00
allow SRL to simplify its operands, as it doesn't demand all bits as input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ec06e9a670
commit
61a4c072b9
@ -1728,7 +1728,7 @@ SDOperand DAGCombiner::visitSHL(SDNode *N) {
|
||||
// if (shl x, c) is known to be zero, return 0
|
||||
if (TLI.MaskedValueIsZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT)))
|
||||
return DAG.getConstant(0, VT);
|
||||
if (SimplifyDemandedBits(SDOperand(N, 0)))
|
||||
if (N1C && SimplifyDemandedBits(SDOperand(N, 0)))
|
||||
return SDOperand(N, 0);
|
||||
// fold (shl (shl x, c1), c2) -> 0 or (shl x, c1+c2)
|
||||
if (N1C && N0.getOpcode() == ISD::SHL &&
|
||||
@ -1907,6 +1907,12 @@ SDOperand DAGCombiner::visitSRL(SDNode *N) {
|
||||
return DAG.getNode(ISD::XOR, VT, Op, DAG.getConstant(1, VT));
|
||||
}
|
||||
}
|
||||
|
||||
// fold operands of srl based on knowledge that the low bits are not
|
||||
// demanded.
|
||||
if (N1C && SimplifyDemandedBits(SDOperand(N, 0)))
|
||||
return SDOperand(N, 0);
|
||||
|
||||
return SDOperand();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user