[AVX512] Bring back vector-shuffle lowering support through broadcasts

Robert Khasanov rob.khasanov at gmail.com
Wed Oct 22 05:04:07 PDT 2014


I can replace broadcast lowering (and all other similar code) just to
lower512BitVectorShuffle
functions.
But, other code will remain in separate type functions (these part are not
similar).

Is it OK for you?

2014-10-22 15:53 GMT+04:00 Demikhovsky, Elena <elena.demikhovsky at intel.com>:

>  Just use one function and pass the VT as parameter or do everything
> inside the caller.
>
> I don’t see the reason for writing 4 similar functions.
>
>
>
> -          * Elena*
>
>
>
> *From:* Robert Khasanov [mailto:rob.khasanov at gmail.com]
> *Sent:* Wednesday, October 22, 2014 14:27
>
> *To:* Demikhovsky, Elena
> *Cc:* reviews+D5885+public+df9a14ab3195f7ff at reviews.llvm.org;
> chandlerc at gmail.com; llvm-commits at cs.uiuc.edu
> *Subject:* Re: [AVX512] Bring back vector-shuffle lowering support
> through broadcasts
>
>
>
> lower512BitVectorShuffle is already existed in X86ISelLowering.cpp. There
> is switch inside the function.
>
> Vector-shuffle can be lowered also to UNPACK{H,L}, PSHUF, VPERM, VPERMILP.
> For these instructions lowering codes are not similar.
>
>
>
> 2014-10-22 15:13 GMT+04:00 Demikhovsky, Elena <elena.demikhovsky at intel.com
> >:
>
> But why it can’t be one lower512VectorShuffle at least?
>
>
>
> -          * Elena*
>
>
>
> *From:* Robert Khasanov [mailto:rob.khasanov at gmail.com]
> *Sent:* Wednesday, October 22, 2014 14:11
> *To:* Demikhovsky, Elena
> *Cc:* reviews+D5885+public+df9a14ab3195f7ff at reviews.llvm.org;
> chandlerc at gmail.com; llvm-commits at cs.uiuc.edu
> *Subject:* Re: [AVX512] Bring back vector-shuffle lowering support
> through broadcasts
>
>
>
> Elena,
>
>
>
> On 256-bit versions of vector-shuffle lowering (lowerV8F32VectorShuffle,
> lowerV8I32VectorShuffle etc), you can see that there is big difference
> inside the functions (except broadcasts and blends). I assume Chandler
> provided opportunity to implement 512-bit vector-shuffle lowering in the
> same way in future.
>
>
>
> 2014-10-22 12:08 GMT+04:00 Demikhovsky, Elena <elena.demikhovsky at intel.com
> >:
>
> Why do you need so many functions:
> lowerV16F32VectorShuffle
> lowerV8I64VectorShuffle
> lowerV16I32VectorShuffle
> .. ?
>
> I don't see a big diff between them.
>
> -  Elena
>
>
>
> -----Original Message-----
> From: Robert Khasanov [mailto:rob.khasanov at gmail.com]
> Sent: Tuesday, October 21, 2014 21:03
> To: rob.khasanov at gmail.com; chandlerc at gmail.com
> Cc: Demikhovsky, Elena; anemet at apple.com; llvm-commits at cs.uiuc.edu
> Subject: [PATCH] [AVX512] Bring back vector-shuffle lowering support
> through broadcasts
>
> Hi chandlerc,
>
> I found that after your commit at rev219046 512-bit broadcasts lowering
> become non-optimal. Most of tests on broadcasting and embedded broadcasting
> were changed and they doesn’t produce efficient code.
>
> Example below is from your commit changes (it’s the first test from
> test/CodeGen/X86/avx512-vbroadcast.ll):
>
>  define   <16 x i32> @_inreg16xi32(i32 %a) {
>  ; CHECK-LABEL: _inreg16xi32:
>  ; CHECK:       ## BB#0:
> -; CHECK-NEXT:    vpbroadcastd %edi, %zmm0
> +; CHECK-NEXT:    vmovd %edi, %xmm0
> +; CHECK-NEXT:    vpbroadcastd %xmm0, %ymm0
> +; CHECK-NEXT:    vinserti64x4 $1, %ymm0, %zmm0, %zmm0
>  ; CHECK-NEXT:    retq
>  %b = insertelement <16 x i32> undef, i32 %a, i32 0
>   %c = shufflevector <16 x i32> %b, <16 x i32> undef, <16 x i32>
> zeroinitializer
>    ret <16 x i32> %c
> }
>
> Here, 256-bit broadcast was generated instead of 512-bit one.
>
> I investigated the reason, found that in your version of vector-shuffle
> lowering there is no AVX-512 support.
>
> In this patch
> 1) I added vector-shuffle lowering through broadcasts
> 2) Removed asserts and branches likes because this is incorrect
> -  assert(Subtarget->hasDQI() && "We can only lower v8i64 with
> AVX-512-DQI");
> 3) Fixed lowering tests
>
> http://reviews.llvm.org/D5885
>
> Files:
>   lib/Target/X86/X86ISelLowering.cpp
>   lib/Target/X86/X86InstrAVX512.td
>   test/CodeGen/X86/avx512-arith.ll
>   test/CodeGen/X86/avx512-vbroadcast.ll
>   test/CodeGen/X86/avx512-vec-cmp.ll
>   test/CodeGen/X86/vector-shuffle-512-v8.ll
>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
>
>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141022/2bdd40aa/attachment.html>


More information about the llvm-commits mailing list