<p dir="ltr">I may get one or two in the next month, but not more than that. Focused on the pass manager for now. If none get there first, I'll eventually circle back though, so they won't rot forever.</p>
<div class="gmail_quote">On Jan 30, 2015 11:21 AM, "Ahmed Bougacha" <<a href="mailto:ahmed.bougacha@gmail.com">ahmed.bougacha@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I filed a couple more, in case they're actually different issues:<div>- <a href="http://llvm.org/bugs/show_bug.cgi?id=22412" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22412</a></div><div>- <a href="http://llvm.org/bugs/show_bug.cgi?id=22413" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22413</a></div><div><br></div><div>And that's pretty much it for internal changes. I'm fine with flipping the switch; Quentin, are you?</div><div>Also, just to have an idea, do you (or someone else!) plan to tackle these in the near future?<br></div><div><br></div><div class="gmail_extra"><div><div>-Ahmed</div></div>
<br><div class="gmail_quote">On Thu, Jan 29, 2015 at 11:50 AM, Ahmed Bougacha <span dir="ltr"><<a href="mailto:ahmed.bougacha@gmail.com" target="_blank">ahmed.bougacha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><div><br></div></div><div class="gmail_quote"><div><div>On Wed, Jan 28, 2015 at 4:47 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Jan 28, 2015 at 4:05 PM, Ahmed Bougacha <span dir="ltr"><<a href="mailto:ahmed.bougacha@gmail.com" target="_blank">ahmed.bougacha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Chandler,<br><br>I've been looking at the regressions Quentin mentioned, and filed a PR<br>for the most egregious one: <a href="http://llvm.org/bugs/show_bug.cgi?id=22377" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22377</a><br><br>As for the others, I'm working on reducing them, but for now, here are<br>some raw observations, in case any of it rings a bell:<br></div></blockquote><div><br></div></span><div>Very cool, and thanks for the analysis!</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><br>Another problem I'm seeing is that in some cases we can't fold memory anymore:<br> vpermilps $-0x6d, -0xXX(%rdx), %xmm2 ## xmm2 = mem[3,0,1,2]<br> vblendps $0x1, %xmm2, %xmm0, %xmm0<br>becomes:<br> vmovaps -0xXX(%rdx), %xmm2<br> vshufps $0x3, %xmm0, %xmm2, %xmm3 ## xmm3 = xmm2[3,0],xmm0[0,0]<br> vshufps $-0x68, %xmm0, %xmm3, %xmm0 ## xmm0 = xmm3[0,2],xmm0[1,2]<br><br><br>Also, I see differences when some loads are shuffled, that I'm a bit<br>conflicted about:<br> vmovaps -0xXX(%rbp), %xmm3<br> ...<br> vinsertps $0xc0, %xmm4, %xmm3, %xmm5 ## xmm5 = xmm4[3],xmm3[1,2,3]<br>becomes:<br> vpermilps $-0x6d, -0xXX(%rbp), %xmm2 ## xmm2 = mem[3,0,1,2]<br> ...<br> vinsertps $0xc0, %xmm4, %xmm2, %xmm2 ## xmm2 = xmm4[3],xmm2[1,2,3]<br><br>Note that the second version does the shuffle in-place, in xmm2.<br><br><br>Some are blends (har har) of those two:<br> vpermilps $-0x6d, %xmm_mem_1, %xmm6 ## xmm6 = xmm_mem_1[3,0,1,2]<br> vpermilps $-0x6d, -0xXX(%rax), %xmm1 ## xmm1 = mem_2[3,0,1,2]<br> vblendps $0x1, %xmm1, %xmm6, %xmm0 ## xmm0 = xmm1[0],xmm6[1,2,3]<br>becomes:<br> vmovaps -0xXX(%rax), %xmm0 ## %xmm0 = mem_2[0,1,2,3]<br> vpermilps $-0x6d, %xmm0, %xmm1 ## xmm1 = xmm0[3,0,1,2]<br> vshufps $0x3, %xmm_mem_1, %xmm0, %xmm0 ## xmm0 = xmm0[3,0],xmm_mem_1[0,0]<br> vshufps $-0x68, %xmm_mem_1, %xmm0, %xmm0 ## xmm0 = xmm0[0,2],xmm_mem_1[1,2]<br><br><br>I also see a lot of somewhat neutral (focusing on Haswell for now)<br>domain changes such as (xmm5 and 0 are initially integers, and are<br>dead after the store):<br> vpshufd $-0x5c, %xmm0, %xmm0 ## xmm0 = xmm0[0,1,2,2]<br> vpalignr $0xc, %xmm0, %xmm5, %xmm0 ## xmm0 = xmm0[12,13,14,15],xmm5[0,1,2,3,4,5,6,7,8,9,10,11]<br> vmovdqu %xmm0, 0x20(%rax)<br>turning into:<br> vshufps $0x2, %xmm5, %xmm0, %xmm0 ## xmm0 = xmm0[2,0],xmm5[0,0]<br> vshufps $-0x68, %xmm5, %xmm0, %xmm0 ## xmm0 = xmm0[0,2],xmm5[1,2]<br> vmovups %xmm0, 0x20(%rax)</div></blockquote></div></div></div><br>All of these stem from what I think is the same core weakness of the current algorithm: we prefer the fully general shufps+shufps 4-way shuffle/blend far too often. Here is how I would more precisely classify the two things missing here:</div><div class="gmail_extra"><br></div><div class="gmail_extra">- Check if either inputs are "in place" and we can do a fast single-input shuffle with a fixed blend.</div></div></blockquote><div><br></div></div></div><div>I believe this would be <a href="http://llvm.org/bugs/show_bug.cgi?id=22390" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22390</a></div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">- Check if we can form a rotation and use palignr to finish a shuffle/blend</div></div></blockquote><div><br></div></span><div>.. and this would be <a href="http://llvm.org/bugs/show_bug.cgi?id=22391" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22391</a></div><div><br></div><div>I think this about covers the Haswell regressions I'm seeing. Now for some pre-AVX fun!</div><span><font color="#888888"><div><br></div><div>-Ahmed</div></font></span><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">There may be other patterns we're missing, but these two seem to jump out based on your analysis, and may be fairly easy to tackle.</div></div>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>
<br>_______________________________________________<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></blockquote></div>