Add missing bz number.
[glibc.git] / sysdeps / x86_64 / rawmemchr.S
blobcfb4cebf68910d069f19f9ceb9fce2afe72cfddb
1 /* Copyright (C) 2009 Free Software Foundation, Inc.
2    Contributed by Ulrich Drepper <drepper@redhat.com>.
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, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
20 #include <sysdep.h>
23         .text
24 ENTRY (rawmemchr)
25         movd    %esi, %xmm1
26         movq    %rdi, %rcx
27         punpcklbw %xmm1, %xmm1
28         andq    $~15, %rdi
29         punpcklbw %xmm1, %xmm1
30         orl     $0xffffffff, %esi
31         movdqa  (%rdi), %xmm0
32         pshufd  $0, %xmm1, %xmm1
33         subq    %rdi, %rcx
34         pcmpeqb %xmm1, %xmm0
35         shl     %cl, %esi
36         pmovmskb %xmm0, %ecx
37         andl    %esi, %ecx
38         jnz     1f
40 2:      movdqa  16(%rdi), %xmm0
41         leaq    16(%rdi), %rdi
42         pcmpeqb %xmm1, %xmm0
43         pmovmskb %xmm0, %ecx
44         testl   %ecx, %ecx
45         jz      2b
47 1:      bsfl    %ecx, %eax
48         addq    %rdi, %rax
49         ret
50 END (rawmemchr)
52 strong_alias (rawmemchr, __rawmemchr)
53 libc_hidden_builtin_def (__rawmemchr)