4 ms·
The Fortran doesn't look quite equivalent, and we don't know how it was run, though that's irrelevant to the analysis except perhaps for OpenMP. As usual, it's
by gnufx 5y ago
The Fortran doesn't look quite equivalent, and we don't know how it was run, though that's irrelevant to the analysis except perhaps for OpenMP. As usual, it's a single number from a benchmark without understanding it, e.g. with -fopt-info. The general conclusion about Fortran invalid.
It happens to be an example of a pathological vectorization case for GCC with an ancient issue open, sigh [1]. Much as it pains me to say so, apart from NAG's, I think, all the other compilers I know will vectorize such loops: ifort, xlf, flang, PGI, nvfortran (but the last three may be essentially the same here).
Also, last time I tried it, -floop-nest-optimize (marked "experimental") was quite broken, again with an issue open either in the gcc or redhat tracker. -O3 does unroll-and-jam, at least.
1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40770 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40770