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

Sebastian Redl sebastian.redl at getdesigned.at
Thu Sep 16 10:50:36 PDT 2010


On Sep 16, 2010, at 10:33 AM, Alexandre Colucci wrote:

> 
> gcc 4.2 supports a bunch of X86 built-in functions (for example SSE vector instructions) that appear to not be known by clang:
> http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/X86-Built_002din-Functions.html
> 
> Is it a known incompatibility with gcc? Is there a plan to implement these built-in functions in clang? Or clang has some built-in replacements? Or did I simply miss something?
> Here is a sample code that does not build with clang on 10.6 but compile with gcc 4.2:
> 
> #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.

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


More information about the cfe-dev mailing list