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

            Bug ID: 113078
           Summary: [14 regression] reduction of cond_sub is not
                    vectorized.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liuhongt at gcc dot gnu.org
  Target Milestone: ---

int
foo (int n, int* p, int* pi)
{
    int sum = 0;
    for (int i = 0; i != n; i++)
    {
        if (pi[i] > 0)
          sum -= p[i];
    }
    return sum;
}

gcc 13 can vectorize it, but latest trunk don't, guess it's related to
optimiztion of COND_OP in ifcvt.

/app/example.cpp:5:23: note:   vect_is_simple_use: vectype vector(8) int
/app/example.cpp:5:23: missed:   reduction: not commutative/associative
/app/example.cpp:2:1: missed:   not vectorized: relevant phi not supported:
sum_18 = PHI <_ifc__32(8), 0(18)>
/app/example.cpp:5:23: missed:  bad operation or unsupported loop bound.

Reply via email to