please look at the 32-bit asm. dump: _Z3msby: pushl %ebx movl 12(%esp), %edx movl 8(%esp), %eax popl %ebx movl %edx, %eax xorl %edx, %edx shrl $24, %eax movzbl %al,%ecx movzbl %cl, %eax ret
wow! this could be done within two intructions: movzbl 11(%esp), %eax ret the 64-bits variant looks fine: _Z3msby: movq %rdi, %rax shrq $56, %rax ret -- Summary: very missed optimization. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC target triplet: i386-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31943