[cfe-dev] No built-in functions at all for clang ?

Jeffrey Walton noloader at gmail.com
Sat Jul 20 21:25:57 PDT 2013


On Sat, Jul 20, 2013 at 2:56 AM, Arji Cot <arjicot at gmail.com> wrote:
> Hi everyone,
> If I'm with GCC and I want to check at runtime if a given machine got a
> given instruction set, I use something like that
>
> #include <stdio.h>
>
> int main()
> {
>     if (__builtin_cpu_supports("mmx")) {
>         printf("\nOK\n");
>     } else
>         printf("\nKO\n");
>     return (0);
> }
>
> as documented here
> http://gcc.gnu.org/onlinedocs/gcc/X86-Built_002din-Functions.html
>
> Now under clang I can't find something similar, I can't find built-in
> functions at all to tell you the truth, I noticed that there are "strange"
> functions named llvm.xxx.xxx but they don't really look like builtin
> functions at all, at least they don't offer the same functionality of what
> is offered by this simple GCC function.
>
> Notice that I want function to check this at runtime, I'm not considering
> solving this with preprocessor macro or anything at compile-time.
> How I can solve this with Clang ? How do I check for support for a given set
> of instructions ?
http://clang.llvm.org/docs/LanguageExtensions.html



More information about the cfe-dev mailing list