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 on Linux Alpha



I am using the following vrsion of gcc and g77 on Linux on an Alpha

Reading specs from /usr/lib/gcc-lib/alpha-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

and have found what I believe may be a problem. During my port, I was
comparing things with the same program using Linux on Intel and found
that while the Alpha was "normally" faster, doing some things it really
fell behind. After looking further, I found  that g77 and Alpha really
disliked doing complex arithmetic.

After profiling, etc I found that if I recoded two routines 
a complex vector add and a complex dot product as follows:

OLD CODING
==========

      subroutine addv_ccc(b,s,n,   a)
c
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c
c      ------------------     addv_ddd     --------------------
c                                             Copyright Ultramarine,inc.
c                                             August 1997
c                                             All Rights Reserved
c
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c
c
c*********************************************      no implicit
c
      implicit none
c
c*********************************************      local variables
c
      integer n,i
      complex a(*),b(*),s
c
c*********************************************      ADD
c
      if(abs(real(s))+abs(aimag(2)).eq.0.) go to 9000
      do 2100 i = 1, n
      a(i) = a(i) + b(i)*s
 2100 continue
c
c*********************************************      all done
c
 9000 return
c
      end

NEW CODING
==========

      subroutine addv_ccc(b,s,n,   a)
c
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c
c      ------------------     addv_ddd     --------------------
c                                             Copyright Ultramarine,inc.
c                                             August 1997
c                                             All Rights Reserved
c
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c
c
c*********************************************      no implicit
c
      implicit none
c
c*********************************************      local variables
c
      INTEGER n,i
      REAL eps
      parameter (eps = 1e-20)
      REAL a(2,*),b(2,*),s(2)
c
c*********************************************      ADD
c
      if(abs(s(1)).lt.eps) then
         if(abs(s(2)).lt.eps) go to 9000
      endif
      do 2100 i = 1, n
      a(1,i) = a(1,i) + b(1,i)*s(1) - b(2,i)*s(2)
      a(2,i) = a(2,i) + b(1,i)*s(2) + b(2,i)*s(1)
 2100 continue
c
c*********************************************      all done
c
 9000 return
c
      end


the time spent in these two routines reduced by around AN
ORDER OF MAGNITUDE! How in the world can this happen? This
is farily serious since there are still lots of places where
I use complex arithemetic and do not wish to recode it.

Thanks,

Ray
a complex 



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