]>
Commit | Line | Data |
---|---|---|
12788f63 MT |
1 | 2010-10-25 Ulrich Drepper <drepper@redhat.com> |
2 | ||
3 | [BZ #12159] | |
4 | * sysdeps/x86_64/multiarch/strchr.S: Fix propagation of search byte | |
5 | into all bytes of SSE register. | |
6 | Patch by Richard Li <richardpku@gmail.com>. | |
7 | ||
8 | Index: glibc-2.12-2-gc4ccff1/string/Makefile | |
9 | =================================================================== | |
10 | --- glibc-2.12-2-gc4ccff1.orig/string/Makefile | |
11 | +++ glibc-2.12-2-gc4ccff1/string/Makefile | |
12 | @@ -55,7 +55,7 @@ tests := tester inl-tester noinl-tester | |
13 | tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \ | |
14 | bug-strtok1 $(addprefix test-,$(strop-tests)) \ | |
15 | bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \ | |
16 | - bug-strstr1 | |
17 | + bug-strstr1 bug-strchr1 | |
18 | distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h \ | |
19 | str-two-way.h | |
20 | ||
21 | Index: glibc-2.12-2-gc4ccff1/string/bug-strchr1.c | |
22 | =================================================================== | |
23 | --- /dev/null | |
24 | +++ glibc-2.12-2-gc4ccff1/string/bug-strchr1.c | |
25 | @@ -0,0 +1,14 @@ | |
26 | +#include <stdio.h> | |
27 | +#include <string.h> | |
28 | + | |
29 | +static int | |
30 | +do_test (void) | |
31 | +{ | |
32 | + char s[] __attribute__((aligned(16))) = "\xff"; | |
33 | + char *p = strchr (s, '\xfe'); | |
34 | + printf ("%p\n", p); | |
35 | + return p != NULL; | |
36 | +} | |
37 | + | |
38 | +#define TEST_FUNCTION do_test () | |
39 | +#include "../test-skeleton.c" | |
40 | Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strchr.S | |
41 | =================================================================== | |
42 | --- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/strchr.S | |
43 | +++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strchr.S | |
44 | @@ -87,13 +87,13 @@ __strchr_sse42: | |
45 | pxor %xmm2, %xmm2 | |
46 | movd %esi, %xmm1 | |
47 | movl %edi, %ecx | |
48 | + pshufb %xmm2, %xmm1 | |
49 | andl $15, %ecx | |
50 | movq %rdi, %r8 | |
51 | je L(aligned_start) | |
52 | ||
53 | /* Handle unaligned string. */ | |
54 | andq $-16, %r8 | |
55 | - pshufb %xmm2, %xmm1 | |
56 | movdqa (%r8), %xmm0 | |
57 | pcmpeqb %xmm0, %xmm2 | |
58 | pcmpeqb %xmm1, %xmm0 |