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

Arji Cot arjicot at gmail.com
Fri Jul 19 23:56:43 PDT 2013


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 ?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130720/ede92e3f/attachment.html>


More information about the cfe-dev mailing list