<div dir="ltr">I can replace broadcast lowering (and all other similar code) just to <span style="font-family:arial,sans-serif;font-size:13px">lower512BitVectorShuffle functions.</span><div><span style="font-family:arial,sans-serif;font-size:13px">But, other code will remain in separate type functions (these part are not similar).</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Is it OK for you?</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-22 15:53 GMT+04:00 Demikhovsky, Elena <span dir="ltr"><<a href="mailto:elena.demikhovsky@intel.com" target="_blank">elena.demikhovsky@intel.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Just use one function and pass the VT as parameter or do everything inside the caller.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I don’t see the reason for writing 4 similar functions.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt">
<u></u><span style="font-family:"Calibri","sans-serif";color:#31849b"><span>-<span style="font:7.0pt "Times New Roman"">         
</span></span></span><u></u><span dir="LTR"></span><b><i><span style="color:#31849b"> Elena<u></u><u></u></span></i></b></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Robert Khasanov [mailto:<a href="mailto:rob.khasanov@gmail.com" target="_blank">rob.khasanov@gmail.com</a>]
<br>
<b>Sent:</b> Wednesday, October 22, 2014 14:27</span></p><div><div class="h5"><br>
<b>To:</b> Demikhovsky, Elena<br>
<b>Cc:</b> <a href="mailto:reviews%2BD5885%2Bpublic%2Bdf9a14ab3195f7ff@reviews.llvm.org" target="_blank">reviews+D5885+public+df9a14ab3195f7ff@reviews.llvm.org</a>; <a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>; <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [AVX512] Bring back vector-shuffle lowering support through broadcasts<u></u><u></u></div></div><p></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">lower512BitVectorShuffle is already existed in X86ISelLowering.cpp. There is switch inside the function. <u></u><u></u></p>
<div>
<p class="MsoNormal">Vector-shuffle can be lowered also to UNPACK{H,L}, PSHUF, VPERM, VPERMILP. For these instructions lowering codes are not similar.<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">2014-10-22 15:13 GMT+04:00 Demikhovsky, Elena <<a href="mailto:elena.demikhovsky@intel.com" target="_blank">elena.demikhovsky@intel.com</a>>:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">But why it can’t be one lower512VectorShuffle at least?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36.0pt">
<span style="font-family:"Calibri","sans-serif";color:#31849b">-</span><span style="font-size:7.0pt;color:#31849b">         
</span><b><i><span style="color:#31849b"> Elena</span></i></b><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Robert Khasanov [mailto:<a href="mailto:rob.khasanov@gmail.com" target="_blank">rob.khasanov@gmail.com</a>]
<br>
<b>Sent:</b> Wednesday, October 22, 2014 14:11<br>
<b>To:</b> Demikhovsky, Elena<br>
<b>Cc:</b> <a href="mailto:reviews%2BD5885%2Bpublic%2Bdf9a14ab3195f7ff@reviews.llvm.org" target="_blank">
reviews+D5885+public+df9a14ab3195f7ff@reviews.llvm.org</a>; <a href="mailto:chandlerc@gmail.com" target="_blank">
chandlerc@gmail.com</a>; <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">
llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [AVX512] Bring back vector-shuffle lowering support through broadcasts</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">Elena,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">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.<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">2014-10-22 12:08 GMT+04:00 Demikhovsky, Elena <<a href="mailto:elena.demikhovsky@intel.com" target="_blank">elena.demikhovsky@intel.com</a>>:<u></u><u></u></p>
<p class="MsoNormal">Why do you need so many functions:<br>
lowerV16F32VectorShuffle<br>
lowerV8I64VectorShuffle<br>
lowerV16I32VectorShuffle<br>
.. ?<br>
<br>
I don't see a big diff between them.<br>
<br>
-  Elena<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
-----Original Message-----<br>
From: Robert Khasanov [mailto:<a href="mailto:rob.khasanov@gmail.com" target="_blank">rob.khasanov@gmail.com</a>]<br>
Sent: Tuesday, October 21, 2014 21:03<br>
To: <a href="mailto:rob.khasanov@gmail.com" target="_blank">rob.khasanov@gmail.com</a>;
<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a><br>
Cc: Demikhovsky, Elena; <a href="mailto:anemet@apple.com" target="_blank">anemet@apple.com</a>;
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
Subject: [PATCH] [AVX512] Bring back vector-shuffle lowering support through broadcasts<br>
<br>
Hi chandlerc,<br>
<br>
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.<br>
<br>
Example below is from your commit changes (it’s the first test from test/CodeGen/X86/avx512-vbroadcast.ll):<br>
<br>
 define   <16 x i32> @_inreg16xi32(i32 %a) {<br>
 ; CHECK-LABEL: _inreg16xi32:<br>
 ; CHECK:       ## BB#0:<br>
-; CHECK-NEXT:    vpbroadcastd %edi, %zmm0<br>
+; CHECK-NEXT:    vmovd %edi, %xmm0<br>
+; CHECK-NEXT:    vpbroadcastd %xmm0, %ymm0<br>
+; CHECK-NEXT:    vinserti64x4 $1, %ymm0, %zmm0, %zmm0<br>
 ; CHECK-NEXT:    retq<br>
 %b = insertelement <16 x i32> undef, i32 %a, i32 0<br>
  %c = shufflevector <16 x i32> %b, <16 x i32> undef, <16 x i32> zeroinitializer<br>
   ret <16 x i32> %c<br>
}<br>
<br>
Here, 256-bit broadcast was generated instead of 512-bit one.<br>
<br>
I investigated the reason, found that in your version of vector-shuffle lowering there is no AVX-512 support.<br>
<br>
In this patch<br>
1) I added vector-shuffle lowering through broadcasts<br>
2) Removed asserts and branches likes because this is incorrect<br>
-  assert(Subtarget->hasDQI() && "We can only lower v8i64 with AVX-512-DQI");<br>
3) Fixed lowering tests<br>
<br>
<a href="http://reviews.llvm.org/D5885" target="_blank">http://reviews.llvm.org/D5885</a><br>
<br>
Files:<br>
  lib/Target/X86/X86ISelLowering.cpp<br>
  lib/Target/X86/X86InstrAVX512.td<br>
  test/CodeGen/X86/avx512-arith.ll<br>
  test/CodeGen/X86/avx512-vbroadcast.ll<br>
  test/CodeGen/X86/avx512-vec-cmp.ll<br>
  test/CodeGen/X86/vector-shuffle-512-v8.ll<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">---------------------------------------------------------------------<br>
Intel Israel (74) Limited<br>
<br>
This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited<u></u><u></u></p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div><div><div class="h5">
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></div></div></div>

</blockquote></div><br></div>