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

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

[avr-gcc-list] Saving useless instructions in floating point functions


From: Pascal Brisset
Subject: [avr-gcc-list] Saving useless instructions in floating point functions calls
Date: Mon, 28 Jul 2003 13:45:22 +0200

Hi,

compiling the following toy example:

-8<------toto.c-------------------
#include <inttypes.h>
float x;
int main( void ) { return (x+1); }
-8<-------------------------------

using the following compilation command

        avr-gcc -mmcu=atmega8 -S -O4 -Wall -Wstrict-prototypes  toto.c

I get assembler code where a lot of instructions are useless. Moves between
registers (used to store floating point arguments and results of floating
point routines) unfortunately appear:

[...]
        rcall __addsf3
        movw r26,r24
        movw r24,r22
        movw r22,r24
        movw r24,r26
        rcall __fixsfsi
[...]

Do I miss the compiler option which would be able to remove this useless code ?

--Pascal

PS: I'm using the unstable Debian package:

sepia[182]% avr-gcc -v
Reading specs from /usr/lib/gcc-lib/avr/3.3/specs
Configured with: ./configure -v --enable-languages=c,c++ --prefix=/usr 
--infodir=/usr/share/info --mandir=/usr/share/man --enable-shared --with-gnu-as 
--with-gnu-ld --with-system-zlib --enable-long-long --enable-nls 
--without-included-gettext --disable-checking --build=i386-linux 
--host=i386-linux --target=avr
Thread model: single
gcc version 3.3 20030512 (prerelease)


reply via email to

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