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

Re: [MiNT] Re: GCC



Johan Klockars wrote:
> 
 L14:
>         addl d3,a1@(d0:l)       ; 3 instructions with the second compiler
>         addql #4,d0             ;  but then this isn't needed instead
>         addql #1,d1
>         moveq #24,d5
>         cmpl d1,d5
>         jge L14
> 
> So at least one version of GCC realizes that only two instructions are
> needed to do the actual work (I'm not sure, though, if the sequence above
> would actually be faster on all/any of the processors).
> The '24' is still loaded in every iteration of the loop for some reason.
> I don't know why the compilers don't realize that neither d1 nor d5 are
> used in the loop. The strength reduction should tell it that it can
> remove them completely or use for example a dbra.
> 

Speed and size!
moveq is only 2 bytes and very fast.

You could turnaround the jge and save 1 instr
cmpl #24,d1
jlt L14
But his is slower and bigger
#24 is a 32 bit long immediate following the 2 byte instr.

And because of plenty free regs the compiler could do this
The compiler didnt overlook d5, no it deliberately allocated d5
gcc maybe be better than you think. :-)

Henk