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

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> I believe the bug is that get_vectype_for_scalar_type for the operands of
> POINTER_DIFF_EXPR is vector of unsigned elements, the result of
> POINTER_DIFF_EXPR is a signed and thus we IMHO need to vectorize
> POINTER_DIFF_EXPR as effectively MINUS_EXPR on the vector unsigned operands
> producing vector unsigned result, and then VIEW_CONVERT_EXPR the result into
> vector signed result.

Yes, that's actually what I thought was already happening until I saw this
PR... (I added the POINTER_DIFF_EXPR -> MINUS_EXPR replacement because of a
missed optimization in the testsuite, so it must have at least partially
worked)

> The reason POINTER_PLUS_EXPR works by being mapped as
> PLUS_EXPR is that both sizetype and pointers are TYPE_UNSIGNED and we get
> the same vector types for both.

That certainly simplifies things for POINTER_PLUS_EXPR.

Reply via email to