compilation results with avr-gcc 4.8.3
Christian Schmidt <[email protected]>
| Newsgroups | gmane.comp.hardware.avr.gcc |
|---|---|
| Message-ID | <[email protected]> |
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,
Christian