GNU Fortran

Jeffrey A Law
Thu Jan 21 19:22:00 GMT 1999

  In message < >you 
  > IRIX 5.3 (100 mhz IP20 processor)
  >    Everything compiled fine, apprears to run ok, but execution time
  >    is horrid. At least 2 time longer than SG f77.
  > SOLARIS 2.5.1 (Ultra-1)
  >    Everything compiles fine, generates correct answers, and is almost
  >    as good as SUN's F77. For many problems, G77 is faster, but when
  >    doing heavy duty math G77 is horrible. Seems to be the math library
  >    (sqrt, sin, cos, log, exp). The reason for this conclusion is that
  >    G77 can factor a stiffness matrix faster than f77, but when I do
  >    something which computes wave velocities and accelerations,
  >    g77 takes about 5 times longer!
Typically when you see 2X or 5X slowness there's some simple problem that
needs to be addressed that's killing performance.  Finding that problem
can take significant time, but the net benefits can be huge for the ste
of programs that are effected.

Cases in point:

  Back in 1990 we had certain benchmarks that were running 2X slower with gcc
  than with Sun's compilers.  The core problem -- Sun's compiler used the
  hardware sqrt instructions, gcc emitted calls to the math library.  So I
  wrote code to allow gcc to emit sqrt instructions.  Net result was we became
  very competitive with Sun's compilers for the entire benchmark suite I was
  working with.

  More recently I was looking at PA8000 performance problems with single
  precision floating point.  After pounding my head on the wall for many
  hours I finally found the source of the problem -- false data dependencies
  generated by the use of both halves of a 64bit floating point register
  to represent independent 32bit floating point values.  Tweaking the
  register allocator to avoid that problem gave a *typical* speedup of nearly
  2X for benchmarks that were primarily single precision FP ops.

My recommendation is, if you care about the performance of these codes on the
sparc or mips processors, analyze the resulting programs to find out what
"really stupid" thing gcc/g77 is doing which is having such a terrible 
impact on performance.   If you can isolate the problem and report back, there
may be something we can do to help.

  >    By the way, I know I should not ask, but if you have the time -
  > what is the difference between egcs and the gcc I downloaded. I have
  > looked for a distribution of egcs and could not find it.
Hard to explain in any short answer.  At least in your case it provides a
single distribution which will include compilers for C, C++, Fortran, ObjC
(and in the future Java & Chill).  Or you can pick & choose if you just want
C & Fortran (C is a requirement).


More information about the Gcc-bugs mailing list