This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/3508] builtin memcmp() could be optimised


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


debian-gcc at lists dot debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |herbert at gondor dot apana
                   |                            |dot org dot au


------- Additional Comments From debian-gcc at lists dot debian dot org  2003-08-10 15:31 -------
Unfortunately this bug has only been special cased rather than fixed 
in its full generality.  If we change one of the arguments to a 
variable, the compiler still fails to produce the dword comparison 
that I would expect: 
 
-- a.c -- 
int foo(const char *s) { 
        return !memcmp("abcd", s, 4); 
} 
 
-- gcc -S -O2 a.c -- 
.LC0: 
        .string "abcd" 
        .text 
        .p2align 2,,3 
.globl foo 
        .type   foo, @function 
foo: 
        pushl   %ebp 
        movl    %esp, %ebp 
        pushl   %edi 
        pushl   %esi 
        movl    8(%ebp), %edi 
        movl    $.LC0, %esi 
        movl    $4, %ecx 
        cld 
        repz 
        cmpsb 
        sete    %al 
        popl    %esi 
        movzbl  %al, %eax 
        popl    %edi 
        leave 
        ret 
        .size   foo, .-foo 
        .ident  "GCC: (GNU) 3.3 20030509 (Debian prerelease)" 
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]