gcc inline asm optimizing problem ?

wu_yb (wu_yb@263.net)
Thu, 02 Dec 1999 14:43:42 +0800


in asm1.c

int i = 1 ;
__asm__ volatile ( "
movl %0, %%eax\n
addl $1, %%eax\n
movl %%eax, %0\n"
: :"g"(i) : "eax"
) ;

gcc -O -S asm1.c.
output asm code:
...
#APP
movl $1, %eax
addl $1, %eax
movl %eax, $1
#NO_APP
...

Neigher the asm1.c or asm1.s can't assembled to a executable file.
But it can compiled by "gcc asm1.c"

How does the gcc optimize programe with "g"(i) ?????

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/