|
|
b9ba6d |
2010-10-25 Ulrich Drepper <drepper@redhat.com>
|
|
|
b9ba6d |
|
|
|
b9ba6d |
[BZ #12159]
|
|
|
b9ba6d |
* sysdeps/x86_64/multiarch/strchr.S: Fix propagation of search byte
|
|
|
b9ba6d |
into all bytes of SSE register.
|
|
|
b9ba6d |
Patch by Richard Li <richardpku@gmail.com>.
|
|
|
b9ba6d |
|
|
|
b9ba6d |
Index: glibc-2.12-2-gc4ccff1/string/Makefile
|
|
|
b9ba6d |
===================================================================
|
|
|
b9ba6d |
--- glibc-2.12-2-gc4ccff1.orig/string/Makefile
|
|
|
b9ba6d |
+++ glibc-2.12-2-gc4ccff1/string/Makefile
|
|
|
b9ba6d |
@@ -55,7 +55,7 @@ tests := tester inl-tester noinl-tester
|
|
|
b9ba6d |
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
|
|
|
b9ba6d |
bug-strtok1 $(addprefix test-,$(strop-tests)) \
|
|
|
b9ba6d |
bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
|
|
|
b9ba6d |
- bug-strstr1
|
|
|
b9ba6d |
+ bug-strstr1 bug-strchr1
|
|
|
b9ba6d |
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h \
|
|
|
b9ba6d |
str-two-way.h
|
|
|
b9ba6d |
|
|
|
b9ba6d |
Index: glibc-2.12-2-gc4ccff1/string/bug-strchr1.c
|
|
|
b9ba6d |
===================================================================
|
|
|
b9ba6d |
--- /dev/null
|
|
|
b9ba6d |
+++ glibc-2.12-2-gc4ccff1/string/bug-strchr1.c
|
|
|
b9ba6d |
@@ -0,0 +1,14 @@
|
|
|
b9ba6d |
+#include <stdio.h>
|
|
|
b9ba6d |
+#include <string.h>
|
|
|
b9ba6d |
+
|
|
|
b9ba6d |
+static int
|
|
|
b9ba6d |
+do_test (void)
|
|
|
b9ba6d |
+{
|
|
|
b9ba6d |
+ char s[] __attribute__((aligned(16))) = "\xff";
|
|
|
b9ba6d |
+ char *p = strchr (s, '\xfe');
|
|
|
b9ba6d |
+ printf ("%p\n", p);
|
|
|
b9ba6d |
+ return p != NULL;
|
|
|
b9ba6d |
+}
|
|
|
b9ba6d |
+
|
|
|
b9ba6d |
+#define TEST_FUNCTION do_test ()
|
|
|
b9ba6d |
+#include "../test-skeleton.c"
|
|
|
b9ba6d |
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strchr.S
|
|
|
b9ba6d |
===================================================================
|
|
|
b9ba6d |
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/strchr.S
|
|
|
b9ba6d |
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strchr.S
|
|
|
b9ba6d |
@@ -87,13 +87,13 @@ __strchr_sse42:
|
|
|
b9ba6d |
pxor %xmm2, %xmm2
|
|
|
b9ba6d |
movd %esi, %xmm1
|
|
|
b9ba6d |
movl %edi, %ecx
|
|
|
b9ba6d |
+ pshufb %xmm2, %xmm1
|
|
|
b9ba6d |
andl $15, %ecx
|
|
|
b9ba6d |
movq %rdi, %r8
|
|
|
b9ba6d |
je L(aligned_start)
|
|
|
b9ba6d |
|
|
|
b9ba6d |
/* Handle unaligned string. */
|
|
|
b9ba6d |
andq $-16, %r8
|
|
|
b9ba6d |
- pshufb %xmm2, %xmm1
|
|
|
b9ba6d |
movdqa (%r8), %xmm0
|
|
|
b9ba6d |
pcmpeqb %xmm0, %xmm2
|
|
|
b9ba6d |
pcmpeqb %xmm1, %xmm0
|