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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Richard Biener from comment #1)
> > it doesn't even have to be -N, any unsigned & N <= unsigned
> 
> Here are the ones which are valid:
> 
> U | N < U -> false
> U & N <= U -> true
> U & N > U -> false
> U | N >= U -> true
> 
> (for cmp (LT GE)
>  (simplify
>   (cmp (bit_ior @0 INTEGER_CST@1) @0)
>   ({ constant_boolean_node (cmp == GE, type); })))
> (for cmp (LE GT)
>  (simplify
>   (cmp (bit_and @0 INTEGER_CST@1) @0)
>   ({ constant_boolean_node (cmp == LE, type); })))
> 
> I don't see an easy way to combine these two patterns though.

I forgot the check for unsigned :).

Reply via email to