public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/3508: builtin memcmp() could be optimised
@ 2001-07-01  9:26 Matthias Klose
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Klose @ 2001-07-01  9:26 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc

>Number:         3508
>Category:       optimization
>Synopsis:       builtin memcmp() could be optimised
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 01 09:26: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 #85535.
  Please CC 85535-quiet@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/85535 ]
 	

int main() {
	return !memcmp("abcd", "efgh", 4);
}

produces the assembly (-S -g -O2),

        movl    $.LC1, %edi
        movl    $.LC0, %esi
        movl    $4, %ecx
        cld
        repz
        cmpsb
        seta    %cl
        setb    %dl
        popl    %esi
        xorl    %eax, %eax
        popl    %edi
        cmpb    %dl, %cl
        sete    %al

which is a waste because it could've simply loaded the two objects into
registers and compared them.  The same is true on other architectures as
well.

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


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

* Re: optimization/3508: builtin memcmp() could be optimised
@ 2002-04-22 20:39 billingd
  0 siblings, 0 replies; 2+ messages in thread
From: billingd @ 2002-04-22 20:39 UTC (permalink / raw)
  To: 85535-quiet, gcc-bugs, gcc-prs, herbert, nobody

Synopsis: builtin memcmp() could be optimised

State-Changed-From-To: open->closed
State-Changed-By: billingd
State-Changed-When: Mon Apr 22 20:39:28 2002
State-Changed-Why:
    Fixed
    http://gcc.gnu.org/ml/gcc-patches/2001-12/msg02443.html

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


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

end of thread, other threads:[~2002-04-23  3:39 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:26 optimization/3508: builtin memcmp() could be optimised Matthias Klose
2002-04-22 20:39 billingd

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