This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc optimization improvement?
- To: Ralph Doncaster <ralph at laratech dot ca>
- Subject: Re: gcc optimization improvement?
- From: Jamie Lokier <jamie dot lokier at cern dot ch>
- Date: Fri, 28 Jan 2000 13:46:01 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <3890B5CA.3D65C815@laratech.ca>
Ralph Doncaster wrote:
> And I was thinking that the listed source is still not optimal.
>
> incl %edx # Increment i
> cmpl %ecx,%edx # Test i < j
> jl .L5 # Loop if i < j
>
> if j is assigned to i (edx) before the loop, then couldn't the above be
> reduced to a decrement and branch if not zero? (my old x86 assembly
> book is not handy, but I'm pretty sure there is a jne or something like
> that)
And if you need to _use_ i in the loop, as an address index, you can
sometimes assign -j to i, using a more complicated addressing mode
involving j and i together, and the loop test is increment and branch if
not zero.
enjoy,
-- Jamie