This is the mail archive of the gcc-bugs@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]

g77 performance for real*complex


Hello.
I really thank the developers of GNU fortran complier for their efferts.

I usually perfer to use g77 instead of the genuin Fortran compiler
from the SUN microsystem for my Ultra-Sparc 450MHz machine.
I try to optimize my code to get best FLOPS in my codes
and the g77 generates faster codes in many cases.
One day, I found that my code was runing about 40% slower
than my expectaion so I tried to look at the assembly code.

Maybe you alreay know that the problem of real*complex but
let me present a simplest example:
> cat t.f
        real*8 x
        complex*16 z1, z2
        x = 1.1d0
        z1 = (2.2d0, 3.3d0)
        z2 = x*z1
        end

The program needs only TWO double precision multiplication (fmuld):
x*dble(z1) for the real part, x*dimag(z1) for the imaginary part.
However, the g77 (2.95.1) generates 2*fmuld & fsubd for the real part
and 2*fmuld & faddd for the imaginary part. And it comsumes 6 flops
for real*complex even under -O2 optimization mode.

Here goes my complier version and I think I don't need to send you
my assembly code since it is easily reproducible. Would you tell me the
currect status of the compile regarding complex arithmetic performance?

> g77 -v -S t.f
g77 version 2.95.1 19990816 (release) (from FSF-g77 version 0.5.25 19990816 (release))
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/f771 t.f -quiet -dumpbase t.f -version -fversion -o t.s
GNU F77 version 2.95.1 19990816 (release) (sparc-sun-solaris2.7) compiled by GNU C version 2.8.1.
GNU Fortran Front End version 0.5.25 19990816 (release)


Thank you very much.
Sincerely yours,
   June-Yub Lee

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