gcc 3.4.x generates a bit suboptimal code on the below fragment. gcc 4.x generates code which is a bit more suboptimal.
unsigned v; void g(unsigned A) /* gcc -O2 -fomit-frame-pointer -S: gcc-3.4.3, 3.4.6: movl $-858993459, %eax mull 4(%esp) movl %edx, %eax // huh? shrl $3, %eax movl %eax, v ret gcc-4.0.0,4.1.1: movl $-858993459, %eax mull 4(%esp) movl %edx, %eax // huh? xorl %edx, %edx // huh?? shrl $3, %eax movl %eax, v ret */ { v = (A * 3435973837ULL) >> 35; } -- Summary: 4.x code generation regression relative to 3.4.6 Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vda dot linux at googlemail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28405