[Bug tree-optimization/95404] Failure to optimize compare to power of 2 and bitwise and to more direct bitwise and

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 7 07:52:23 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-07
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What is interesting is clang does not even do it for:
int f2(int x)
{
    int t = 0;
    if ((unsigned)x > 15)
        t= false;
    else t = ~x;
    return t&1;
}

But once you change int to bool, it does .....
We might be able to do it for both.


More information about the Gcc-bugs mailing list