3 ms·
Inline ASM might be somewhat opaque to the compiler and interfere with optimization in general. It's not in the IR format that the optimizer uses; register allo
by ygra 4y ago
Inline ASM might be somewhat opaque to the compiler and interfere with optimization in general. It's not in the IR format that the optimizer uses; register allocation is probably up to the ASM code, not the compiler's choice, perhaps forcing it to either skip optimizing a complete function, just the block in which inline ASM appears, or even to add additional code outside the block to make it run correctly.
- rincebrain 4y agoAIUI compilers treat inline ASM as an entirely opaque block they cannot mutate or assume much about, so if you're inlining 100 lines of ASM, you will get the ASM you asked for, for better or worse. (Treating it as completely opaque is, I believe, also why you can get away with things like inlining AVX2 ASM on an -mno-avx2 build, for example.)