From d33ba1aa0b505e3f4c55b382f171e8cbef6a1843 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 31 May 2020 13:19:18 +0100 Subject: [PATCH] [X86][AVX] getFauxShuffleMask - don't widen shuffle inputs from INSERT_SUBVECTOR(X,SHUFFLE(Y,Z)) Don't create nodes on the fly when decoding INSERT_SUBVECTOR as faux shuffles. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index bcaf629..95c9312 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -7438,9 +7438,9 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts, SubMask, DAG, Depth + 1, ResolveKnownElts)) return false; - // Shuffle inputs must be the same size as the subvector. + // Subvector shuffle inputs must not be larger than the subvector. if (llvm::any_of(SubInputs, [SubVT](SDValue Op) { - return SubVT.getSizeInBits() != Op.getValueSizeInBits(); + return SubVT.getSizeInBits() > Op.getValueSizeInBits(); })) return false; @@ -7460,14 +7460,7 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts, } } Ops.push_back(Src); - for (SDValue &SubInput : SubInputs) { - EVT SubSVT = SubInput.getValueType().getScalarType(); - EVT AltVT = EVT::getVectorVT(*DAG.getContext(), SubSVT, - NumSizeInBits / SubSVT.getSizeInBits()); - Ops.push_back(DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(N), AltVT, - DAG.getUNDEF(AltVT), SubInput, - DAG.getIntPtrConstant(0, SDLoc(N)))); - } + Ops.append(SubInputs.begin(), SubInputs.end()); for (int i = 0; i != (int)NumElts; ++i) Mask.push_back(i); for (int i = 0; i != (int)NumSubElts; ++i) { -- 2.7.4