This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34568] Inplace algorithm too slow when using array notation
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Subject: [Bug fortran/34568] Inplace algorithm too slow when using array notation
- References: <bug-34568-15061@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pault at gcc dot gnu dot org 2008-01-02 16:15 -------
(In reply to comment #1)
Note that for last night's trunk, I get the following times
[prt@localhost tmp]# /irun/bin/gfortran -static pr34568.f90
[prt@localhost tmp]# ./a.out
2.1826680
8.2267494
[prt@localhost tmp]# /irun/bin/gfortran -static -O3 pr34568.f90
[prt@localhost tmp]# ./a.out
0.39394000
0.83487302
I did check that the scalarizer gives the correct result using:
PROGRAM INPLACE
IMPLICIT NONE
INTEGER, PARAMETER :: N = 8
INTEGER, PARAMETER :: M = 1
INTEGER :: I, J
REAL :: ARR(N), ARR0(N) = (/1.,2.,3.,4.,5.,6.,7.,8./)
REAL :: T0, T1, T2
CALL CPU_TIME(T0)
arr = arr0
DO I = 1, M
ARR = ARR(N:1:-1)
END DO
print *, arr
CALL CPU_TIME(T1)
arr = arr0
DO I = 1, M
DO J = 1, N/2
ARR((/J,N-J+1/)) = ARR((/N-J+1,J/))
END DO
END DO
print *, arr
CALL CPU_TIME(T2)
PRINT *, T1 - T0
PRINT *, T2 - T1
END PROGRAM INPLACE
Note the error in your explicit case.
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34568