public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/2960: Duplicate loop conditions even with -Os
@ 2002-10-06 20:02 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-10-06 20:02 UTC (permalink / raw)
  To: 94701-quiet, gcc-bugs, gcc-prs, nobody, rth

Synopsis: Duplicate loop conditions even with -Os

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Sun Oct  6 20:02:57 2002
Responsible-Changed-Why:
    .
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Sun Oct  6 20:02:57 2002
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00338.html

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


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

* optimization/2960: Duplicate loop conditions even with -Os
@ 2001-05-26 11:36 Matthias Klose
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Klose @ 2001-05-26 11:36 UTC (permalink / raw)
  To: gcc-gnats; +Cc: 94701-forwarded, herbert

>Number:         2960
>Category:       optimization
>Synopsis:       Duplicate loop conditions even with -Os
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Sat May 26 11:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     herbert@gondor.apana.org.au
>Release:        3.0 20010526 (Debian prerelease) (Debian testing/unstable)
>Organization:
Debian
>Environment:
System: Linux smile 2.2.17 #1 Sun Oct 8 19:26:41 MEST 2000 i686 unknown
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
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-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
For the following program,

int k;

extern void b();

int a(int i) {
	while (k < i) {
		b();
	}
}

GCC generates this on i386 (gcc -S -Os),

a:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	pushl	%ecx
	movl	8(%ebp), %ebx
	cmpl	%ebx, k
	jge	.L7
	.p2align 2
.L5:
	call	b
	cmpl	%ebx, k
	jl	.L5
.L7:
	popl	%edx
	popl	%ebx
	popl	%ebp
	ret

I don't see the reason why it isn't doing:

	.p2align 2
.L5:
	cmpl	%ebx, k
	jge	.L7
	call	b
	jmp	.L5
.L7:

or

	jmp	.L7
	.p2align 2
.L5:
	call	b
.L7:
	cmpl	%ebx, k
	jl	.L5

	
>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-06 20:02 optimization/2960: Duplicate loop conditions even with -Os rth
  -- strict thread matches above, loose matches on Subject: below --
2001-05-26 11:36 Matthias Klose

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