Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/b232bca9766094cc
which contains several tests:
- NR : Normal Routines
- ER : Elemental Routines
- NF : Normal Functions (scalar operators)
- EF : Elemental functions (vector operators)
- SC : Scalar Computation
The interesting point is if one compares NF/NR or NF/ER.
Using ifort 11.1 with -O3 -xHost the result is 1.16 or 1.03.
Using gfortran 4.5 with -O3 -march=native the result is 1.31 or 1.41
using -funroll-loops -O3 -march=native 1.49 or 1.59
using -fwhole-file -O3 -march=native 1.33 or 1.42
(latest draft patch posted to fortran@)
Expected: The NF version is faster.
In total, the result does not look bad for gfortran, however (AMD64):
gfortran -O3 -march=native -funroll-loops var_dep.f90 test.f90
NR 2.0121260 2.1001320 1.9041190
ER 1.8761170 1.9561219 1.8081129
NF 3.1001940 3.2042003 3.0761924
EF 2.6561656 2.6641660 2.6561661
SC 2.00023651E-02 2.00023651E-02 1.60007477E-02
ifort -O3 -xHost var_dep.f90 test.f90
NR 2.396150 2.364148 2.324145
ER 2.224138 2.164135 2.172136
NF 2.768173 2.720170 2.736171
EF 2.592162 2.552160 2.560160
SC 1.6001701E-02 2.0000458E-02 1.6000748E-02
--
Summary: Missed optimization in scalar operators on arrays
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
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=40581