Thread (4 messages) flat view 4 messages, 3 authors, 2008-06-05

Re: inline assembly

From: Scott Wood <hidden>
Date: 2008-06-05 16:52:42

On Thu, Jun 05, 2008 at 11:44:51AM +0100, David Howells wrote:
Scott Wood [off-list ref] wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help