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

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

Re: [avr-gcc-list] compiler improvments


From: HutchinsonAndy
Subject: Re: [avr-gcc-list] compiler improvments
Date: Fri, 09 Jan 2004 01:14:28 -0500

I got it down to 60. 

Try -fnew-ra (it might bomb if sign/zero extended are used)

I will look a bit further to see if I can tweak something.

I have been using Butterfly code as a trial. Does anybody have a code size for 
this using standard AVR and Mega 169? I had to drop Winavr to be able to try 
changes to GCC-AVR.





"Dmitry K." <address@hidden> wrote:

>HutchinsonAndy wrote:
>
>> I am looking at improving the code that winavr(GCC-avr) produces.
>> So far I have identified several areas where the current gcc machine model
>> is less that perfect. In most cases I have working code that addresses the
>> issue (not heavily tested though!)
>>
>> What I need is a peice of code to act as test/benchmark to see what saving
>> are realisable. Currently I think that I am hitting around 15% mark but the
>> code I have to test is not really enough.
>>
>> Any suggestions?
>>
>
>Not real, but very funny example:
>
>Program:
>
>   typedef struct { long lo; int in; } lo_in;
>   lo_in foo (void)
>   {
>       lo_in x;
>       x.lo = 1;
>       x.in = 2;
>       return x;
>   }
>
>Compiler:
>   avr-gcc (GCC) 3.3.2
>
>Diverses optimization levels (size in words) produce:
>
>   -O0:     code   75 = 0x004b (  40), prologues  18, epilogues  17  (best !)
>   -O1/2/s: code   80 = 0x0050 (  29), prologues  26, epilogues  25
>   -O3:     code   79 = 0x004f (  28), prologues  26, epilogues  25
>   Clocks for "-O3" (see foo-3.s.clocks):  132.
>
>Manualy:
>   foo:
>        ldi     r18,lo8(1)      ; 1 clock
>        ldi     r19,hi8(1)      ; 1
>        ldi     r20,hlo8(1)     ; 1
>        ldi     r21,hhi8(1)     ; 1
>        ldi     r22,lo8(2)      ; 1
>        ldi     r23,hi8(2)      ; 1
>        ret                     ; 4
>   /* code size: 7, clocks: 10   */
>
>Sources and compiler results in attachment.
>

__________________________________________________________________
Thank you for using Netscape.


reply via email to

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