This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unroll fixes
- To: Zoltan Hidvegi <hzoli at hzoli dot 2y dot net>
- Subject: Re: Loop unroll fixes
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 23 Oct 2001 21:27:45 -0700
- cc: "wilson at cygnus dot com" <wilson at cygnus dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "bernds at redhat dot com" <bernds at redhat dot com>, "Franz dot Sirl-kernel at lauterbach dot com" <Franz dot Sirl-kernel at lauterbach dot com>
> The code can be simplifies, since in all cases, the number of iterations
> can be calculated by
>
> abs (final - initial + abs_inc - 1) / abs_inc / unroll_number
Yes.
> terminate (note that != loops with abs_inc > 1 do not reach here). In
> this case the loop count calculated by the above formula will be 0, that
> is effectively 2^word_size, so the loops will not really be infinite, but
> it will run the maximum number of iterations possible using a count
> register loop.
In this case, shouldn't we decide not to use a count register loop,
and just fall back to an ordinary loop? It's wrong to turn an infinite
loop into a finite one, which is what it seems like your patch would
do.
Thanks,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com