[Top][All Lists]

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

[avr-gcc-list] compilation results with avr-gcc 4.8.3

From: Christian Schmidt
Subject: [avr-gcc-list] compilation results with avr-gcc 4.8.3
Date: Thu, 25 Sep 2014 18:20:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

Hi everyone,

I am currently porting some assembly code to C, using avr-gcc 4.8.3 on
GNU/linux. While comparing the output I found some strangeness that
persisted regardless of -Os, -O2 or -O3 optimization settings:

avr-objdump -h -S main.elf  (abbreviated)

#include <avr/io.h>

int main (void) {
    unsigned char reg;
    do {
        reg = PIND;
  38:   80 b3           in      r24, 0x10       ; 16
    } while ((~reg) & 0x18);
  3a:   90 e0           ldi     r25, 0x00       ; 0
  3c:   80 95           com     r24
  3e:   90 95           com     r25
  40:   88 71           andi    r24, 0x18       ; 24
  42:   99 27           eor     r25, r25
  44:   89 2b           or      r24, r25
  46:   c1 f7           brne    .-16            ; 0x38 <main>

All those operations involving R25 are equivalent to NOPs? That's about
half the instructions in this small example. Are there any compiler
flags beyond general optimization levels I could set to avoid this?

Please CC: me on replies, as I am not subscribed to the list.

Best regards,

reply via email to

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