[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-08-26 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128 --- Comment #6 from anlauf at gcc dot gnu.org --- Guided by the dump-tree for the inlining code, I played a little to see what kind of code the middle-end expects. To this end I used C code. The reference for the sum over a rank-1 array (given

[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-08-15 Thread mjr19 at cam dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128 --- Comment #5 from mjr19 at cam dot ac.uk --- I think in general using partial sums improves accuracy. If one assumes that all of the data have the same sign and similar magnitude, then by the time the sum is nearly complete one is adding a sin

[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-08-07 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128 --- Comment #4 from anlauf at gcc dot gnu.org --- (In reply to mjr19 from comment #3) > It seems that most of these are in-line expanded by gfortran-14.1, at least > in some cases. > > function foo(a,n) > real(kind(1d0))::a(*),foo > integer:

[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-08-06 Thread mjr19 at cam dot ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128 --- Comment #3 from mjr19 at cam dot ac.uk --- It seems that most of these are in-line expanded by gfortran-14.1, at least in some cases. function foo(a,n) real(kind(1d0))::a(*),foo integer::n foo=sum(a(1:n)) end function foo and funct

[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-08-05 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128 anlauf at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P5 --- Comment #2 from anlau

[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-07-31 Thread mjr19 at cam dot ac.uk via Gcc-bugs
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, ial

[Bug fortran/116128] missed optimisation: fortran sum instrinsic performed in order

2024-07-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116128 Andrew Pinski changed: What|Removed |Added CC||pinskia at gcc dot gnu.org Se