https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64309
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #6) > (In reply to Marek Polacek from comment #5) > > I don't think so. I tried to come up with a more general transformation > > that would simplify ((CST << n) & CST) != 0, but I haven't found anything > > If both CST are (possibly different) powers of 2 it works. Yes, but I'm not sure if it's worth it (doing it for 1, 2, 4, 8, ... instead of just for 1). > ((c<<n)&c)==c also works. ((pow2<<p)&(pow2<<n))!=0. I don't see how's that a simplification. > > yet. So maybe just this? > > ((1 << n) & 1) != 0 -> n == 0 > > That looks like what richi posted. For scalars, != 0 is useless and this > could just be: > (1<<n)&1 -> n==0 Yeah, it's what richi posted.