c++ - Checking if SSE is supported at runtime -


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

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -