1 /* Copyright (C) 2011-2015 Free Software Foundation, Inc.
2 Contributed by Intel Corporation.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
21 /* fast SSE2 version with using pmaxub and 64 byte loop */
28 punpcklbw %xmm1, %xmm1
31 punpcklbw %xmm1, %xmm1
34 pshufd $0, %xmm1, %xmm1
62 /* Check if there is a match. */
64 /* Remove the leading bytes. */
67 je L(unaligned_no_match)
68 /* Check which byte is a match. */
78 L(unaligned_no_match):
94 movdqa 16(%rdi), %xmm2
100 movdqa 32(%rdi), %xmm3
106 movdqa 48(%rdi), %xmm4
125 movdqa 16(%rdi), %xmm2
131 movdqa 32(%rdi), %xmm3
137 movdqa 48(%rdi), %xmm3
155 movdqa 16(%rdi), %xmm2
156 movdqa 32(%rdi), %xmm3
157 movdqa 48(%rdi), %xmm4
184 movdqa 32(%rdi), %xmm3
187 pcmpeqb 48(%rdi), %xmm1
194 lea 48(%rdi, %rax), %rax
208 movdqa 16(%rdi), %xmm2
214 movdqa 32(%rdi), %xmm3
222 pcmpeqb 48(%rdi), %xmm1
240 pcmpeqb 16(%rdi), %xmm1
250 lea -16(%rax, %rdi), %rax
262 lea 16(%rax, %rdi), %rax
268 lea 32(%rax, %rdi), %rax
284 lea 16(%rdi, %rax), %rax
292 lea 32(%rdi, %rax), %rax
300 lea 48(%rdi, %rax), %rax
309 strong_alias (memchr, __memchr)
311 libc_hidden_builtin_def(memchr)