public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/2963: Pointless moving (optimization)
@ 2002-04-02  1:19 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-02  1:19 UTC (permalink / raw)
  To: 97904-quiet, gcc-bugs, gcc-prs, nobody

Synopsis: Pointless moving (optimization)

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 01:19:06 2002
State-Changed-Why:
    Fixed for gcc 3.1.

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


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

* optimization/2963: Pointless moving (optimization)
@ 2001-05-26 11:46 Matthias Klose
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Klose @ 2001-05-26 11:46 UTC (permalink / raw)
  To: gcc-gnats; +Cc: 97904-forwarded, herbert

>Number:         2963
>Category:       optimization
>Synopsis:       Pointless moving (optimization)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 26 11:45:59 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:
I was wondering if gcc-3.0 can decrease the size of ash since it combines
those esp additions/subtractions.  Unfortunately, it actually ends up being
bigger.  Part of the reason for that may be this:

findstring:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $20, %esp
        pushl   $pstrcmp
        pushl   $4
        pushl   16(%ebp)
        leal    8(%ebp), %edx
        pushl   12(%ebp)
        movl    %edx, %eax
        pushl   %eax
        call    bsearch
        leave
        ret

Notice the line "movl %edx, %eax" is unnecessary if we push edx instead of
eax, or if we lea into eax instead of edx.  The source of this is:

#include <stdlib.h>

int pstrcmp(const void *, const void *);

const char *const *findstring(
	const char *s, const char *const *array, size_t nmemb
) {
	return bsearch(&s, array, nmemb, sizeof(const char *), pstrcmp);
}

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


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02  1:19 optimization/2963: Pointless moving (optimization) rth
  -- strict thread matches above, loose matches on Subject: below --
2001-05-26 11:46 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).