[llvm] r239697 - AVX-512: Implemented DAG lowering for shuff62x2/shufi62x2 instuctions ( Shuffle Packed Values at 128-bit Granularity )

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Thu Jun 25 11:17:52 PDT 2015


Hi,

I know this is reverted, but for the next rounds, some comments below:

On Sun, Jun 14, 2015 at 10:07 AM, Igor Breger <igor.breger at intel.com> wrote:
> Author: ibreger
> Date: Sun Jun 14 08:07:47 2015
> New Revision: 239697
>
> URL: http://llvm.org/viewvc/llvm-project?rev=239697&view=rev
> Log:
> AVX-512: Implemented DAG lowering for shuff62x2/shufi62x2 instuctions ( Shuffle Packed Values at 128-bit Granularity )
> Tests added , vector-shuffle-512-v8.ll test re-generated.
>
> Differential Revision: http://reviews.llvm.org/D10300
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>     llvm/trunk/test/CodeGen/X86/avx512-shuffle.ll
>     llvm/trunk/test/CodeGen/X86/vector-shuffle-512-v8.ll
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=239697&r1=239696&r2=239697&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Jun 14 08:07:47 2015
> @@ -9383,6 +9383,30 @@ static SDValue lowerV2X128VectorShuffle(
>                       DAG.getConstant(PermMask, DL, MVT::i8));
>  }
>
> +/// \brief Handle lowering 4-lane 128-bit shuffles.
> +static SDValue lowerV4X128VectorShuffle(SDLoc DL, MVT VT, SDValue V1,
> +                                        SDValue V2, ArrayRef<int> WidenedMask,
> +                                        SelectionDAG &DAG) {
> +
> +  assert(WidenedMask.size() == 4 && "Unexpected mask size for 128bit shuffle!");
> +  // form a 128-bit permutation.
> +  // convert the 64-bit shuffle mask selection values into 128-bit selection
> +  // bits defined by a vshuf64x2 instruction's immediate control byte.
> +  unsigned PermMask = 0, Imm = 0;
> +
> +  for (int i = 0, Size = WidenedMask.size(); i < Size; ++i) {
> +    if(WidenedMask[i] == SM_SentinelZero)

There should be a space after the 'if' here!

> +      return SDValue();
> +
> +    // use first element in place of undef musk
> +    Imm = (WidenedMask[i] == SM_SentinelUndef) ? 0 : WidenedMask[i];
> +    PermMask |= (Imm % 4) << (i * 2);
> +  }
> +
> +  return DAG.getNode(X86ISD::SHUF128, DL, VT, V1, V2,
> +                     DAG.getConstant(PermMask, DL, MVT::i8));
> +}
> +
>  /// \brief Lower a vector shuffle by first fixing the 128-bit lanes and then
>  /// shuffling each lane.
>  ///
> @@ -10176,6 +10200,10 @@ static SDValue lowerV8X64VectorShuffle(S
>    ArrayRef<int> Mask = SVOp->getMask();
>    assert(Mask.size() == 8 && "Unexpected mask size for v8 shuffle!");
>
> +  SmallVector<int, 4> WidenedMask;
> +  if (canWidenShuffleElements(Mask, WidenedMask))
> +    if(SDValue Op = lowerV4X128VectorShuffle(DL, VT, V1, V2, WidenedMask, DAG))

Same here! Try to use clang-format :-)

Thanks,

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc



More information about the llvm-commits mailing list