[Bug tree-optimization/96237] Failure to recognize and pattern composed of and+or after shift

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jul 19 22:53:42 GMT 2020


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-19

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
if (x & 16)
        a |= 2;

Maybe should be transformed into:
a |= ((x >> 4) & 0x1) << 1;
Which in turn should be transformed into:
a |= ((x & 0x10) >> 3);


    if (x & 32)
        a |= 4;
gets transformed into:
a |= ((x & 0x20) >> 3);

And:
a |= ((x & 0x40) >> 3);
a |= ((x & 0x20) >> 3);
Into:
a |= ((x & 0x60) >> 3);
Or:
a |= ((x >> 3) & 0x6);

Combine that with:
a = (x >> 3) & 1;
gets us:
a |= ((x >> 3) & 0x7);

Hopefully I did that correctly.


More information about the Gcc-bugs mailing list