[cfe-dev] clang, C++ and compound literals in SSE2 intrinsics

Jonathan Sauer jonathan.sauer at gmx.de
Mon Apr 25 13:49:57 PDT 2011


I wrote:

> As seen in the diff, I simply changed the compound literal to the appropriate _mm_set_* function. Another
> possibility would be to change _mm_shuffle_* from a macro to a function, but I assume there is a reason it
> is currently implemented as a macro and not, as most of the other intrinsics, a function. So I'm a bit
> reluctant here.

The reason for the macro is that the indices passed to __builtin_shufflevector must be integer constants,
and function arguments aren't.

(I looked into SVN's history for emmintrin.h, and the three macros in question have been implemented as
they are now in revision 72979, apparently when __builtin_shufflevector was introduced to replace the
builtins __builtin_ia32_pshufd, __builtin_ia32_pshufhw and __builtin_ia32_pshuflw.)

So it seems that using _mm_set_* is the way to go.


Jonathan





More information about the cfe-dev mailing list