https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62263
--- Comment #6 from M.E. O'Neill <oneill+gccbugs at cs dot hmc.edu> --- (In reply to Marek Polacek from comment #3) > We handle at least > (x << n) | (x >> ((-n) & 31)) > (N can be 0 here) since PR57157. Although this code does work with LLVM, testing with GCC 4.9.0, and this implementation unsigned int rotl32_doubleand4(unsigned int v, unsigned char r) { return (v << (r & 31)) | (v >> ((-r) & 31)); } (or variations with r being a char or int) produces code like this: _rotl32_doubleand4: LFB6: movl %esi, %ecx movl %edi, %eax negl %ecx shrl %cl, %eax movl %esi, %ecx sall %cl, %edi orl %edi, %eax ret ... so it failed to spot the idiom entirely.