https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108938
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- You're right. Then we should handle it more generically, basically check if either the CMPNOP or CMPXCHG patterns (well, their narrowed counterparts based on size) would match if rotated by a multiple of 8 and rotate optab is present for that mode. Then it would handle even cases like 64-bit bswap followed by a single rotate. It needs to be done after comparison of CMPNOP and CMPXCHG non-rotated though, because we want to preserve current behavior for 16-bit nop/bswap candidates.