<div dir="ltr">Wow. Somehow, I forgot about vbroadcast and vpbroadcast. =[ Sorry about that. I'll fix those.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 26, 2014 at 3:39 AM, Andrea Di Biagio <span dir="ltr"><<a href="mailto:andrea.dibiagio@gmail.com" target="_blank">andrea.dibiagio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chandler,<br>
<br>
Here is another test.<br>
<br>
When looking at the AVX codegen, I noticed that, when using the new<br>
shuffle lowering, we no longer emit a single vbroadcastss in the case<br>
where the shuffle performs a splat of a scalar float loaded from<br>
memory.<br>
<br>
For example:<br>
(with -mcpu=corei7-avx -x86-experimental-vector-shuffle-lowering)<br>
   vmovss (%rdi), %xmm0<br>
   vpermilps $0, %xmm0, %xmm0 # xmm0 = xmm0[0,0,0,0]<br>
<br>
Instead of:<br>
(with -mcpu=corei7-avx)<br>
  vbroadcastss (%rdi), %xmm0<br>
<br>
I have attached a small reproducible for it.<br>
<br>
Basically, the old shuffle lowering logic calls function<br>
'NormalizeVectorShuffle' to handle shuffles that perform a splat<br>
operation.<br>
On AVX, function 'NormalizeVectorShuffle' tries to lower a splat where<br>
the splat value comes from a load into a X86ISD::VBROADCAST dag node.<br>
Later on, during instruction selection, we emit a single avx_broadcast<br>
for the load+splat sequence (basically, we end up folding the load in<br>
the operand of the vbroadcastss).<br>
<br>
What happens is that the new shuffle lowering doesn't emit a<br>
vbroadcast node in this case and eventually we end up selecting the<br>
sequence of vmovss+vpermilps.<br>
<br>
I hope this helps.<br>
<span class="HOEnZb"><font color="#888888">Andrea<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, Sep 23, 2014 at 10:53 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br>
><br>
> On Tue, Sep 23, 2014 at 2:35 PM, Simon Pilgrim <<a href="mailto:llvm-dev@redking.me.uk">llvm-dev@redking.me.uk</a>><br>
> wrote:<br>
>><br>
>> If you don’t want to spend time on this, I’d be happy to create a<br>
>> candidate patch for review? I’ve been unclear if you were taking patches for<br>
>> your shuffle work prior to it becoming the default.<br>
><br>
><br>
> While I'm happy to work on it, I'm even more happy to have patches. =D<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</div></div></blockquote></div><br></div>