aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-06-19 18:00:24 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-06-19 18:00:24 +0000
commit6016fb726c7fff99d0ff8667823fbb889b0dc070 (patch)
tree77fa1a7b9d59fb1076a28bdc457c33a58d653151 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
parent22a5a61674c55bc6decd83fe36b7bf46da015cf2 (diff)
downloadllvm-6016fb726c7fff99d0ff8667823fbb889b0dc070.zip
llvm-6016fb726c7fff99d0ff8667823fbb889b0dc070.tar.gz
llvm-6016fb726c7fff99d0ff8667823fbb889b0dc070.tar.bz2
[TargetLowering] SimplifyDemandedBits ZERO_EXTEND_VECTOR_INREG -> ANY_EXTEND_VECTOR_INREG
Simplify ZERO_EXTEND_VECTOR_INREG if the extended bits are not required. Matches what we already do for ZERO_EXTEND. llvm-svn: 363850
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 9d45742..b08a41b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1381,7 +1381,6 @@ bool TargetLowering::SimplifyDemandedBits(
bool IsVecInReg = Op.getOpcode() == ISD::ZERO_EXTEND_VECTOR_INREG;
// If none of the top bits are demanded, convert this into an any_extend.
- // TODO: Add ZERO_EXTEND_VECTOR_INREG - ANY_EXTEND_VECTOR_INREG fold.
if (DemandedBits.getActiveBits() <= InBits) {
// If we only need the non-extended bits of the bottom element
// then we can just bitcast to the result.
@@ -1390,8 +1389,10 @@ bool TargetLowering::SimplifyDemandedBits(
TLO.DAG.getDataLayout().isLittleEndian())
return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src));
- if (!IsVecInReg)
- return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::ANY_EXTEND, dl, VT, Src));
+ return TLO.CombineTo(
+ Op, TLO.DAG.getNode(IsVecInReg ? ISD::ANY_EXTEND_VECTOR_INREG
+ : ISD::ANY_EXTEND,
+ dl, VT, Src));
}
APInt InDemandedBits = DemandedBits.trunc(InBits);