https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124222

            Bug ID: 124222
           Summary: SLP patterns confuse scalar costing
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Split out from PR116979.

struct S { __complex__ float f; };

struct S
foo (const struct S *a, const struct S *b)
{
  struct S r;
  r.f = a->f * b->f;
  return r;
}

with -O2 -mfma on x86-64 shows

t.c:8:10: note: Cost model analysis for part in loop 0:
  Vector cost: 156
  Scalar cost: 152
t.c:8:10: missed: not vectorized: vectorization is not profitable.

which is because the SLP pattern for FMADDSUB makes us only cost part of
the covered scalar stmts.  This is because the scalar coverage is computed
from SLP_TREE_SCALAR_STMTS only.

Reply via email to