diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-06-25 12:19:12 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-06-25 12:19:12 +0000 |
| commit | 69fc111184f3f7c8d1139338bd8474368b258826 (patch) | |
| tree | b0ee28c42f83ca4d02bced4eb8510f35b1bec432 /llvm/lib/CodeGen | |
| parent | 74ec25a197ab0980f8c7e03061e75eda9b64bc21 (diff) | |
| download | bcm5719-llvm-69fc111184f3f7c8d1139338bd8474368b258826.tar.gz bcm5719-llvm-69fc111184f3f7c8d1139338bd8474368b258826.zip | |
[TargetLowering] SimplifyDemandedBits SIGN_EXTEND_VECTOR_INREG -> ANY/ZERO_EXTEND_VECTOR_INREG
Simplify SIGN_EXTEND_VECTOR_INREG if the extended bits are not required/known zero.
Matches what we already do for SIGN_EXTEND.
Reapplies rL363802 but now with legality checks added at rL364290
llvm-svn: 364299
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 2608d06ff90..b20c3a937fe 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1416,9 +1416,9 @@ bool TargetLowering::SimplifyDemandedBits( bool IsVecInReg = Op.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG; // If none of the top bits are demanded, convert this into an any_extend. - // TODO: Add SIGN_EXTEND_VECTOR_INREG - ANY_EXTEND_VECTOR_INREG fold. - if (DemandedBits.getActiveBits() <= InBits && !IsVecInReg) { - unsigned Opc = ISD::ANY_EXTEND; + if (DemandedBits.getActiveBits() <= InBits) { + unsigned Opc = + IsVecInReg ? ISD::ANY_EXTEND_VECTOR_INREG : ISD::ANY_EXTEND; if (!TLO.LegalOperations() || isOperationLegal(Opc, VT)) return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src)); } @@ -1440,9 +1440,9 @@ bool TargetLowering::SimplifyDemandedBits( Known = Known.sext(BitWidth); // If the sign bit is known zero, convert this to a zero extend. - // TODO: Add SIGN_EXTEND_VECTOR_INREG - ZERO_EXTEND_VECTOR_INREG fold. - if (Known.isNonNegative() && !IsVecInReg) { - unsigned Opc = ISD::ZERO_EXTEND; + if (Known.isNonNegative()) { + unsigned Opc = + IsVecInReg ? ISD::ZERO_EXTEND_VECTOR_INREG : ISD::ZERO_EXTEND; if (!TLO.LegalOperations() || isOperationLegal(Opc, VT)) return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src)); } |

