Better performance on older version of GCC

Angelo Graziosi angelo.graziosi@alice.it
Sun Aug 29 13:04:00 GMT 2010


Andrew Pinski wrote:
> The first one
> is that due to -fexcess-precision=standard being default in 4.5 and
> above (see PR 323).

Is this valid also for Fortran?

$ cat test_case.f90
program test_case
   implicit none
   integer :: k
   integer, parameter :: DP = kind(1.D0),&
        N = 29
   real(DP), parameter :: A(0:N) = &
        (/1.0000000000000D0,3.8860009363293D0,7.4167881843083D0,&
          9.8599837415463D0,10.431383465276D0,9.4077161304727D0,&
          7.5332956276775D0,5.4995844630326D0,3.7275104474917D0,&
          2.3766149078263D0,1.4394444941337D0,0.8344437543616D0,&
          0.4657058294147D0,0.2514185849207D0,0.1317920740387D0,&
          0.0672995854816D0,0.0335554996094D0,0.0163785206816D0,&
          0.0078368645385D0,0.0036846299276D0,0.0017020281304D0,&
          0.0007756352209D0,0.0003469750783D0,0.0001544224626D0,&
          0.0000666379875D0,0.0000295655909D0,0.0000118821415D0,&
          0.0000057747681D0,0.0000017502652D0,0.0000014682034D0/)
   real(DP), parameter :: BB(0:N-1) = &
        (/(((k+2)*A(k+2)-A(k+1)*(A(1)+(k+1))),k = 0,N-2),&
          (-A(N)*(A(1)+N))/)
   real(DP) :: b(0:N-1),bbb(0:N-1)
   do k = 0,N-2
      b(k) = (k+2)*A(k+2)-A(k+1)*(A(1)+(k+1))
   enddo
   b(N-1) = -A(N)*(A(1)+N)
   bbb(0:N-1) = (/(((k+2)*A(k+2)-A(k+1)*(A(1)+(k+1))),k = 0,N-2),&
        (-A(N)*(A(1)+N))/)
   do k = 0,N-1
      print *, k,b(k)-BB(k),b(k)-bbb(k),BB(k)-bbb(k)
   enddo
end program test_case

$ gfortran-4.6 -fexcess-precision=standard test_case.f90  -o test_case
f951: sorry, unimplemented: -fexcess-precision=standard for Fortran

in which

$ gfortran-4.6 -v
Using built-in specs.
COLLECT_GCC=gfortran-4.6
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/i686-pc-cygwin/4.6.0/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /tmp/gcc-4.6-20100828/configure 
--prefix=/usr/local/gfortran --program-suffix=-4.6 
--enable-languages=c,c++,fortran --enable-checking=release 
--enable-threads=posix --enable-libgomp --disable-bootstrap 
--disable-libmudflap --disable-shared
Thread model: posix
gcc version 4.6.0 20100828 (experimental) (GCC)

I still need this for the above test

$ gfortran-4.6 test_case.f90 -march=athlon64 -msse -mfpmath=sse -o test_case

Ciao,
Angelo.



More information about the Fortran mailing list