inline assembly

Scott Wood scottwood at freescale.com
Fri Jun 6 02:52:35 EST 2008


On Thu, Jun 05, 2008 at 11:44:51AM +0100, David Howells wrote:
> Scott Wood <scottwood at freescale.com> wrote:
> 
> > int tmp;
> > 
> > asm volatile("addi %1, %2, -1;"
> >              "andc %1, %2, %1;"
> >              "cntlzw %1, %1;"
> >              "subfic %0, %1, 31" : "=r" (j), "=&r" (tmp) : "r" (i));
> 
> Registers are usually assumed to be 'long' in size, so I'd recommend using
> that rather than 'int' for tmp, though I suspect it'll make little difference
> (except, perhaps on x86 where you can partially use registers).

I had originally written that as long, but I changed it since the asm
code is explicitly assuming 32-bit.  It's more documentation than
anything else.

-Scott



More information about the Linuxppc-dev mailing list