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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-09-13

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The vectorizer sees if-converted code like

  <bb 3> [local count: 955630224]:
  # init_20 = PHI <_36(8), init_12(D)(18)>
  # i_22 = PHI <i_18(8), 0(18)>
  _1 = (long unsigned int) i_22;
  _2 = _1 * 4;
  _3 = cond_15(D) + _2;
  _4 = *_3;
  _23 = _4 != 0;
  _6 = _1 * 8;
  _38 = _37 + _6;
  _7 = (double *) _38;
  _8 = .MASK_LOAD (_7, 64B, _23);
  _ifc__35 = _23 ? _8 : 0.0;
  _36 = init_20 + _ifc__35;
  i_18 = i_22 + 1;
  if (n_13(D) > i_18)

so what it produces matches up here.  There's the possibility to
modify the if-conversion handling to use a COND_ADD instead of
the COND_EXPR plus ADD, I think that would be the best thing here.
See tree-if-conv.cc:is_cond_scalar_reduction/convert_scalar_cond_reduction

I think this is also wrong code when signed zeros are involved.

Reply via email to