This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/17235] New: code quality regression 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: 30 Aug 2004 05:40:14 -0000
- Subject: [Bug rtl-optimization/17235] New: code quality regression on x86
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling
void foo (unsigned *, unsigned *, unsigned);
unsigned *baz (unsigned) __attribute__ ((const));
struct COST
{
unsigned *cost;
unsigned maxWeakConstraintLevel;
};
unsigned * bar(struct COST *c)
{
unsigned *valp;
if(c->maxWeakConstraintLevel == 0)
valp =0;
else
{
valp = baz (4 * 33);
foo (valp, c->cost, c->maxWeakConstraintLevel * sizeof(unsigned));
}
return valp;
}
with -O2 -fomit-frame-pointer on x86 generates:
bar:
subl $28, %esp
movl %edi, 24(%esp)
movl 32(%esp), %edi
movl %esi, 20(%esp)
xorl %esi, %esi
movl %ebx, 16(%esp)
movl 4(%edi), %ebx
testl %ebx, %ebx
jne .L6
movl %esi, %eax
movl 16(%esp), %ebx
movl 20(%esp), %esi
movl 24(%esp), %edi
addl $28, %esp
ret
.p2align 4,,7
.L6:
movl $132, (%esp)
call baz
movl %eax, %esi
[snip]
Observe that stack accesses are done using mov instructions, not pop/push which
are more space efficient.
The code generated is much bigger: mainline CVS generates 112 bytes,
gcc-3.3.3 62 bytes and ICC 56 bytes.
Intel's compiler generates pop/push instructions for stack accesses.
--
Summary: code quality regression on x86
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17235