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

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

RE: [avr-gcc-list] Horrible code


From: Larry Barello
Subject: RE: [avr-gcc-list] Horrible code
Date: Tue, 16 May 2006 16:21:12 -0700

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: address@hidden [mailto:avr-gcc-
| address@hidden On Behalf Of James L. Evans
| Sent: Tuesday, May 16, 2006 3:47 PM
| To: address@hidden
| 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
| address@hidden
| http://lists.nongnu.org/mailman/listinfo/avr-gcc-list






reply via email to

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