public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/17235] New: code quality regression on x86
@ 2004-08-30  5:40 dann at godzilla dot ics dot uci dot edu
  2004-08-30  7:17 ` [Bug middle-end/17235] " pinskia at gcc dot gnu dot org
  2004-08-30 16:07 ` dann at godzilla dot ics dot uci dot edu
  0 siblings, 2 replies; 3+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-08-30  5:40 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/17235] code quality regression on x86
  2004-08-30  5:40 [Bug rtl-optimization/17235] New: code quality regression on x86 dann at godzilla dot ics dot uci dot edu
@ 2004-08-30  7:17 ` pinskia at gcc dot gnu dot org
  2004-08-30 16:07 ` dann at godzilla dot ics dot uci dot edu
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-30  7:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-30 07:16 -------
Actually this is invalid, if you want to optimizate for size use -Os, push/pop are not faster than mov on 
i686 and pentium3, yes they are for the pentium4 but you should be using -mtune=pentium4 if you 
want to tune for the pentium4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|rtl-optimization            |middle-end
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17235


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/17235] code quality regression on x86
  2004-08-30  5:40 [Bug rtl-optimization/17235] New: code quality regression on x86 dann at godzilla dot ics dot uci dot edu
  2004-08-30  7:17 ` [Bug middle-end/17235] " pinskia at gcc dot gnu dot org
@ 2004-08-30 16:07 ` dann at godzilla dot ics dot uci dot edu
  1 sibling, 0 replies; 3+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-08-30 16:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2004-08-30 16:07 -------
(In reply to comment #1)
> Actually this is invalid, if you want to optimizate for size use -Os, push/pop
are not faster than mov on 
> i686 and pentium3

Are you sure about this? Intel's compiler generates push/pop for i686/p3 too.
And they usually get little details like this right. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17235


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-30 16:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-30  5:40 [Bug rtl-optimization/17235] New: code quality regression on x86 dann at godzilla dot ics dot uci dot edu
2004-08-30  7:17 ` [Bug middle-end/17235] " pinskia at gcc dot gnu dot org
2004-08-30 16:07 ` dann at godzilla dot ics dot uci dot edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).