This is the mail archive of the gcc-patches@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]

Re: Loop unroll fixes


> 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


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