Compiling with optimization

Jens-Christian Lache lache@tu-harburg.de
Mon Dec 4 07:04:00 GMT 2000


Hi! I still have problems with the compiler-switches.

I have written a program, which should measure how many clock-ticks
a multiply&acc. (mla) operation takes on my arm7tdmi-cpu. If I do not
use -O2, I get a big measure-overhead and three clock-ticks
for a "mla", which is the correct value. If I use optimization, I get a
small overhead, but an average of 4.5 clock-ticks:

without -O2
Breakpoint 2, main () at multiplikation.mla.mess0bis32.c:75
# mla and Timer-Ticks:   0        15
# mla and Timer-Ticks:   1        17
# mla and Timer-Ticks:   4        27
# mla and Timer-Ticks:   8        38
# mla and Timer-Ticks:  16        66
# mla and Timer-Ticks:  32        110
summe: 6

with -O2
Breakpoint 2, main () at multiplikation.mla.mess0bis32.c:77
# mla and Timer-Ticks:   0        2
# mla and Timer-Ticks:   1        6
# mla and Timer-Ticks:   4        20
# mla and Timer-Ticks:   8        38
# mla and Timer-Ticks:  16        78
# mla and Timer-Ticks:  32        146
summe: 6

I compile with:
arm-elf-gcc -mapcs-32 -mapcs-frame -mcpu=arm7tdmi -DAT91M40400 -DDEBUG\
 -I/home/hiwi/lache/c/Include   -O2 -o multiplikation.mla.mess0bis32.arm\
 -Wl,-T/home/hiwi/lache/c/linker/linker.script.sc \
 multiplikation.mla.mess0bis32.c 

arm-elf-gcc -mapcs-32 -mapcs-frame -mcpu=arm7tdmi -DAT91M40400\
 -DDEBUG -I/home/hiwi/lache/c/Include -S  -O2
multiplikation.mla.mess0bis32.c

The funny thing is, that the assembler looks allright...
What can that be?

Jens-Christian


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list