<div dir="ltr"><div class="gmail_extra">Sorry for the delays...</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 1, 2015 at 9:24 AM, Sanjay Patel <span dir="ltr"><<a href="mailto:spatel@rotateright.com" target="_blank">spatel@rotateright.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">In <a href="http://reviews.llvm.org/D7866#131618" target="_blank">http://reviews.llvm.org/D7866#131618</a>, @chandlerc wrote:<br>
<br>
> I'm not really sold on doing this as a target combine. Is there some reason we can't just produce the desired insertps or blendps when lowering? This doesn't seem likely to come up only after doing some other shuffle lowering, but maybe I'm not seeing why.<br>
<br>
<br>
</span>Let me answer this question first before going to wrangle up some data on the other question:<br>
I made this a target combine because I don't know how else to handle this case given our current intrinsic lowering:<br>
<br>
  define <4 x float> @blendps(<4 x float> %x, <4 x float> %y) {<br>
    %0 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %x, <4 x float> %y, i8 0)<br>
    ret <4 x float> %0<br>
  }<br>
<br>
This is the IR produced when a programmer uses SSE intrinsics in C source. It directly becomes an INSERTPS node via:<br>
<br>
  X86_INTRINSIC_DATA(sse41_insertps,    INTR_TYPE_3OP, X86ISD::INSERTPS, 0)</blockquote></div><br>I think we just need to change the SSE intrinsics to use generic shuffle IR rather than intrinsics. We shouldn't be worrying about re-combining the LLVM instruction intrinsics in the backend to speed things up. We should insist that code use generic IR as input if they want this kind of combining.</div></div>