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

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
(for cmp1 (eq ne)
     cmp2 (lt ge)
 (simplify
  (cmp1 (trunc_div @0 @1) integer_zerop)
  (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
       || VECTOR_INTEGER_TYPE_P (TREE_TYPE (@0)))
   (cmp2 (abs @0) (abs @1)))))

(I assume that abs simplifies to the identity for unsigned)
But if we are going to use A/B anyway, computing two ABS may waste time, so
maybe restrict it to TYPE_UNSIGNED (TREE_TYPE (@0)) || single_use (@2) (where
@2 is the trunc_div) or something like that.

Reply via email to