> @example > -/* Note that this code will not compile with -masm=intel */ > -#define DebugBreak() asm("int $3") > +/* Define macro at file scope with basic asm. */ > +/* Add macro parameter p to eax. */ > +asm(".macro test p\n\t" > + "addl $\\p, %eax\n\t" > + ".endm"); > + > +/* Use macro in function using extended asm. It needs */ > +/* the "cc" clobber since the flags are changed and uses */ > +/* the "a" constraint since it modifies eax. */ > +int DoAdd(int value) > +@{ > + asm("test 5" : "+a" (value) : : "cc"); > + return value; > +@}
To make this work you need the .macro appear before all uses in the asm files. I do not think we really promise that wihtout -fno-toplevel-reorder -fno-lto Honza