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

            Bug ID: 104406
           Summary: SLP discovery doesn't use TWO_OPERAND nodes as seeds
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---

the following example

#include <complex.h>

complex double f (complex double a, complex double b)
{
    return a * b;
}

compiled at -Ofast fails to SLP because at tree level it generates

  a$real_5 = REALPART_EXPR <a_1(D)>;
  a$imag_6 = IMAGPART_EXPR <a_1(D)>;
  b$real_7 = REALPART_EXPR <b_2(D)>;
  b$imag_8 = IMAGPART_EXPR <b_2(D)>;
  _9 = a$real_5 * b$real_7;
  _10 = a$imag_6 * b$imag_8;
  _11 = a$real_5 * b$imag_8;
  _12 = a$imag_6 * b$real_7;
  _13 = _9 - _10;
  _14 = _11 + _12;
  _3 = COMPLEX_EXPR <_13, _14>;

But SLP discovery does not attempt to start at _13 and _14, instead starts at
the multiplies:

 note:   Starting SLP discovery for
 note:     _11 = a$real_5 * b$imag_8;
 note:     _12 = a$imag_6 * b$real_7;

And ultimately fails because it doesn't know what to do with REALPART_EXPR and
IMAGPART_EXPR.

Reply via email to