GCC Optimizations

Matt Minnis mminnis@prefres.com
Tue Oct 10 11:32:00 GMT 2000


I have some 68K code for the Coldfire (68K Compatable) and it is needing 
further optimizations.)
Where should I look for the 68K optimizations?
The example is below.

Thanks,
Matt Minnis


I use -O4, but have also tried -O2 etc..

This is the C-code that annoys me:
{
register unsigned long *b = (unsigned long *)buffer;
register int c = 256/4;
do
*b++ = 0;
while(--c);
}


.. and this is the code generated with -O4 (and -O2):
move.l buffer,%a0
move.l #256,%d0
.L28:
clr.l (%a0)
addq.l #4,%a0
.L30:
subq.l #1,%d0
tst.l %d0
jbne .L31
jbra .L29
.L31:
jbra .L28
.L29:


.. and this is what I want it to be:
move.l buffer,%a0
move.l #256,%d0
.L28:
clr.l (%a0)+
subq.l #1,%d0
jbne .L28
.L29:





More information about the Gcc mailing list