https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102473
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marxin at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Hongtao.liu from comment #2) > (In reply to Richard Biener from comment #1) > > Looks like at least on Zen movs[hl]dup is on the integer domain so we'l see > > a domain crossing penalty here(?). But since this is a generic arch/tuning > > regression the SSE2 code path should be what matters - on the committed > > testcase I see > > > > foo: > > .LFB572: > > .cfi_startproc > > pxor %xmm0, %xmm0 > > addss (%rdi), %xmm0 > > addss 4(%rdi), %xmm0 > > addss 8(%rdi), %xmm0 > > addss 12(%rdi), %xmm0 > > ret > > > > where it seems that the vectorizer doesn't pick up the reduction pattern. > > > Guess you're use O3, -ffast-math is needed for v4sf reduction > https://godbolt.org/z/sjf4Pncna I was looking at the testcase as compiled by the testsuite. It seems that adding __attribute__((optimize("tree-vectorize"))) makes the loop no longer vectorized as it at the moment cancels -ffast-math. IIRC when Martin commits his optimize() re-org it will no longer do that.