3.4.5 winavr produces nice tidy code.  Even the compares with 0 reduce to
tight sbic/jmp pairs.


-----------
Larry Barello
www.barello.net


| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:avr-gcc-
| [EMAIL PROTECTED] On Behalf Of James L. Evans
| Sent: Tuesday, May 16, 2006 3:47 PM
| To: avr-gcc-list@nongnu.org
| Subject: [avr-gcc-list] Horrible code
| 
| Could someone with a 4.1 version of the AVR-GCC compiler please compile
| the following code (-Os) and see if it generates better code than the
| horrible code (25 instructions) generated for Case 2 by version 3.4.3?
| 
| Thanks,
| 
| Jim Evans
| 
| 
| #include <inttypes.h>
| #include <avr/io.h>
| 
| void test7(void) {
|     while (PINA & 0x40) PORTA = 0;                  // Case 1
| 
|     while ((PINA & 0x40) == 0) PORTA = 0;           // Case 2
| 
|     while (!(PINA & 0x40)) PORTA = 0;               // Case 3
| 
|     uint8_t b;
|     while ((b = (PINA & 0x40)) == 0) PORTA = 0;     // Case 4
| }
| 
| 
| _______________________________________________
| AVR-GCC-list mailing list
| AVR-GCC-list@nongnu.org
| http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to