Hi everyone,<br>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<br><pre><code><span>#include</span><span> </span><span><stdio.h></span><span>
</span><span>int</span><span> main</span><span>()</span><span>
</span><span>{</span><span>
</span><span>if</span><span> </span><span>(</span><span>__builtin_cpu_supports</span><span>(</span><span>"mmx"</span><span>))</span><span> </span><span>{</span><span>
printf</span><span>(</span><span>"\nOK\n"</span><span>);</span><span>
</span><span>}</span><span> </span><span>else</span><span>
printf</span><span>(</span><span>"\nKO\n"</span><span>);</span><span>
</span><span>return</span><span> </span><span>(</span><span>0</span><span>);</span><span>
</span><span>}</span></code></pre>as documented here <a href="http://gcc.gnu.org/onlinedocs/gcc/X86-Built_002din-Functions.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc/X86-Built_002din-Functions.html</a><br><br>
Now under clang I can't find something similar, I can't find built-in functions at all to tell you the <span lang="en"><span>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.<br>
<br>Notice that I want function to check this at runtime, I'm not
considering solving this with preprocessor macro or anything at
compile-time.<br>How I can solve this with Clang ? How do I check for support for a given set of instructions ?<br>
<br>Thanks.</span></span>