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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-08-04
                 CC|                            |wilco at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Gabriel Ravier from comment #0)
> bool f(int a, int b)
> {
>     return a >= 0 && b >= 0;
> }
> 
> This can be optimized to `return (a | b) >= 0;`. LLVM does this
> transformation, but GCC does not.

For orthogonality you also want:

a < 0 && b < 0   -> (a & b) < 0
a >= 0 || b >= 0 -> (a & b) >= 0
a < 0 || b < 0   -> (a | b) < 0

Reply via email to