Fix whitespace issue.
[glibc.git] / sysdeps / x86_64 / strchrnul.S
blob576027a38dcaf5597f73d93f352ae9d1f76d4778
1 /* strchrnul (str, ch) -- Return pointer to first occurrence of CH in STR
2         or terminating NUL byte.
3    For AMD x86-64.
4    Copyright (C) 2009 Free Software Foundation, Inc.
5    This file is part of the GNU C Library.
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public
9    License as published by the Free Software Foundation; either
10    version 2.1 of the License, or (at your option) any later version.
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
17    You should have received a copy of the GNU Lesser General Public
18    License along with the GNU C Library; if not, write to the Free
19    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20    02111-1307 USA.  */
22 #include <sysdep.h>
25         .text
26 ENTRY (__strchrnul)
27         movd    %esi, %xmm1
28         movq    %rdi, %rcx
29         punpcklbw %xmm1, %xmm1
30         andq    $~15, %rdi
31         pxor    %xmm2, %xmm2
32         punpcklbw %xmm1, %xmm1
33         orl     $0xffffffff, %esi
34         movdqa  (%rdi), %xmm0
35         pshufd  $0, %xmm1, %xmm1
36         subq    %rdi, %rcx
37         movdqa  %xmm0, %xmm3
38         leaq    16(%rdi), %rdi
39         pcmpeqb %xmm1, %xmm0
40         pcmpeqb %xmm2, %xmm3
41         shl     %cl, %esi
42         pmovmskb %xmm0, %edx
43         pmovmskb %xmm3, %ecx
44         orl     %edx, %ecx
45         andl    %esi, %ecx
46         jnz     1f
48 2:      movdqa  (%rdi), %xmm0
49         leaq    16(%rdi), %rdi
50         movdqa  %xmm0, %xmm3
51         pcmpeqb %xmm1, %xmm0
52         pcmpeqb %xmm2, %xmm3
53         pmovmskb %xmm0, %edx
54         pmovmskb %xmm3, %ecx
55         orl     %edx, %ecx
56         jz      2b
58 1:      bsfl    %ecx, %edx
59         leaq    -16(%rdi,%rdx), %rax
60         ret
61 END (__strchrnul)
63 weak_alias (__strchrnul, strchrnul)