egcs 1.0.1 and fortran optimization
Toon Moene
toon@moene.indiv.nluug.nl
Tue Jan 20 14:54:00 GMT 1998
> I successfully built and installed egcs-1.0.1 on Linux
> RedHat-5.0 system in the fully standard config. Then I
> compiled my simulation programs: one in fortran, other
> in c++ and compared execution times to variants compiled
> with g++/g77 2.7.2.3.f.1. Compilation options were '-O3
> -m486 -fomit-frame-pointer -ffast-math' for gcc and '-O9
> -mpentiumpro -fomit-frame-pointer -ffast-math' for egcc
> in both cases (I have PentiumII). egcs compiler produces
> correct code, as for execution time I obtained: C++
> program run 42% faster when compiled with egcs (GREAT!
> thanks!), but fortran program run 20% _slower_.
Is most of the data in the Fortran program declared DOUBLE PRECISION ?
The basic problem with the Pentium, Pentium Pro and Pentium II is
that you have to be *absolutely* sure that all DOUBLE PRECISION data
is aligned on 8-byte boundaries for performance, period. In egcs
(and gcc-2.[78].x) this is partly accomplished using the (ix86
specific) option -malign-double. Without this option, it's
anybody's guess whether you get *any* performance out of your code
(I've seen differences of a factor 3 on PPro's). If most of your
data is scalar variables or arrays with less than 4000 elements,
-fno-automatic might also help.
Another thing that might be hampering your code is the fact that
strength reduction is much more voracious of registers for array
elements than it was in gcc-2.7.2.3.f.1, which - given the dearth of
integer registers on a ix86 - is a bad sign. Efforts are under way
to remedy this.
HTH,
Toon.
More information about the Gcc
mailing list