Alpha and -funroll-loops

Oskar Enoksson osken393@student.liu.se
Tue Sep 22 19:31:00 GMT 1998


> Also, I searched invoke.texi, and didn't find the mention, can you
> quote a portion of it for me?

In info/gcc-info-12 of snapshot 980914:

   * Loop unrolling doesn't work properly for certain C++ programs.
     This is a bug in the C++ front end.  It sometimes emits incorrect
     debug info, and the loop unrolling code is unable to recover from
     this error.

I tried some c-code and noticed that loops of known lengths are not 
detected by gcc on Alpha and therefore -funroll-loops has no effect. Is
this the bug? For example, the following code is not unrolled with
-funroll-loops:

/* gcc -O3 -funroll-loops -S unroll_me.c */

main() {
  float a[50][50][50];
  int i,j,k;

  for(k=0; k<50; k++)
    for(j=0; j<50; j++)
      for(i=0; i<50; i++)
        a[k][j][i]=2*a[k][j][i]-.5*a[k][j][i]*a[k][j][i]*a[k][j][i];
}

With -funroll-all-loops the code is unrolled, but the test i<50 is 
also unrolled (not as with g77 which would unroll the above in five
instances, only testing after every fifth operation). This unrolling does
not improve speed at all on my Alpha.

The resulting executable is 3 times slower than corresponding g77-code
on my Alpha 433, (no L3 cache) because g77 -funroll-loops works fine on
the Alpha.

All this is true for both egcs 1.1 and snapshot 980914.

I think gcc unrolled the above code correctly on my Pentium with
-funroll-loops (can't check it right now though).

Regards.
/Oskar




More information about the Gcc mailing list