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

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

Re: [avr-gcc-list] Mega 128 not optimising correctly ...


From: Rob Ward
Subject: Re: [avr-gcc-list] Mega 128 not optimising correctly ...
Date: Tue, 12 Nov 2002 09:29:43 +1300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826

Hi Eric. I am using AVR-GCC 3.2 20020616 (experimental).

Regarding -std=gnu99 ... I am not using this switch. I have found this info on it ...

A new edition of the ISO C standard was published in 1999 as ISO/IEC 9899:1999, and is commonly known as C99. GCC has incomplete support for this standard version; seehttp://gcc.gnu.org/c99status.html for details. To select this standard, use `-std=c99' or `-std=iso9899:1999'. (While in development, drafts of this standard version were referred to asC9X.)

Regards,

Rob



E. Weddington wrote:
On 11 Nov 2002 at 10:14, Rob Ward wrote:

  
Hi Eric and others. I have used your suggestion below, but in some
cases it does not compile as you have suggested. For example...

#define SetClockHigh() (PORTD |= 0x80) // set clock line high
#define SetClockLow() (PORTD &= ~0x80) // set clock line low

 SetClockHigh(); // set clock line hi
 5e: 97 9a  sbi 0x12, 7 ; 18
 SetClockLow(); // set clock line low
 60: 82 b3  in r24, 0x12 ; 18
 62: 83 23  and r24, r19
 64: 82 bb  out 0x12, r24 ; 18

This is using -O2 or -O3 optimisation. However if I change to -Os I
get a mixture in various places...

 SetClockHigh(); // set clock line hi
 b0: 97 9a  sbi 0x12, 7 ; 18
 SetClockLow(); // set clock line low
 b2: 3f e7  ldi r19, 0x7F ; 127
 b4: 82 b3  in r24, 0x12 ; 18
 b6: 83 23  and r24, r19
 b8: 82 bb  out 0x12, r24 ; 18

and also...

 SetClockHigh(); // set clock line hi
 84: 97 9a  sbi 0x12, 7 ; 18
 SetClockLow(); // set clock line low
 86: 97 98  cbi 0x12, 7 ; 18

Is this something that could be improved or am I missing something?

TIA.

Rob
    

The version of GCC that I use is 3.2 experimental, from the latest 
AVRFreaks distribution. For compiler flags I use -Os as well as
-std=gnu99. Does yours match, what do you use?

Let me know,

Thanks.
Eric
avr-gcc-list at http://avr1.org

  




avr-gcc-list at http://avr1.org







reply via email to

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