This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31575] New: Extra push+pop generated on x86
- From: "dann at godzilla dot ics dot uci dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Apr 2007 19:34:16 -0000
- Subject: [Bug c/31575] New: Extra push+pop generated on x86
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
For this code:
struct data {
unsigned data[4][1];
unsigned char valid[4];
unsigned char flags[4];
};
void
def(struct data *info, int index, unsigned *v)
{
if (info->flags[index]) {
info->valid[index] = 1;
info->data[index][0] = v[0];
}
}
SVN HEAD generates an extra push+pop compared to 4.1.1 when compiling with
-O2 -march=pentium4
4.1.1 generates this code (3.4.3 generates identical code):
def:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %ecx
movl 12(%ebp), %edx
cmpb $0, 20(%edx,%ecx)
je .L4
movb $1, 16(%edx,%ecx)
movl 16(%ebp), %eax
movl (%eax), %eax
movl %eax, (%ecx,%edx,4)
.L4:
popl %ebp
ret
SVN HEAD:
def:
pushl %ebp
movl %esp, %ebp
pushl %ebx <--- extra instruction
movl 8(%ebp), %ecx
movl 12(%ebp), %edx
cmpb $0, 20(%ecx,%edx)
je .L4
movb $1, 16(%ecx,%edx)
movl 16(%ebp), %ebx
movl (%ebx), %eax
movl %eax, (%ecx,%edx,4)
.L4:
popl %ebx <--- extra instruction
popl %ebp
ret
This is a regression from (at least) 3.4.3 and 4.1.1
--
Summary: Extra push+pop generated on x86
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31575