This is the mail archive of the gcc@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: Alpha and -funroll-loops



> 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



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