[Bug optimization/3508] builtin memcmp() could be optimised
debian-gcc at lists dot debian dot org
gcc-bugzilla@gcc.gnu.org
Sun Aug 10 15:31:00 GMT 2003
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)"
--
More information about the Gcc-bugs
mailing list