mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-15 12:30:22 +00:00
[SelectionDAG] Teach LegalizeVectorOps to directly Expand CTTZ_ZERO_UNDEF/CTLZ_ZERO_UNDEF to CTTZ/CTLZ directly if those ops are Legal/Custom instead of deferring it to LegalizeOps.
This is needed to support CTTZ/CTLZ Custom correctly since LegalizeOps would be too late to do the custom lowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266951 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0562d502ea
commit
3655b0c31f
@ -1002,10 +1002,12 @@ SDValue VectorLegalizer::ExpandFNEG(SDValue Op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDValue VectorLegalizer::ExpandCTLZ_CTTZ_ZERO_UNDEF(SDValue Op) {
|
SDValue VectorLegalizer::ExpandCTLZ_CTTZ_ZERO_UNDEF(SDValue Op) {
|
||||||
// If the non-ZERO_UNDEF version is supported we can let LegalizeDAG handle.
|
// If the non-ZERO_UNDEF version is supported we can use that instead.
|
||||||
unsigned Opc = Op.getOpcode() == ISD::CTLZ_ZERO_UNDEF ? ISD::CTLZ : ISD::CTTZ;
|
unsigned Opc = Op.getOpcode() == ISD::CTLZ_ZERO_UNDEF ? ISD::CTLZ : ISD::CTTZ;
|
||||||
if (TLI.isOperationLegalOrCustom(Opc, Op.getValueType()))
|
if (TLI.isOperationLegalOrCustom(Opc, Op.getValueType())) {
|
||||||
return Op;
|
SDLoc DL(Op);
|
||||||
|
return DAG.getNode(Opc, DL, Op.getValueType(), Op.getOperand(0));
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise go ahead and unroll.
|
// Otherwise go ahead and unroll.
|
||||||
return DAG.UnrollVectorOp(Op.getNode());
|
return DAG.UnrollVectorOp(Op.getNode());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user