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

Reply via email to