aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-06-04 16:45:35 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-04 16:45:35 -0700
commit2f3f7b9da238269397d8dd8868ed494eff2c9064 (patch)
tree86f742588aa98f969fd357c5be0a57128a11e2cb
parent747785f2b3afbc8b900083988957bff11bb6b11f (diff)
downloadglibc-2f3f7b9da238269397d8dd8868ed494eff2c9064.zip
glibc-2f3f7b9da238269397d8dd8868ed494eff2c9064.tar.gz
glibc-2f3f7b9da238269397d8dd8868ed494eff2c9064.tar.bz2
More small optimizations for x86-64 strlen.
-rw-r--r--ChangeLog2
-rw-r--r--sysdeps/x86_64/strlen.S16
2 files changed, 8 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index cb094d1..7d99a20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
2009-06-04 Ulrich Drepper <drepper@redhat.com>
- * sysdeps/x86_64/strlen.S: Remove useless instruction.
+ * sysdeps/x86_64/strlen.S: Minor optimizations.
2009-06-02 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/sysdeps/x86_64/strlen.S b/sysdeps/x86_64/strlen.S
index 572f3c2..93aee6b 100644
--- a/sysdeps/x86_64/strlen.S
+++ b/sysdeps/x86_64/strlen.S
@@ -23,29 +23,27 @@
.text
ENTRY(strlen)
+ pxor %xmm2, %xmm2
movq %rdi, %rcx
movq %rdi, %r8
andq $~15, %rdi
- pxor %xmm1, %xmm1
+ movdqa %xmm2, %xmm1
+ pcmpeqb (%rdi), %xmm2
orl $0xffffffff, %esi
- movdqa (%rdi), %xmm0
subq %rdi, %rcx
- leaq 16(%rdi), %rdi
- pcmpeqb %xmm1, %xmm0
- shl %cl, %esi
- pmovmskb %xmm0, %edx
- negq %r8
+ shll %cl, %esi
+ pmovmskb %xmm2, %edx
andl %esi, %edx
jnz 1f
-2: movdqa (%rdi), %xmm0
+2: movdqa 16(%rdi), %xmm0
leaq 16(%rdi), %rdi
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %edx
testl %edx, %edx
jz 2b
-1: leaq -16(%rdi,%r8), %rdi
+1: subq %r8, %rdi
bsfl %edx, %eax
addq %rdi, %rax
ret