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

--- Comment #9 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Tamar Christina from comment #8)
> 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.

If I read it correctly it just gets the inputs into half_type here.  So if
half_type is wrong the behavior will be wrong.  And "half_type =
unprom[0].type;" so it's from vect_look_through_possible_promotion.

Reply via email to