Skip to content

Commit

Permalink
Some some optimizations for x86-64 strcmp.
Browse files Browse the repository at this point in the history
  • Loading branch information
H.J. Lu authored and Ulrich Drepper committed Jul 26, 2009
1 parent 6573175 commit 4e5b582
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2009-07-25 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/multiarch/strcmp.S: Some more optimizations for
modern processor versions. Patch by H.J. Lu <hongjiu.lu@intel.com>.

[BZ #10448]
* sysdeps/posix/getaddrinfo.c (gaih_inet): If NSS module contains no
callback we must touch the status to avoid using stale value.
Expand Down
13 changes: 4 additions & 9 deletions sysdeps/x86_64/multiarch/strcmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ STRCMP_SSE42:
ja LABEL(crosscache) /* rsi: 16-byte load will cross cache line */
cmp $0x30, %eax
ja LABEL(crosscache) /* rdi: 16-byte load will cross cache line */
movlpd (%rdi), %xmm1
movlpd (%rsi), %xmm2
movhpd 8(%rdi), %xmm1
movhpd 8(%rsi), %xmm2
movdqu (%rdi), %xmm1
movdqu (%rsi), %xmm2
pxor %xmm0, %xmm0 /* clear %xmm0 for null char checks */
pcmpeqb %xmm1, %xmm0 /* Any null chars? */
pcmpeqb %xmm2, %xmm1 /* compare first 16 bytes for equality */
Expand Down Expand Up @@ -1492,11 +1490,8 @@ LABEL(less16bytes):
sub %rdx, %r11
jbe LABEL(strcmp_exitz)
#endif
xor %ecx, %ecx /* clear %ecx */
xor %eax, %eax /* clear %eax */

movb (%rsi, %rdx), %cl
movb (%rdi, %rdx), %al
movzbl (%rsi, %rdx), %ecx
movzbl (%rdi, %rdx), %eax

sub %ecx, %eax
ret
Expand Down

0 comments on commit 4e5b582

Please sign in to comment.