public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/3507: appalling optimisation with sub/cmp on i386
@ 2001-07-01  9:16 Matthias Klose
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Klose @ 2001-07-01  9:16 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc

>Number:         3507
>Category:       optimization
>Synopsis:       appalling optimisation with sub/cmp on i386
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 01 09:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     herbert@gondor.apana.org.au
>Release:        3.0 (Debian GNU/Linux) and HEAD 20010701
>Organization:
The Debian project
>Environment:
System: Debian GNU/Linux (testing/unstable)
Architecture: i686
	
host: i386-linux
build: i386-linux
target: i386-linux
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #75773.
  Please CC 75773-quiet@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/75773 ]
 	

For the file

unsigned long foo(unsigned long a, unsigned long b) {
	unsigned long c = a - b;

	if (a < b) {
		c += 100;
	}

	return c;
}

gcc -O2 -S generates (The cmpl after the subl is unnecessary):

        .file   "bug-75773.c"
        .text
        .align 2
        .p2align 2,,3
.globl foo
        .type   foo,@function
foo:
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %edx
        movl    12(%ebp), %eax
        movl    %edx, %ecx
        subl    %eax, %ecx
        cmpl    %eax, %edx
        jae     .L2
        addl    $100, %ecx
.L2:
        movl    %ecx, %eax
        popl    %ebp
        ret
.Lfe1:
        .size   foo,.Lfe1-foo
        .ident  "GCC: (GNU) 3.1 20010701 (experimental)"
>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: optimization/3507: appalling optimisation with sub/cmp on i386
@ 2002-04-02  2:36 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-02  2:36 UTC (permalink / raw)
  To: 75773-quiet, gcc-bugs, gcc-prs, herbert, nobody

Synopsis: appalling optimisation with sub/cmp on i386

State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 02:36:06 2002
State-Changed-Why:
       (set (reg/v:SI 61)
            (minus:SI (reg/v:SI 59) (reg/v:SI 60)))
    
    and
    
       (set (reg:CC 17 flags)
            (compare:CC (reg/v:SI 59) (reg/v:SI 60))) 
    
    are not LOG_LINK related, because they share no common
    destination, so combine doesn't merge them.  But after
    reload, they don't have the same arguments, so we can't
    peephole them there either.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3507


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

end of thread, other threads:[~2002-04-02 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-01  9:16 optimization/3507: appalling optimisation with sub/cmp on i386 Matthias Klose
2002-04-02  2:36 rth

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).