Slow memcmp for aligned strings on Pentium 3
Bonzini
bonzini@gnu.org
Fri Apr 4 14:33:00 GMT 2003
> I was doing some tests with with memcmp and it seams that gcc 3.2.2
> always uses cmps, even for aligned strings.
I also had a very fast memcmp that also worked word-by-word in the unaligned case
(using some bit-twiddling tricks with SHRD), but I never had the time to polish it for
inclusion in glibc. It turned out however that CMPS is as fast as mine (or even
faster) on AMD chips.
I do think anyway that memcmp expansion in gcc should be disabled unless optimizing for
size or unless the size is known to be small, say 16 bytes.
See these posts:
http://gcc.gnu.org/ml/gcc/2002-10/msg01616.html (me)
http://gcc.gnu.org/ml/gcc/2002-10/msg01637.html (Roger)
http://sources.redhat.com/ml/libc-alpha/2002-10/msg00511.html (source)
Paolo
More information about the Gcc
mailing list