3 ms·
Hello. I'm an assembly programmer. I used a compiler to generate the majority of code, and can hand-craft any assembly that comes out of it. I understand how co
by dragontamer 14y ago
Hello. I'm an assembly programmer. I used a compiler to generate the majority of code, and can hand-craft any assembly that comes out of it. I understand how compilers auto-generate SIMD instructions can be more easily compiler-generated if I make a "struct of arrays" instead of "an array of structs".
TLDR: Real performance programmers need to understand the assembly a compiler generates if they hope to tune the compiler to generate optimal assembly. Also, GCC -O3 is prone to removing too much code and reordering it, causing memory barrier issues and the like. All multi-threaded programmers need to understand how the compiler generates assembly (ie: by reordering your code), and how it can generate new bugs if you don't use the right compiler flags.
- colanderman 14y agoAlso, GCC -O3 is prone to removing too much code and reordering it, causing memory barrier issues and the like. Whoah, that's what __sync_synchronize() and volatile are for. If you're trying to write order-dependent multithreaded code without those, the bug's in your code, not in compiler flag juju.