[llvm] r277959 - [X86] lowerVectorShuffle - ensure that undefined mask elements only use SM_SentinelUndef

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 7 08:56:28 PDT 2016


I don't quite understand this. Does combining come through
lowerVectorShuffle? Or when would a VECTOR_SHUFFLE come through where this
wasn't true?

On Sunday, August 7, 2016, Simon Pilgrim via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rksimon
> Date: Sun Aug  7 10:29:12 2016
> New Revision: 277959
>
> URL: http://llvm.org/viewvc/llvm-project?rev=277959&view=rev
> Log:
> [X86] lowerVectorShuffle - ensure that undefined mask elements only use
> SM_SentinelUndef
>
> Help lowering and combining (which can specify SM_SentinelZero mask
> elements) share more shuffle matching code.
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/
> X86/X86ISelLowering.cpp?rev=277959&r1=277958&r2=277959&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Aug  7 10:29:12 2016
> @@ -12281,6 +12281,15 @@ static SDValue lowerVectorShuffle(SDValu
>          return DAG.getVectorShuffle(VT, DL, V1, V2, NewMask);
>        }
>
> +  // Ensure that undefined mask elements only use SM_SentinelUndef.
> +  if (llvm::any_of(Mask, [](int M) { return M < SM_SentinelUndef; })) {
> +    SmallVector<int, 8> NewMask(Mask.begin(), Mask.end());
> +    for (int &M : NewMask)
> +      if (M < SM_SentinelUndef)
> +        M = SM_SentinelUndef;
> +    return DAG.getVectorShuffle(VT, DL, V1, V2, NewMask);
> +  }
> +
>    // We actually see shuffles that are entirely re-arrangements of a set
> of
>    // zero inputs. This mostly happens while decomposing complex shuffles
> into
>    // simple ones. Directly lower these as a buildvector of zeros.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <javascript:;>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160807/403b5484/attachment.html>


More information about the llvm-commits mailing list