Re:(Debugging Story) Inline Assembly Dangers
by AshamedCaptain on Monday June 10, 2024 @11:03AM
(#40634398)
One of the benefits of gcc's powerful inline asm support is that it allows you to write new intrinsics. This is almost impossible in most other compilers, as they will do crazy things such as flushing out all registers before each asm block. Very useful for low level work.
Re:(Debugging Story) Inline Assembly Dangers
by leni536 on Monday June 10, 2024 @11:45AM
(#40634808)
> it allows you to write new intrinsics
I admit that it gets very close, however I think compiler provided intrinsics can be and are optimized more than ones that are implemented with inline asm, as the compiler knows about the semantics of the instruction for such an intrinsic, and not much about an inline asm one, apart from inputs/outputs/clobbers.
Having said that I agree that inline asm is very useful for instructions that the compiler does not know about.
If the compiler does know about a specific instruction, then it's better to just provide the intrinsic than try to infer it from some inline asm string.