* po/ca.po: Update from translation team.
[glibc.git] / sysdeps / x86_64 / rawmemchr.S
blobc3bd771635b7a9c0cad9e40a98cd40edf3fa42c7
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         leaq    16(%rdi), %rdi
38         andl    %esi, %ecx
39         jnz     1f
41 2:      movdqa  (%rdi), %xmm0
42         leaq    16(%rdi), %rdi
43         pcmpeqb %xmm1, %xmm0
44         pmovmskb %xmm0, %ecx
45         testl   %ecx, %ecx
46         jz      2b
48 1:      bsfl    %ecx, %ecx
49         leaq    -16(%rcx,%rdi), %rax
50         ret
51 END (rawmemchr)
53 strong_alias (rawmemchr, __rawmemchr)
54 libc_hidden_builtin_def (__rawmemchr)