McIntyre: Scanning for assembly code in Free Software packages
Posted Apr 2, 2013 18:23 UTC (Tue) by
JoeBuck (subscriber, #2330)
In reply to:
McIntyre: Scanning for assembly code in Free Software packages by stevem
Parent article:
McIntyre: Scanning for assembly code in Free Software packages
If you have an older package that uses assembly language for performance, it might be worth re-evaluating whether the assembly code still beats the GCC output.
If you think that you need to write assembly language because you need atomic operations, you should first read the GCC manual and learn about the __sync and __atomic builtins (these are also supported by LLVM and Intel's compiler, so you aren't locking yourself into GCC). The compiler will then choose the correct implementation for the target architecture, so your program works on ARM and Sparc even if you don't know the assembly language for those architectures.
There will still be specialized cases where assembly language might help, but it makes the program less portable (unless fallback C/C++ code is provided, and then maybe it makes sense to try to reduce the gap between the C++ and the assembly performance by improving the code or possibly by helping the GCC folks to improve the compiler by providing good bug reports).
(
Log in to post comments)