Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
git-mirror
/
glibc
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security
Insights
Files
6d18b67
abilist
aout
argp
assert
bits
catgets
conf
conform
crypt
csu
ctype
debug
dirent
dlfcn
elf
gmon
gnulib
grp
gshadow
hesiod
hurd
iconv
iconvdata
include
inet
intl
io
libidn
libio
locale
localedata
login
mach
malloc
manual
math
misc
nis
nptl
nptl_db
nscd
nss
po
posix
pwd
resolv
resource
rt
scripts
setjmp
shadow
signal
socket
soft-fp
stdio-common
stdlib
streams
string
sunrpc
sysdeps
generic
gnu
i386
ia64
ieee754
mach
posix
powerpc
pthread
s390
sh
sparc
unix
wordsize-32
wordsize-64
x86_64
bits
elf
fpu
multiarch
Makefile
Versions
bcopy.S
bzero.S
cacheinfo.c
ifunc-defines.sym
init-arch.c
init-arch.h
memcmp-sse4.S
memcmp.S
memcpy-ssse3-back.S
memcpy-ssse3.S
memcpy.S
memcpy_chk.S
memmove-ssse3-back.S
memmove-ssse3.S
memmove.c
memmove_chk.c
mempcpy-ssse3-back.S
mempcpy-ssse3.S
mempcpy.S
mempcpy_chk.S
memset-x86-64.S
memset.S
memset_chk.S
rawmemchr.S
rtld-memcmp.c
rtld-strlen.S
s_fma.c
s_fmaf.c
sched_cpucount.c
stpcpy-sse2-unaligned.S
stpcpy-ssse3.S
stpcpy.S
stpncpy-c.c
stpncpy-sse2-unaligned.S
stpncpy-ssse3.S
stpncpy.S
strcasecmp_l-ssse3.S
strcasecmp_l.S
strcasestr-c.c
strcasestr-nonascii.c
strcasestr.c
strcat-sse2-unaligned.S
strcat-ssse3.S
strcat.S
strchr-sse2-no-bsf.S
strchr.S
strcmp-ssse3.S
strcmp.S
strcpy-sse2-unaligned.S
strcpy-ssse3.S
strcpy.S
strcspn-c.c
strcspn.S
strend-sse4.S
strlen-no-bsf.S
strlen-sse2-pminub.S
strlen-sse4.S
strlen.S
strncase_l-ssse3.S
strncase_l.S
strncat-c.c
strncat-sse2-unaligned.S
strncat-ssse3.S
strncat.S
strncmp-ssse3.S
strncmp.S
strncpy-c.c
strncpy-sse2-unaligned.S
strncpy-ssse3.S
strncpy.S
strpbrk-c.c
strpbrk.S
strrchr-sse2-no-bsf.S
strrchr.S
strspn-c.c
strspn.S
strstr-c.c
strstr.c
varshift.c
varshift.h
Implies
Makefile
Versions
____longjmp_chk.S
__longjmp.S
_mcount.S
abort-instr.h
add_n.S
addmul_1.S
backtrace.c
bp-asm.h
bsd-_setjmp.S
bsd-setjmp.S
bzero.S
cacheinfo.c
configure
dl-irel.h
dl-lookupcfg.h
dl-machine.h
dl-runtime.c
dl-tls.h
dl-tlsdesc.S
dl-tlsdesc.h
dl-trampoline.S
dl-trampoline.h
ffs.c
ffsll.c
fpu_control.h
hp-timing.c
hp-timing.h
htonl.S
jmpbuf-offsets.h
jmpbuf-unwind.h
l10nflist.c
ldbl2mpn.c
link-defines.sym
locale-defines.sym
lshift.S
machine-gmon.h
memchr.S
memcmp.S
memcpy.S
memcpy_chk.S
memmove.c
mempcpy.S
mempcpy_chk.S
memset.S
memset_chk.S
memusage.h
mp_clz_tab.c
mul_1.S
rawmemchr.S
rshift.S
rtld-memcmp.c
rtld-memset.c
rtld-strchr.S
rtld-strlen.S
sched_cpucount.c
setjmp.S
stackinfo.h
stpcpy.S
stpcpy_chk.S
strcasecmp.S
strcasecmp_l-nonascii.c
strcasecmp_l.S
strcat.S
strchr.S
strchrnul.S
strcmp.S
strcpy.S
strcpy_chk.S
strcspn.S
strlen.S
strncase.S
strncase_l-nonascii.c
strncase_l.S
strncmp.S
strnlen.S
strpbrk.S
strrchr.S
strspn.S
strtok.S
strtok_r.S
sub_n.S
submul_1.S
sysdep.h
tlsdesc.c
tlsdesc.sym
tst-stack-align.h
tst-xmmymm.sh
wcscmp.S
sysvipc
termios
time
timezone
wcsmbs
wctype
.gitattributes
.gitignore
BUGS
CANCEL-FCT-WAIVE
CANCEL-FILE-WAIVE
CONFORMANCE
COPYING
COPYING.LIB
ChangeLog
ChangeLog.1
ChangeLog.10
ChangeLog.11
ChangeLog.12
ChangeLog.13
ChangeLog.14
ChangeLog.15
ChangeLog.16
ChangeLog.17
ChangeLog.2
ChangeLog.3
ChangeLog.4
ChangeLog.5
ChangeLog.6
ChangeLog.7
ChangeLog.8
ChangeLog.9
FAQ
FAQ.in
INSTALL
LICENSES
Makeconfig
Makefile
Makefile.in
Makerules
NAMESPACE
NEWS
NOTES
PROJECTS
README
README.libm
Rules
Versions.def
WUR-REPORT
abi-tags
aclocal.m4
config.h.in
config.make.in
configure
configure.in
cppflags-iterator.mk
extra-lib.mk
extra-modules.mk
libc-abis
o-iterator.mk
shlib-versions
test-skeleton.c
tls.make.c
version.h
Breadcrumbs
glibc
/
sysdeps
/
x86_64
/
multiarch
/
strchr-sse2-no-bsf.S
Blame
Blame
Latest commit
History
History
281 lines (243 loc) · 4.43 KB
Breadcrumbs
glibc
/
sysdeps
/
x86_64
/
multiarch
/
strchr-sse2-no-bsf.S
Top
File metadata and controls
Code
Blame
281 lines (243 loc) · 4.43 KB
Raw
/* strchr with SSE2 without bsf Copyright (C) 2011 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef NOT_IN_libc # include <sysdep.h> # include "asm-syntax.h" .text ENTRY (__strchr_sse2_no_bsf) movd %esi, %xmm1 movq %rdi, %rcx punpcklbw %xmm1, %xmm1 andq $~15, %rdi pxor %xmm2, %xmm2 punpcklbw %xmm1, %xmm1 orl $0xffffffff, %esi movdqa (%rdi), %xmm0 pshufd $0, %xmm1, %xmm1 subq %rdi, %rcx movdqa %xmm0, %xmm3 leaq 16(%rdi), %rdi pcmpeqb %xmm1, %xmm0 pcmpeqb %xmm2, %xmm3 shl %cl, %esi pmovmskb %xmm0, %eax pmovmskb %xmm3, %edx andl %esi, %eax andl %esi, %edx test %eax, %eax jnz L(matches) test %edx, %edx jnz L(return_null) L(loop): movdqa (%rdi), %xmm0 leaq 16(%rdi), %rdi movdqa %xmm0, %xmm3 pcmpeqb %xmm1, %xmm0 pcmpeqb %xmm2, %xmm3 pmovmskb %xmm0, %eax pmovmskb %xmm3, %edx or %eax, %edx jz L(loop) pmovmskb %xmm3, %edx test %eax, %eax jnz L(matches) /* Return NULL. */ .p2align 4 L(return_null): xor %rax, %rax ret L(matches): /* There is a match. First find where NULL is. */ leaq -16(%rdi), %rdi test %edx, %edx jz L(match_case1) .p2align 4 L(match_case2): test %al, %al jz L(match_high_case2) mov %al, %cl and $15, %cl jnz L(match_case2_4) mov %dl, %ch and $15, %ch jnz L(return_null) test $0x10, %al jnz L(Exit5) test $0x10, %dl jnz L(return_null) test $0x20, %al jnz L(Exit6) test $0x20, %dl jnz L(return_null) test $0x40, %al jnz L(Exit7) test $0x40, %dl jnz L(return_null) lea 7(%rdi), %rax ret .p2align 4 L(match_case2_4): test $0x01, %al jnz L(Exit1) test $0x01, %dl jnz L(return_null) test $0x02, %al jnz L(Exit2) test $0x02, %dl jnz L(return_null) test $0x04, %al jnz L(Exit3) test $0x04, %dl jnz L(return_null) lea 3(%rdi), %rax ret .p2align 4 L(match_high_case2): test %dl, %dl jnz L(return_null) mov %ah, %cl and $15, %cl jnz L(match_case2_12) mov %dh, %ch and $15, %ch jnz L(return_null) test $0x10, %ah jnz L(Exit13) test $0x10, %dh jnz L(return_null) test $0x20, %ah jnz L(Exit14) test $0x20, %dh jnz L(return_null) test $0x40, %ah jnz L(Exit15) test $0x40, %dh jnz L(return_null) lea 15(%rdi), %rax ret .p2align 4 L(match_case2_12): test $0x01, %ah jnz L(Exit9) test $0x01, %dh jnz L(return_null) test $0x02, %ah jnz L(Exit10) test $0x02, %dh jnz L(return_null) test $0x04, %ah jnz L(Exit11) test $0x04, %dh jnz L(return_null) lea 11(%rdi), %rax ret .p2align 4 L(match_case1): test %al, %al jz L(match_high_case1) test $0x01, %al jnz L(Exit1) test $0x02, %al jnz L(Exit2) test $0x04, %al jnz L(Exit3) test $0x08, %al jnz L(Exit4) test $0x10, %al jnz L(Exit5) test $0x20, %al jnz L(Exit6) test $0x40, %al jnz L(Exit7) lea 7(%rdi), %rax ret .p2align 4 L(match_high_case1): test $0x01, %ah jnz L(Exit9) test $0x02, %ah jnz L(Exit10) test $0x04, %ah jnz L(Exit11) test $0x08, %ah jnz L(Exit12) test $0x10, %ah jnz L(Exit13) test $0x20, %ah jnz L(Exit14) test $0x40, %ah jnz L(Exit15) lea 15(%rdi), %rax ret .p2align 4 L(Exit1): lea (%rdi), %rax ret .p2align 4 L(Exit2): lea 1(%rdi), %rax ret .p2align 4 L(Exit3): lea 2(%rdi), %rax ret .p2align 4 L(Exit4): lea 3(%rdi), %rax ret .p2align 4 L(Exit5): lea 4(%rdi), %rax ret .p2align 4 L(Exit6): lea 5(%rdi), %rax ret .p2align 4 L(Exit7): lea 6(%rdi), %rax ret .p2align 4 L(Exit9): lea 8(%rdi), %rax ret .p2align 4 L(Exit10): lea 9(%rdi), %rax ret .p2align 4 L(Exit11): lea 10(%rdi), %rax ret .p2align 4 L(Exit12): lea 11(%rdi), %rax ret .p2align 4 L(Exit13): lea 12(%rdi), %rax ret .p2align 4 L(Exit14): lea 13(%rdi), %rax ret .p2align 4 L(Exit15): lea 14(%rdi), %rax ret END (__strchr_sse2_no_bsf) #endif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
You can’t perform that action at this time.