public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Alpha and -funroll-loops
@ 1998-09-22 19:31 Oskar Enoksson
  0 siblings, 0 replies; 4+ messages in thread
From: Oskar Enoksson @ 1998-09-22 19:31 UTC (permalink / raw)
  To: egcs, Mike Stump

> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Alpha and -funroll-loops
  1998-09-21 19:37 Oskar Enoksson
@ 1998-09-23  5:00 ` Dave Love
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Love @ 1998-09-23  5:00 UTC (permalink / raw)
  To: egcs

FWIW, I've long thought that -funroll-loops ought to be the default
for g77 for some optimization level, presumably -O2.  Are there good
reasons for it not to be?  (I think it is, typically, with other
compilers, which don't normally provide a separate flag.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Alpha and -funroll-loops
@ 1998-09-22 11:27 Mike Stump
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Stump @ 1998-09-22 11:27 UTC (permalink / raw)
  To: egcs, osken393

> Date: Mon, 21 Sep 1998 16:27:59 +0200 (MET DST)
> From: Oskar Enoksson <osken393@student.liu.se>

> BTW, is it still true that -funroll-loops is unreliable for g++?
> (The info-pages say so).

This is why we should never put such things in there...  Hard to
maintain.  I think all (most) the problems and concerns with g++ have
been ironed out, Jim, any left that you know of that warrants any
disclaimer in the info files?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Alpha and -funroll-loops
@ 1998-09-21 19:37 Oskar Enoksson
  1998-09-23  5:00 ` Dave Love
  0 siblings, 1 reply; 4+ messages in thread
From: Oskar Enoksson @ 1998-09-21 19:37 UTC (permalink / raw)
  To: egcs

Hi! I was just about to write an email complaining about the efficiency
of egcs code on Alpha CPU's when I discovered that -funroll-loops is the
magic that makes it run fast:

Results from the code on a 433 MHz ev56 with no L3-cache:

Compiler                          MFLOPS
========================================
Dec> f77 -O0                           7
Dec> f77 -O1                          44
Dec> f77 -O2                          79
Dec> f77 -O3                         208
Dec> f77 -O4                         207
Dec> f77 -O5                         113

egcs1.1> g77 -O0                      12
egcs1.1> g77 -O1                      71
egcs1.1> g77 -O2                      83
egcs1.1> g77 -O3                      83
egcs1.1> g77 -O3 -funroll-loops      187

The performance with snapshot 980914 was the same for this program.

In case someone is interested, I've attached some interesting pieces
of assembler output.

BTW, is it still true that -funroll-loops is unreliable for g++?
(The info-pages say so).

Regards.
/Oskar

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-09-23  5:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-22 19:31 Alpha and -funroll-loops Oskar Enoksson
  -- strict thread matches above, loose matches on Subject: below --
1998-09-22 11:27 Mike Stump
1998-09-21 19:37 Oskar Enoksson
1998-09-23  5:00 ` Dave Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).