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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-04-21

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  The testcase, for reference:

#include <math.h>
#include <complex.h>

void test(complex double *values) {
    for (int itr = 0; itr < 256; itr++) {
        values[itr] = cexp(values[itr]);
        // values[itr] = (cos(cimag(values[itr])) + I *
sin(cimag(values[itr]))) * exp(creal(values[itr]));
    };
}

where the current IL that isn't vectorized is

  <bb 3> [local count: 1063004408]:
  # itr_14 = PHI <itr_11(5), 0(2)>
  # ivtmp_6 = PHI <ivtmp_26(5), 256(2)>
  _1 = (long unsigned int) itr_14;
  _2 = _1 * 16;
  _3 = values_9(D) + _2;
  _4 = *_3;
  _5 = cexp (_4);
  _13 = REALPART_EXPR <_5>;
  _12 = IMAGPART_EXPR <_5>;
  REALPART_EXPR <*_3> = _13;
  IMAGPART_EXPR <*_3> = _12;
  itr_11 = itr_14 + 1;
  ivtmp_26 = ivtmp_6 - 1;
  if (ivtmp_26 != 0)

It should be possible, given a vector cexp implementation, to SLP recognize
complex data as two scalar lanes.  Note how complex lowering lowers the
complex store but not the load.

IIRC glibc libm does not have a vector cexp, so we'd rely on having a
pattern to switch it to sin/cos.

Reply via email to