question on inline assembly and long long values

Chris Friesen cfriesen at nortel.com
Thu Apr 7 07:37:33 EST 2005


Gabriel Paubert wrote:
> On Wed, Apr 06, 2005 at 02:01:20PM -0600, Chris Friesen wrote:

>>static inline unsigned long long getmsr()
>>{
>>	unsigned long long val;
>>        asm volatile( \
>>                "mfmsr  %L0               \n\t" \
>>                "rldicl %0,%L0,32,32       \n\t" \
>>                "rldicl %L0,%L0,0,32        \n\t" \
>>                : "=r" (val));
>>	return val;
>>}

> If you are running in 32 bit mode, you don't need
> to clear the upper half of %L0.

Thanks for the tip.  That cuts out another instruction.

Chris



More information about the Linuxppc-dev mailing list