avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How to get the GCC to use the swap instruction?


From: Christian Ludlam
Subject: Re: [avr-gcc-list] How to get the GCC to use the swap instruction?
Date: Wed, 30 Oct 2002 10:38:24 +0000
User-agent: POPstar/2.02

On 30 Oct Marek Michalkiewicz wrote:

> When rotlqi3 is implemented, simple ((a << 4) | (a >> 4)) would be
> equivalent.  Rotation in general (even by unknown number of bits) could be
> optimized as well, by making use of the carry flag - like this (for rotate
> left by 1, repeat in a loop as needed):
> 
>       lsl %0
>       adc %0,__zero_reg__     ; set bit 0 to C flag

Or even 

        adc %0,%0 
        
This is how AVR assemblers assemble the ROL instruction (and LSL by 
add %0,%0); the AVR core provides ROR and LSR itself.

-- 
Christian Ludlam
address@hidden
avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]