This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/17647] New: [4.0 regression] Missing i386 addressing modes
- From: "uros at kss-loka dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Sep 2004 07:03:04 -0000
- Subject: [Bug target/17647] New: [4.0 regression] Missing i386 addressing modes
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This testcase (from scimark2.0, LU.c) shows missing i386 addressing modes:
void LU_copy_matrix(int M, int N, double **lu, double **A)
{
int i;
int j;
for (i=0; i<M; i++)
for (j=0; j<N; j++)
lu[i][j] = A[i][j];
}
With gcc -O2 -ffast-math -fomit-frame-pointer -march=pentium4 LU.c following ASM
code is produced:
GCC: (GNU) 3.2 20020903 (Red Hat Linux 8.0 3.2-7):
LU_copy_matrix:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
xorl %ebx, %ebx
movl 20(%esp), %edi
movl 24(%esp), %esi
movl 32(%esp), %ebp
cmpl %edi, %ebx
jge .L13
.L11:
xorl %eax, %eax
cmpl %esi, %eax
jge .L15
movl 28(%esp), %edx
movl (%edx,%ebx,4), %ecx
movl (%ebp,%ebx,4), %edx
.L10:
fldl (%edx,%eax,8)
fstpl (%ecx,%eax,8)
addl $1, %eax
cmpl %esi, %eax
jl .L10
.L15:
addl $1, %ebx
cmpl %edi, %ebx
jl .L11
.L13:
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
gcc 4.0 regressed in this area and produces:
LU_copy_matrix:
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
movl 24(%esp), %ebp
movl 20(%esp), %eax
testl %eax, %eax
jle .L8
movl 32(%esp), %esi
movl 28(%esp), %ebx
xorl %edi, %edi
.L4:
testl %ebp, %ebp
jle .L6
movl (%esi), %ecx
movl (%ebx), %edx
xorl %eax, %eax
.L5:
fldl (%ecx)
fstpl (%edx)
addl $1, %eax
addl $8, %ecx
addl $8, %edx
cmpl %eax, %ebp
jg .L5
.L6:
addl $1, %edi
addl $4, %esi
addl $4, %ebx
cmpl %edi, 20(%esp)
jg .L4
.L8:
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
The problem is in .L5 loop. gcc-4.0 uses a simple addressing scheme, but gcc-3.2
can use complex SIB addressing schemes, shown in corresponding .L10 loop. This
problem is also present in integer instructions.
IMHO this could be the cause of unbeliveably bad benchmark results in
scimark-2.0 (http://www.coyotegulch.com/reviews/linux_compilers/)
Uros.
--
Summary: [4.0 regression] Missing i386 addressing modes
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uros at kss-loka dot si
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-linuc-gnu
GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linuc-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17647