[Bug middle-end/64309] if (1 & (1 << n)) not simplified to if (n == 0)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 15 08:46:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64309
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-15
Component|rtl-optimization |middle-end
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. Sth like
(simplify
(ne (bit_and (lshift integer_onep @0) integer_onep) integer_zerop)
(eq @0 { build_zero_cst (TREE_TYPE (@0)); })
with eventually also covering if ((1 & (1<< n)) == 0) -> if (n & 1 == 0)
You can extend this to cover the other cases you mention.
More information about the Gcc-bugs
mailing list