On 20.02.2016 02:03, David Wohlferd wrote: > @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 testme 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 ("testme 5" : "+a" (value) : : "cc"); > + return value; > +@} > @end example
Sorry, but I don't like this example at all. First the new example is essentially academic and useless, while the previous example could well be used in real world code, except we could note here that we also have a __builtin_trap () now. Second if you don't mention that "cc" is already implicitly clobbered by default, and if it is written here it is ignored on i386 targets, then everybody will hurry to modify their asm code when there is no real reason for that. Bernd.