[Bug tree-optimization/101703] (bool0 + bool1) & 1 and (bool0 + bool1) == 1 can be optimized to bool0 ^ bool1

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 7 16:26:22 GMT 2024


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/llvm/llv
                   |                            |m-project/issues/94737

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Another one:
```
unsigned f(bool a, bool b)
{
        return (a + b)>>1;
}
```

This is just `a & b`.
(this is from https://github.com/llvm/llvm-project/issues/94737 ).


More information about the Gcc-bugs mailing list