gcc generates suboptimal i386 block copy code, like this: movl $9, %ecx rep movsb or this: movl $2, %ecx rep movsl movsw
Such short copies can be done with few movsl's instead. Patch is attached. Note that I am not familiar with gcc internals at all, so take it with reasonable suspicion. -- Summary: optimize i386 block copy Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vda at port dot imtp dot ilyichevsk dot odessa dot ua CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-pc-linux-gnu GCC host triplet: i386-pc-linux-gnu GCC target triplet: i386-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21329