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

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

Re: [avr-gcc-list] Weird optimization issue with avr-gcc 4.5.3, re "nake


From: William \"Chops\" Westfield
Subject: Re: [avr-gcc-list] Weird optimization issue with avr-gcc 4.5.3, re "naked."
Date: Thu, 26 Jan 2012 16:40:45 -0800

On Jan 26, 2012, at 2:10 PM, Georg-Johann Lay wrote:

> I tested the code with avr-gcc 4.5 and command line options -Os -mmcu=atmega8
> 
> With the attributes, the object size is 54 bytes.
> Without the attributes the object size is 64 bytes.

4.5.3 ?  Whatever this issue is, it apparently snuck in between 4.5.2 and 4.5.3.
(reports are that 4.5.2 produced smaller code than 4.3.2)

Sorry for forgetting the commandline/etc in my report.  I am using -Os, and 
compiling for m328p

I get:

address@hidden avr-gcc  -ggdb -Os -c -mmcu=atmega328p -mshort-calls foo.c
address@hidden avr-size foo.o
   text    data     bss     dec     hex filename
     64       0       0      64      40 foo.o

address@hidden avr-gcc  -ggdb -Os -c -mmcu=atmega328p -mshort-calls -DNAKED 
foo.c
address@hidden avr-size foo.o
   text    data     bss     dec     hex filename
     58       0       0      58      3a foo.o

and more substantial diffs, including the following.  "naked" deletes the 
prolog, but adds instructions in the body...

-.LM7:
+.LSM6:
        ldi r24,lo8(5)
-       rjmp .L8
+       rcall putch
+       rjmp .L4
 .L3:
-.LM8:
+.LSM7:
        cpi r24,lo8(-127)
        brne .L5
-.LM9:
+.LSM8:
        ldi r24,lo8(4)
-       rjmp .L8
+       rcall putch
+       rjmp .L4
 .L5:
-.LM10:
+.LSM9:
        ldi r24,lo8(3)

Attachment: foo.c
Description: Binary data


reply via email to

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