https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84431
--- Comment #4 from Ruslan Nikolaev <nruslan_devel at yahoo dot com> --- (In reply to Uroš Bizjak from comment #3) > Created attachment 43471 [details] > Prototype patch > > Prototype patch, compiles the testcase to: > > movl 4(%esp), %eax > movl 12(%esp), %ecx > movl 8(%esp), %edx > shldl %eax, %edx > sall %cl, %eax > ret > > The patch also handles right shifts and cases where mask is less than 31 > bits. Thanks! I was wondering if the patch also fixes the same thing for x86-64 (i.e., -m64); in which case we would have something like this: __uint128_t func(__uint128_t a, unsigned shift) { return a << (shift & 63); }