[Bug middle-end/41969] New: [LTO] 23% slow-down with -flto -fwhole-program
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Nov 6 13:27:00 GMT 2009
The following test case takes
9.100s with gfortran -O3
11.113s with gfortran -flto -fwhole-program -O3
9.582s with ifort -O3
5.205s with gfortran -ffast-math -march=native -funroll-loops -O3
7.414s with gfortran -ffast-math -march=native -funroll-loops -flto
-fwhole-program -O3
9.624s with ifort -xHost -O3
on an AMD Athlon(tm) 64 X2 Dual Core Processor 4800+
running openSUSE 11.2 RC 1 (x86_64).
Thus the LTO version takes 23% more - with unrolled loops/fast math and
-march=native, the LTO version is even 42% slower.
Without the "print" statement, the "ifort" version only takes 0.002s which
means that it optimizes the complete loop away - GCC does not (why?).
Otherwise, gfortran wins the race by 5% to 46%.
module vector_ops
contains
FUNCTION vector_function(v1,v2) RESULT(v3)
IMPLICIT NONE
INTEGER, PARAMETER :: ndim = 100
REAL*8, DIMENSION(ndim), INTENT(IN) :: v1, v2
REAL*8, DIMENSION(ndim) :: v3
INTEGER :: i
DO i = 1, ndim
v3(i) = 0.5D0 * v1(i) + 0.5D0 * v2(i)
END DO
END FUNCTION vector_function
end module vector_ops
PROGRAM vectorsyntax
USE vector_ops
IMPLICIT NONE
INTEGER, PARAMETER :: ndim = 100
REAL*8, DIMENSION(ndim) :: u, v, w
INTEGER :: i, iter
DO i = 1, ndim
CALL random_number( u(i) )
CALL random_number( v(i) )
END DO
iter = 50000000
DO i = 1, iter
w = vector_function( u, v )
END DO
print *, w(1),w(50),w(100)
END PROGRAM
--
Summary: [LTO] 23% slow-down with -flto -fwhole-program
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: lto
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41969
More information about the Gcc-bugs
mailing list