Re: clobbering of input operands in GCC



spamtrap@xxxxxxxxxx wrote:

A problem is that A and B could be in the same register.


How is this possible??

int inc( int A )
{
int B;
asm volatile (
"incl %1 \n\t"
"addl %1, %0 \n\t"
: "=r" ( B )
: "r" ( A )
);
return B;
}

$ gcc -Wall -O2 -S inc.c -fomit-frame-pointer -mregparm=3 -m32


inc:
#APP
incl %eax
addl %eax, %eax
#NO_APP
ret

.



Relevant Pages