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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-10-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Just to make sure, with -O3 -march=z14 on the first testcase I get a masked
epilog and that's where it goes wrong?  Confirmed there:

  <bb 16> [local count: 81467477]:
  # vect_last_29.19_72 = PHI <vect_last_29.19_71(12)>
  # adjusted_loop_len_93 = PHI <adjusted_loop_len_69(12)>
  _73 = .VEC_EXTRACT (vect_last_29.19_72, adjusted_loop_len_93);

first of all it's the adjusted len:

  adjusted_loop_len_69 = loop_len_68 + 18446744073709551615;

and 2nd, it's the len in bytes.

So

      /* BIAS + 1.  */
      signed char biasval = LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);
      tree bias_plus_one
        = int_const_binop (PLUS_EXPR,
                           build_int_cst (TREE_TYPE (len), biasval),
                           build_one_cst (TREE_TYPE (len)));

      /* LAST_INDEX = LEN - (BIAS + 1).  */
      tree last_index = gimple_build (&stmts, MINUS_EXPR, TREE_TYPE (len),
                                     len, bias_plus_one);

is wrong in two ways, it should be (LEN - BIAS) / element_size - 1.

Reply via email to