http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46847
Summary: Missed optimization for variant of Duff's device
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: [email protected]
ReportedBy: [email protected]
The attached file contains a function that implements a variant of
"Duff's device" to zero out part of an array. GCC 4.3.2 (Red Hat 4.3.2-7)
with -O3 generates rather bad code for x86-64; the code it produces for i386
might also be improved.
Generated code for -m32 and -m64 is in the attached file. The -m64 version
contains multiple copies of a redundant load for %esi (and corresponding
jumps).
Both versions move the computation of 'end' inside the loop, which seems
unnecessary to me.