[cfg-branch] unroll-new cleanups

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Mon Apr 29 05:57:00 GMT 2002


Hello.

> Can you please check the patch?  I've removed some code handling overflows
> on niter in hope it is no longer needed as we always fit to unsigned type.

I don't think it is correct.

> !   if (niter < 0)
> !     {
> !       if (desc->cond == NE)
> ! 	{
> ! 	  int i;
> ! 	  /* We must count with overflow.  */
> ! 	  for (i = 1; 2 * i <= max_unroll + 1; i *= 2);
> ! 	  max_unroll = i - 1;
> ! 	  niter = niter % i + 256;
> ! 	}
> !       else
> ! 	abort ();  /* Should not get here.  */
> !     }
> ! 
> !   if (niter <= max_unroll)
>       abort ();  /* Should get into peeling instead.  */

To be able to handle overflow, we must at least ensure that number of unrolling
is a power of 2.

> -   if (exact && niter < 0)
> -     {
> -       /* Negative number of iterations; it may be overflow.  */
> -       if (desc.cond == NE)
> - 	/* It is hard to say what the number of iterations will be;
> - 	   but we may expect it to be high.  */
> - 	niter = 2 * nunroll;
> -       else
> - 	niter = 0;
> -       }

And we really want to be able to distinguish these two cases (if you test for
!= and # of iterations is negative, it will overflow and roll much. If you test
for <, then it won't roll at all).

Zdenek



More information about the Gcc-patches mailing list