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