https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128946
Hongtao Liu <liuhongt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuhongt at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2026-11-23
Status|UNCONFIRMED |NEW
--- Comment #3 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
_2 + _4 1 times vector_stmt costs 12 in body
_2 + _4 1 times vec_perm costs 4 in body
_2 + _4 1 times vec_to_scalar costs 4 in body
/app/example.f90:4:25: note: Cost model analysis for whole subgraph:
Vector cost: 36
Scalar cost: 36
I think the cost of REDUC_PLUS is too cheap here. COST_N_INSN(1 + log2(nunits))
might be more accurate in general, since the vector is repeatedly broken down
into halves and summed together until it is reduced to a single unit.