This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GCC Optimizations




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:




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]