This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: PATCH: Optimize memcmp for ia32
- From: Denis Zaitsev <zzz at anda dot ru>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: GNU C Library <libc-alpha at sources dot redhat dot com>
- Date: Fri, 6 Feb 2004 15:07:48 +0500
- Subject: Re: PATCH: Optimize memcmp for ia32
- References: <20040205001126.GA24827@lucon.org>
On Wed, Feb 04, 2004 at 04:11:26PM -0800, H. J. Lu wrote:
> +L(find_diff):
> + cmpb %cl, %al
> + jne L(set)
> + cmpw %cx, %ax
cmpb %ch, %ah This cmpb vs. cmpw will save 1 byte of
code and add another 1% of performance.
> + jne L(set)
> + shrl $16,%eax
> + shrl $16,%ecx
> + cmpb %cl, %al
> + jne L(set)
> + /* We get there only if we already know there is a
> + difference. */
> + cmpl %ecx, %eax
> +L(set):
I'm sorry for my intervence. :) But 16-bit operations are the big
performance penalties in 32-bit mode.