Thread: X64 inline asm
View Single Post
  #38  
Old 11-14-2011, 11:07
dbcch
 
Posts: n/a
Does anyone have any empirical or measured benchmarks on how well the Intel C/C++ compiler does vs Microsoft's? Aside from the X64 inline assembly support, I'm just wondering if there is a compelling reason to switch. It would seem it is likely to generate optimal code, but is the code generated tuned for Intel processors? Hmm...

Quote:
Originally Posted by rox View Post
its plug&play type software, you can hardly fail.. just after installing compiler right click your project and select something like 'use intel compiler blah blah blah'
Agreed, WTF... how could you fail? ;p

Quote:
Originally Posted by gigaman View Post
For the inline assembler, keep in mind that it heavily "corrupts" the optimization of the surrounding C code (well, at least it always did for MSVC, donno about Intel, but would guess it's the same). When the compiler reaches the asm block, it's a "black box" for it... so it dumps all the register values into local variables, appends the assembler block... and then loads the register values back.
So, it's better to write the whole function in inline assembler - than just a part, in which case the result might be worse than keeping it all in C, because the rest of the function is optimized much worse than if it were all in C.
AMEN Brother! Besides incurring overhead when injected into the middle of a function, people need to remember it mucks with the compiler's optimization in general. As processors become more complex, it frankly takes a 'smart' compiler to generate optimal code. Therefore, you must be very careful about using inline asm. Use it only when you absolutely have to, basically. Any extraneous use and you risk doing more harm than good.

Quote:
Originally Posted by gigaman View Post
It would be interesting to know what led Microsoft to bad inline assembler in x64...
I believe it is because of your aforementioend issue, though who knows for sure. I believe they want to discourage any inline assembly, of any type, and took the chance to not add this feature.
Reply With Quote