<div dir="ltr">I can't find any __builtin_select that I can use in clang's intrinsics headers.<div>I grepped for select and couldn't find any use of a select builtin in the intrinsics' headers nor the codegen tests.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Are you sure it's possible to make clang emit a select in this way?</div><div class="gmail_extra"><br></div><div class="gmail_extra">I even tried these two, but they generate a bunch of extractelements+insertelements (which eventually get merged into a shufflevector when optimizing):</div>
<div class="gmail_extra"><div class="gmail_extra">#define a_mm_blend_epi32(V1, V2, M) __extension__ ({ \</div><div class="gmail_extra">  __v4si __V1 = (V1); \</div><div class="gmail_extra">  __v4si __V2 = (V2); \</div><div class="gmail_extra">
  (__m128i)(__v4si){ (((M) & 0x01) ? (__V2) : (__V1))[0], \</div><div class="gmail_extra">                     (((M) & 0x02) ? (__V2) : (__V1))[1], \</div><div class="gmail_extra">                     (((M) & 0x04) ? (__V2) : (__V1))[2], \</div>
<div class="gmail_extra">                     (((M) & 0x08) ? (__V2) : (__V1))[3]}; })</div><div class="gmail_extra"><br></div><div class="gmail_extra">#define aa_mm_blend_epi32(V1, V2, M) __extension__ ({ \</div><div class="gmail_extra">
  __v4si __V1 = (V1); \</div><div class="gmail_extra">  __v4si __V2 = (V2); \</div><div class="gmail_extra">  (__m128i)(__v4si){ (((M) & 0x01) ? ((__V2)[0]) : ((__V1)[0])), \</div><div class="gmail_extra">                     (((M) & 0x02) ? ((__V2)[1]) : ((__V1)[1])), \</div>
<div class="gmail_extra">                     (((M) & 0x04) ? ((__V2)[2]) : ((__V1)[2])), \</div><div class="gmail_extra">                     (((M) & 0x08) ? ((__V2)[3]) : ((__V1)[3]))}; })</div></div><div class="gmail_extra">
<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">  Filipe<br><br><div class="gmail_quote">On Fri, May 2, 2014 at 6:02 PM, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank">nrotem@apple.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 style="word-wrap:break-word"><br><div><div class=""><div>
On May 2, 2014, at 6:00 PM, Filipe Cabecinhas <<a href="mailto:filcab+llvm.phabricator@gmail.com" target="_blank">filcab+llvm.phabricator@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">I'm not sure it's possible.</div>
</blockquote><div><br></div></div><div>It is possible to represent blends using vector selects in the IR. Are you missing a clang builtin? </div><div><div class="h5"><br><blockquote type="cite"><div dir="ltr"><div>I'm generating them from the headers for the intrinsics, I don't know if it's possible to directly generate selects. Let me know if I'm missing something.</div>

<div><br></div><div>Here's the patch.</div><div><br></div><div><a href="http://reviews.llvm.org/D3601#C75942NL780" target="_blank">http://reviews.llvm.org/D3601#C75942NL780</a></div><div><br></div><div>Filipe</div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Fri, May 2, 2014 at 4:54 PM, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank">nrotem@apple.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 style="word-wrap:break-word"><div><br><div><div>On May 2, 2014, at 4:50 PM, Filipe Cabecinhas <<a href="mailto:filcab+llvm.phabricator@gmail.com" target="_blank">filcab+llvm.phabricator@gmail.com</a>> wrote:</div>

<br><blockquote type="cite"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I'm proposing a patch for clang's simd intrinsics to generate</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">

<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">shufflevectors from the blend intrinsics.</span></blockquote>

</div><div><br></div></div><div>Why are you not generating vector selects?  </div></div></blockquote></div><br></div></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div></div>