https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66552
--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jiu Fu Guo <guoji...@gcc.gnu.org>: https://gcc.gnu.org/g:222f312a773157f53396ba4cb287deb07f84cc34 commit r11-4033-g222f312a773157f53396ba4cb287deb07f84cc34 Author: guojiufu <guoji...@linux.ibm.com> Date: Mon Oct 19 13:48:19 2020 +0800 [PATCH] fold x << (n % C) to x << (n & C-1) if C meets power2 This patch fixes PR66552 which is also as: https://gcc.gnu.org/pipermail/gcc-patches/2020-February/540930.html which requests to optimizes (x shift (n mod C)) to (x shift (n bit_and (C - 1))) when C is a constant and power of two. gcc/ChangeLog 2020-10-19 Li Jia He <heli...@gcc.gnu.org> PR tree-optimization/66552 * match.pd (x << (n % C) -> x << (n & C-1)): New simplification. gcc/testsuite/ChangeLog 2020-10-19 Li Jia He <heli...@gcc.gnu.org> PR tree-optimization/66552 * gcc.dg/pr66552.c: New testcase.