https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97386
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:1a98b22b0468214ae8463d075dacaeea1d46df15 commit r10-8902-g1a98b22b0468214ae8463d075dacaeea1d46df15 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Oct 13 19:13:26 2020 +0200 combine: Fix up simplify_shift_const_1 for nested ROTATEs [PR97386] The following testcases are miscompiled (the first one since my improvements to rotate discovery on GIMPLE, the other one for many years) because combiner optimizes nested ROTATEs with narrowing SUBREG in between (i.e. the outer rotate is performed in shorter precision than the inner one) to just one ROTATE of the rotated constant. While that (under certain conditions) can work for shifts, it can't work for rotates where we can only do that with rotates of the same precision. 2020-10-13 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/97386 * combine.c (simplify_shift_const_1): Don't optimize nested ROTATEs if they have different modes. * gcc.c-torture/execute/pr97386-1.c: New test. * gcc.c-torture/execute/pr97386-2.c: New test. (cherry picked from commit f76949cee9560d04d5417481dbcda5ca089c9ebc)