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

--- Comment #4 from Wesley Lewis <lewis.wes.23 at gmail dot com> ---
The simply expression should instead be: 

/* Fold ~X op -Y as (~(-Y)) op X. or `(Y-1) op X`  */
(for cmp (simple_comparison)
 (simplify
  (cmp:c (bit_not @0) (negate @1))
  (cmp (plus @1 { build_minus_one_cst (TREE_TYPE (@1)); }) @0)))


Changes:
- no negative operation, thus we use negate
- build_minus_one_cst should consider type of operand @1. Although it wouldn't
make a difference having the same type for the plus operation is just being on
the safe side

Reply via email to