3 ms·
It does, but it calls it builtins instead > B) To access CPU-specific instructions. > It is possible that the reason gcc isn't generating the specific instruc
by nextaccountic 5y ago
It does, but it calls it builtins instead
> B) To access CPU-specific instructions.
> It is possible that the reason gcc isn't generating the specific instruction you expected is that it is known to be slow, problematical, not supported on the processors you are compiling for, etc. But if there is a reason you need a specific instruction, gcc has builtins for many of the more useful ones. Using these in preference to inline asm allows gcc's optimizers to produce better code. However it is possible that an instruction is new enough or obscure enough that there is no builtin for it.
- ncmncm 5y agoThe most common cause for failure to use the instruction you wanted is that the compiler is told, implicitly, to generate code that would run on a 2001-era AMD Opteron or similarly antediluvian target. Almost every instruction added, since, at great expense, is there to solve a performance problem. A quiet "-mavx" to unlock these particular shackles fixes numerous performance failings.