The item "Moving floating point through integer registers" on http://gcc.gnu.org/projects/optimize.html shows how GCC can move a float array element via an integer register. Consider the following test case: void fcpy(float *restrict a, float *restrict b, float *restrict aa, float *restrict bb, int n) { int i; for(i = 0; i < n; i++) { aa[i]=a[i]; bb[i]=b[i]; } } GCC 3.3 produces the following code for the inner loop for -O2 -fomit-frame-pointer -fschedule-insns --std=c99: .L6: movl (%ebp,%ecx,4), %eax movl (%edi,%ecx,4), %edx movl %eax, (%esi,%ecx,4) movl %edx, (%ebx,%ecx,4) incl %ecx cmpl 36(%esp), %ecx jl .L6 GCC 4.0 (4.0.0 20041112) produces this piece of junk: .L4: movl 20(%esp), %eax leal 0(,%ebx,4), %edx cmpl %ebx, %ebp movl -4(%eax,%edx), %ecx leal 1(%ebx), %eax movl %eax, %ebx movl %ecx, -4(%edi,%edx) movl 24(%esp), %ecx movl -4(%edx,%ecx), %eax movl %eax, -4(%edx,%esi) jg .L4 This is a bad regression from at least gcc 2.95 and gcc 3.1, as demonstraded on the projects/optimize.html page.
-- Summary: [4.0 Regression] Moving floating point through an integer register Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: steven at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org,jh at suse dot cz,zack at codesourcery dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18463