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

--- Comment #8 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
That change was made in g:aec90c8bf30cbd66e4febae2c78622dc217f3918, but no real
explanation as to why.

  patt_40 = (signed char) a.0_4;
  patt_41 = SAD_EXPR <patt_40, b_16, r_23>;

would be ok if it was

  patt_41 = SAD_EXPR <a.0_4, patt_b_16, r_23>;

where a.0_4 is

  a.0_4 = (unsigned char) a_14;
  patt_b_16 = (unsigned char) b_16

and the point of the vect_look_through_possible_promotion is to increase your
VF by removing any unneeded intermediate promotions.

On AArch64 we produce the right code, so the question is why does this diverge
from what you get.

It seems to me that it's not the promotion that is wrong, but rather

  /* Get the inputs to the SAD_EXPR in the appropriate types.  */
  tree sad_oprnd[2];
  vect_convert_inputs (vinfo, stmt_vinfo, 2, sad_oprnd, half_type,
                       unprom, half_vectype);

is not doing the right thing for you.  This call is what's responsible for
getting the inputs in the same type.

Reply via email to