"\n\t" in inline asm
Martynas Kunigelis
mkunigelis@alna.lt
Thu Dec 10 07:13:00 GMT 1998
Good day,
I use inline assembly quite often and I am a little disturbed by the
need to append "\n\t" to the end of every inline assembly line. This
makes the code much less readable, so I end up using a preprocessor hack
like this:
#define _ "\n\t"
asm (
"movl %0,%1" _
"decl %2" _
"int $0x80"
: /* this is just an example */
: "=r" (0) /* whatever */
);
#undef _
While experimenting I tried using commas at the end of each line, like
this:
asm (
"movl %0,%1",
"decl %2",
"int $0x80"
: /* this is just an example */
: "=r" (0) /* whatever */
);
It compiled w/o problems, but the resulting .s file had only the last
line from the inline asm statement, that is "int $0x80". It seems as if
it was evaluated as a regular C statement, like "a = 1, 2, 3, 4;" would
result in a == 4.
I would like to make a suggestion to add somewhat more special handling
of inline asm() statements, and make a comma appent the "cursed" "\n\t"
to each line. That wouldn't break any existing code and it would allow
one to "beautify" the inline assembly code a lot more.
-Martynas
More information about the Gcc-bugs
mailing list