[cfe-dev] clang and gcc X86 built-in functions

Chris Lattner clattner at apple.com
Thu Sep 16 11:09:35 PDT 2010


On Sep 16, 2010, at 10:50 AM, Sebastian Redl wrote:

>> 
>> #include <stdio.h>
>> 
>> int main (int argc, const char * argv[])
>> {
>>     typedef short _SSE_VecS16 __attribute__ ((__vector_size__ (16)));
>>     
>>     register _SSE_VecS16 b;
>>     register _SSE_VecS16 c;
>>     __builtin_ia32_paddw128(b, c);
>>     
>>     return 0;
>> }
> 
> IIRC, Clang intentionally doesn't have any built-ins for operations which are naturally modeled by operators. Either use the official SSE intrinsics, or use operators. Each built-in has a maintenance overhead, and such redundant ones aren't worth it, when b + c (or b += c?) does the same thing.
> 

More specifically, please use the <xmmintrin.h> and related headers.  Those are the public, documented interfaces to the X86 vector instructions.  Using generic vectors is also a great option if you only care about targeting clang, not other compilers like GCC, ICC, MSVC etc.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100916/58b98259/attachment.html>


More information about the cfe-dev mailing list