https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66552
--- Comment #13 from Li Jia He <helijia at gcc dot gnu.org> --- In this optimization we assume n is either positive or divisible by the nth power of 2. So the result of the % is non-negative. However, it is not reasonable for translating (a % 32)) to (a & 31). If a is signed int and value is -1, (a % 32) will get the follow result, (a % 32) = (-1 % 32) = -1. However, (a & 31) will get the follow result, (a & 31) = -1 & 31 = 31. This conversion is not reasonable at this time.