http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61010
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Indeed we iterate in /* Canonicalize (X & C1) | C2. */ because we fold (unsigned int) (a * 64) & 255 to (unsigned int) (a * 64) & 192 in /* Fold (X * CST1) & CST2 to zero if we can, or drop known zero bits from CST2. */ The iterating input is ((unsigned int) (a * 64) & 192) | 63 where it seems to fail to "Minimize the number of bits set in C1" because it hits the "unless" case. One option is to apply the same "unless" case to the "drop known zero bits" BIT_AND_EXPR folding.