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

--- Comment #5 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> Confirmed.
> OTOH the initial choice of mask mode for the compare by the vectorizer
> is a bit odd.  We get there from vect_recog_bool_pattern handling
> 
>   _28 = _24 ? 0 : _20;
> 
> which builds
> 
>   patt_15 = _24 != 0;
> 
> but assigns that a vector truth type based on '_24' rather than on '_28'
> which is where it's going to be used.  Using get_mask_type_for_scalar_type
> is also more likely off.
> 

_28 would be wrong no? As the results of patt_15 should be used inside the
conditional.

The bool recog pattern should be trying to convert _24 into a boolean of the
same precision as it wasn't one, and it's vectorization of _28 that should
handle the mismatch.

It has to since if the precision of _24 and _28 don't match and you make the
boolean mask based on _28 the compare would have to convert to boolean &
widen/truncate which we don't support and throws off VF detection.

That's why the pattern does this today and leaves the precision conversion to
later so that analysis sees it needs to happen.

> 
> This is the minimal fix I'm going with at this point.

I do think that's the correct fix..

Reply via email to