Re-run of loop pass

Michael Hayes m.hayes@elec.canterbury.ac.nz
Fri Oct 23 17:45:00 GMT 1998


Toon Moene writes:

 > I think we're talking at cross purposes - the above code doesn't  
 > have a constant iteration count.  The iteration count is N / 4 iff N  
 > % 4 == 0 (in fact, the code as shown assumes this).  The code was  
 > just meant to show why we're running loop unrolling *after* the  
 > second pass through loop opt ...

Oops, it's 15+ years since I used to program in Fortran.  I assumed N
was a constant.

 > If -funroll-loops nevertheless generates worse code, than that's  
 > due to something I haven't foreseen.

It only generates poorer code for loops with a constant iteration
count on machines with autoincrement addressing when using loop
unrolling or BCT optimisations.  The same problem is exhibited on a
single loop pass for examples such as

void fcopy1(float *a, float *b)
{
  float *c;
    
  for (c = a; c < a + 4; )
    *c++ = *b++;
}

Michael.





More information about the Gcc mailing list