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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-12-16
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
/var/gcc/regression/master/11.4-gcc-gas/build/i386-pc-solaris2.11/libstdc++-v3/include/complex:376:20:
missed:  not vectorized: more than one data ref in stmt: __r = MEM[(const
struct complex &)_23];
/vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/vect/pr64410.cc:46:29:
missed:  not vectorized: loop contains function calls or data references that
cannot be analyzed

the loop body is

  <bb 19> [local count: 955630224]:
  # i_196 = PHI <i_62(44), 0(42)>
  _21 = i_196 * 16;
  _22 = _124 + _21;
  _23 = _213 + _21;
  _24 = _111 + _21;
  __r = MEM[(const struct complex &)_23];
  _140 = REALPART_EXPR <MEM[(const struct complex *)_22]._M_value>;
  _201 = IMAGPART_EXPR <MEM[(const struct complex *)_22]._M_value>;
  _31 = REALPART_EXPR <__r._M_value>;
  _26 = IMAGPART_EXPR <__r._M_value>;
  _30 = _31 + _140;
  _27 = _26 + _201;
  REALPART_EXPR <__r._M_value> = _30;
  IMAGPART_EXPR <__r._M_value> = _27;
  *_24 = __r;
  __r ={v} {CLOBBER(eos)};
  i_62 = i_196 + 1;
  if (size_40 > i_62)

complex lowering is not expanding the aggregate copy because it's of
struct complex type, not COMPLEX_TYPE.  But I'd have expected SRA
to scalarize __r here.

As indicated we're vectorizing two unrelated functions in this testcase
(so the previous dump scan [failure] was spurious).

I'll note that x86_64 with -m32 suffers from the same issue and there SRA
is not performed because of x87 math, with -mfpmath=sse it works fine.
The reason is because aggregate copying is bit-for-bit while ld/st pairs
are not bit pattern preserving.

I guess a dg-skip for x32 but not -mfpmath=sse -msse is difficult so
I'll add -msse -mfpmath=sse instead.

Reply via email to