Quick question: How do you tell a C compiler to use an instruction set extension only within specific code blocks, like:
if(processor_has_instruction)
//use instruction
else
//fallback code that won't be optimised to use instruction
Poke: @cmuratori
-
-
[3/4] Put the code in a separate file and compile that file n times, one for each arch, with a macro that changes the names of the function so you can pick which one you call.
-
[4/4] Compile the majority of the code with the minimum platform, but make separate versions of specific routines and decorate them with a compiler-specific prefix like "__attribute__ ((__target__("avx2")))" (CLANG).
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.