Author: Robert Hyatt
Date: 11:20:51 05/21/04
Go up one level in this thread
On May 21, 2004 at 13:08:43, Christophe Drieu wrote:
>It's ok now, Thank you bob.
>
> a=4;b=0;
>
> __asm__ (
> "movl %0, %%eax" "\n\t"
> "incl %%eax" "\n\t"
> "movl %%eax, %1" "\n\t"
> "movl %%eax, %2" "\n\t"
> :"=g"(a)
> :"g"(b),"g"(a)
> :"ax","memory"
> );
>
> printf("a=%d b=%d\n", a, b); // a=5 b=5
>
>PS: Is there any way to let the compiler choose the register to use ?
>
>Regards
Yes. registers like %0 and so forth. You should be able to find a reference
for dynamic register names somewhere in the gcc inline guide. Download the
crafty source and look at one of the "*inline.h" files for examples...
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.