(no title)
tmurray | 11 years ago
look up the target attribute and the ifunc attribute--it's basically a way to compile multiple versions of a function for different targets in a single source file and then use the dynamic linker to determine which one to resolve at runtime. obvious use is for things like optimized memcpy implementations.
vardump|11 years ago
nkurz|11 years ago
Even more practically, Agner has a typically excellent description of the strengths and weaknesses of the dispatch strategies used by different compilers in Section 13 (p. 122) here: http://www.agner.org/optimize/optimizing_cpp.pdf
awalton|11 years ago
All you need to do is figure out what's the best version of that function to write for that target, and let GCC do the rest of the heavy lifting.