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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> So the general rule is:
> (simplify
>  (eq:c @0 (convert (cmp @1 @2)))
>  (if (bitwise_equal_p (@0, @1))
>  (with {
>     bool zeroalwaystrue = ...
>     bool zeroalwaysfalse = ...
>     bool onealwaystrue = ...
>     bool onealwaysfalse = ...
>   }
>   (switch
>    (if (zeroalwaystrue && onealwaystrue)
>     (le @0:unsigned { one(unsigned); } )) // @0 == 0 | @0 == 1
>    (if (zeroalwaysfalse && onealwaysfalse )
>     { false_bool; }) // false
>    (if (zeroalwaystrue && onealwaysfalse)
>     (eq @0 { zero(TREE_TYPE(@0)); })) // @0 == 0
>    (if (onealwaystrue && onealwaysfalse)
>     (eq @0 { one(TREE_TYPE(@0)); })) // @0 == 1

If we want to do this only in VRP, we could just use match to match the
sequence and then handle the comparison there ...

Reply via email to