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

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

Re: [avr-gcc-list] Optimiser bloats code


From: Dave Hylands
Subject: Re: [avr-gcc-list] Optimiser bloats code
Date: Tue, 31 Jul 2007 20:57:59 -0700

Hi Wouter,

> I also noted that on all functions r25 is cleared, but the value is returned
> in r24, right? I am returning an 8 bit value, not a 16 bit? What's going on?

Return values are promoted to an int.

You probably already know this, but you could also do:

return PINB >> 5;

which returns the same answer using the following:

        in r24,54-0x20
        swap r24
        lsr r24
        andi r24,0x7
        clr r25
        ret

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/




reply via email to

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