[PATCH] Added tests for shufflevector lowering to blend instrs.These tests ensure that a change I will propose in clang works asexpected.

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Fri May 2 18:35:56 PDT 2014


I can't find any __builtin_select that I can use in clang's intrinsics
headers.
I grepped for select and couldn't find any use of a select builtin in the
intrinsics' headers nor the codegen tests.

Are you sure it's possible to make clang emit a select in this way?

I even tried these two, but they generate a bunch of
extractelements+insertelements (which eventually get merged into a
shufflevector when optimizing):
#define a_mm_blend_epi32(V1, V2, M) __extension__ ({ \
  __v4si __V1 = (V1); \
  __v4si __V2 = (V2); \
  (__m128i)(__v4si){ (((M) & 0x01) ? (__V2) : (__V1))[0], \
                     (((M) & 0x02) ? (__V2) : (__V1))[1], \
                     (((M) & 0x04) ? (__V2) : (__V1))[2], \
                     (((M) & 0x08) ? (__V2) : (__V1))[3]}; })

#define aa_mm_blend_epi32(V1, V2, M) __extension__ ({ \
  __v4si __V1 = (V1); \
  __v4si __V2 = (V2); \
  (__m128i)(__v4si){ (((M) & 0x01) ? ((__V2)[0]) : ((__V1)[0])), \
                     (((M) & 0x02) ? ((__V2)[1]) : ((__V1)[1])), \
                     (((M) & 0x04) ? ((__V2)[2]) : ((__V1)[2])), \
                     (((M) & 0x08) ? ((__V2)[3]) : ((__V1)[3]))}; })


  Filipe

On Fri, May 2, 2014 at 6:02 PM, Nadav Rotem <nrotem at apple.com> wrote:

>
> On May 2, 2014, at 6:00 PM, Filipe Cabecinhas <
> filcab+llvm.phabricator at gmail.com> wrote:
>
> I'm not sure it's possible.
>
>
> It is possible to represent blends using vector selects in the IR. Are you
> missing a clang builtin?
>
> 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.
>
> Here's the patch.
>
> http://reviews.llvm.org/D3601#C75942NL780
>
> Filipe
>
>
> On Fri, May 2, 2014 at 4:54 PM, Nadav Rotem <nrotem at apple.com> wrote:
>
>>
>> On May 2, 2014, at 4:50 PM, Filipe Cabecinhas <
>> filcab+llvm.phabricator at gmail.com> wrote:
>>
>> I'm proposing a patch for clang's simd intrinsics to generate
>> shufflevectors from the blend intrinsics.
>>
>>
>> Why are you not generating vector selects?
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140502/651b581b/attachment.html>


More information about the llvm-commits mailing list