[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order
mjr19 at cam dot ac.uk
gcc-bugzilla@gcc.gnu.org
Wed Jul 31 11:24:00 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128
--- Comment #1 from mjr19 at cam dot ac.uk ---
The same comment applies to maxval and minval, which vectorise with -Ofast only
for -mavx2, although the answer will be independent of the ordering of the
scalar min/max operations.
In contrast, iall and iany do vectorise at -O3.
For the sum and dot_product, one might well argue that, for most data,
re-ordering to split the sum into partial sums, which gfortran does on -Ofast
only, not -O3, will produce a more accurate result than doing the sum in-order,
as well as being much faster.
More information about the Gcc-bugs
mailing list