g77 performance for real*complex

Tim Prince tprince@computer.org
Thu Aug 3 07:07:00 GMT 2000


I think this is the expectation with most compilers, that promotion to complex occurs before multiplication.  You have the option to
write it out the more efficient way in source.  Certainly, the optimization you suggest could be valuable, but g77 doesn't have the
resources available to incorporate such features, and it is never sold by benchmarking.

Tim Prince
----- Original Message -----
From: "June-Yub Lee" <jylee@math.ewha.ac.kr>
To: <gcc-bugs@gcc.gnu.org>
Sent: Thursday, August 03, 2000 6:37 AM
Subject: 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



More information about the Gcc-bugs mailing list