c++ - Checking if SSE is supported at runtime -
this question has answer here:
i check if sse4 or avx supported @ runtime, program may take advantage of processor specific instructions without creating binary each processor.
if determine @ runtime, use interface , switch between different instruction sets.
gcc has way of doing starts calling __builtin_cpu_init
calling __builtin_cpu_is
, __builtin_cpu_supports
check features. https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/x86-built-in-functions.html
on x86, when using c++ frontend, gcc supports "function multiversioning", allows write multiple versions of function, specify target should used on, , let gcc take care of making sure called. https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/function-multiversioning.html
Comments
Post a Comment