diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-07-30 11:35:13 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-07-30 11:35:13 +0000 |
commit | e4d5423dcdffddf9dd9bb94e19e59e187b7559df (patch) | |
tree | 8c4067ae7378fd089f50b1090cc4602d19dbf446 /llvm/lib | |
parent | b9f8ab2c7eb2f6e1110d3beeafb129f0b0037bfd (diff) | |
download | bcm5719-llvm-e4d5423dcdffddf9dd9bb94e19e59e187b7559df.tar.gz bcm5719-llvm-e4d5423dcdffddf9dd9bb94e19e59e187b7559df.zip |
[X86][AVX] SimplifyDemandedVectorElts - handle extraction from X86ISD::SUBV_BROADCAST source (PR42819)
PR42819 showed an issue that we couldn't handle the case where we demanded a 'sub-sub-vector' of the SUBV_BROADCAST 'sub-vector' source.
This patch recognizes these cases and extracts the sub-sub-vector instead of trying to broadcast to a type smaller than the 'sub-vector' source.
llvm-svn: 367306
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 334efa8b17b..9dfa661e7ab 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -34214,14 +34214,16 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode( // Subvector broadcast. case X86ISD::SUBV_BROADCAST: { SDLoc DL(Op); - SDValue Ext = Op.getOperand(0); - if (Ext.getValueSizeInBits() != ExtSizeInBits) { - MVT ExtSVT = Ext.getSimpleValueType().getScalarType(); - MVT ExtVT = - MVT::getVectorVT(ExtSVT, ExtSizeInBits / ExtSVT.getSizeInBits()); - Ext = TLO.DAG.getNode(X86ISD::SUBV_BROADCAST, DL, ExtVT, Ext); - } - return TLO.CombineTo(Op, insertSubVector(TLO.DAG.getUNDEF(VT), Ext, 0, + SDValue Src = Op.getOperand(0); + if (Src.getValueSizeInBits() > ExtSizeInBits) + Src = extractSubVector(Src, 0, TLO.DAG, DL, ExtSizeInBits); + else if (Src.getValueSizeInBits() < ExtSizeInBits) { + MVT SrcSVT = Src.getSimpleValueType().getScalarType(); + MVT SrcVT = + MVT::getVectorVT(SrcSVT, ExtSizeInBits / SrcSVT.getSizeInBits()); + Src = TLO.DAG.getNode(X86ISD::SUBV_BROADCAST, DL, SrcVT, Src); + } + return TLO.CombineTo(Op, insertSubVector(TLO.DAG.getUNDEF(VT), Src, 0, TLO.DAG, DL, ExtSizeInBits)); } // Byte shifts by immediate. |