GCC inline assembly
main sources:
- GCC-Inline-Assembly-HowTo, Sandeep.S, https://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
- 6.50.2 Extended Asm - Assembler Instructions with C Expression Operands, GNU, https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
§ syntax
asm asm-qualifiers ( AssemblerTemplate
: OutputOperands
[ : InputOperands
[ : Clobbers ] ])
asm asm-qualifiers ( AssemblerTemplate
: OutputOperands
: InputOperands
: Clobbers
: GotoLabels)
§§ AssemblerTemplate
- format strings
%%- escaped
%symbol
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#AssemblerTemplate
§§ OutputOperands
§§ InputOperands
§§ Clobbers
the asm instructions may change regiters other than those listed in the
output operands. Which would cause the compiler to generate wrong code.
Clobers explicitly tell the compiler “here I’m writting to these registers”