Blame sysdeps/i386/i686/multiarch/wcslen-sse2.S
|
Packit |
6c4009 |
/* wcslen with SSE2
|
|
Packit |
6c4009 |
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
Contributed by Intel Corporation.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if IS_IN (libc)
|
|
Packit |
6c4009 |
# include <sysdep.h>
|
|
Packit |
6c4009 |
# define STR 4
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.text
|
|
Packit |
6c4009 |
ENTRY (__wcslen_sse2)
|
|
Packit |
6c4009 |
mov STR(%esp), %edx
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
cmp $0, (%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail0)
|
|
Packit |
6c4009 |
cmp $0, 4(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail1)
|
|
Packit |
6c4009 |
cmp $0, 8(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail2)
|
|
Packit |
6c4009 |
cmp $0, 12(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail3)
|
|
Packit |
6c4009 |
cmp $0, 16(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail4)
|
|
Packit |
6c4009 |
cmp $0, 20(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail5)
|
|
Packit |
6c4009 |
cmp $0, 24(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail6)
|
|
Packit |
6c4009 |
cmp $0, 28(%edx)
|
|
Packit |
6c4009 |
jz L(exit_tail7)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pxor %xmm0, %xmm0
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
lea 32(%edx), %eax
|
|
Packit |
6c4009 |
lea 16(%edx), %ecx
|
|
Packit |
6c4009 |
and $-16, %eax
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd (%eax), %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %edx
|
|
Packit |
6c4009 |
pxor %xmm1, %xmm1
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea 16(%eax), %eax
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd (%eax), %xmm1
|
|
Packit |
6c4009 |
pmovmskb %xmm1, %edx
|
|
Packit |
6c4009 |
pxor %xmm2, %xmm2
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea 16(%eax), %eax
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd (%eax), %xmm2
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pxor %xmm3, %xmm3
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea 16(%eax), %eax
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd (%eax), %xmm3
|
|
Packit |
6c4009 |
pmovmskb %xmm3, %edx
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea 16(%eax), %eax
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
and $-0x40, %eax
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(aligned_64_loop):
|
|
Packit |
6c4009 |
movaps (%eax), %xmm0
|
|
Packit |
6c4009 |
movaps 16(%eax), %xmm1
|
|
Packit |
6c4009 |
movaps 32(%eax), %xmm2
|
|
Packit |
6c4009 |
movaps 48(%eax), %xmm6
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pminub %xmm1, %xmm0
|
|
Packit |
6c4009 |
pminub %xmm6, %xmm2
|
|
Packit |
6c4009 |
pminub %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm3, %xmm2
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea 64(%eax), %eax
|
|
Packit |
6c4009 |
jz L(aligned_64_loop)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd -64(%eax), %xmm3
|
|
Packit |
6c4009 |
pmovmskb %xmm3, %edx
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea 48(%ecx), %ecx
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm3
|
|
Packit |
6c4009 |
pmovmskb %xmm3, %edx
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea -16(%ecx), %ecx
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd -32(%eax), %xmm3
|
|
Packit |
6c4009 |
pmovmskb %xmm3, %edx
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea -16(%ecx), %ecx
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pcmpeqd %xmm6, %xmm3
|
|
Packit |
6c4009 |
pmovmskb %xmm3, %edx
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
lea -16(%ecx), %ecx
|
|
Packit |
6c4009 |
jnz L(exit)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
jmp L(aligned_64_loop)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit):
|
|
Packit |
6c4009 |
sub %ecx, %eax
|
|
Packit |
6c4009 |
shr $2, %eax
|
|
Packit |
6c4009 |
test %dl, %dl
|
|
Packit |
6c4009 |
jz L(exit_high)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov %dl, %cl
|
|
Packit |
6c4009 |
and $15, %cl
|
|
Packit |
6c4009 |
jz L(exit_1)
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_high):
|
|
Packit |
6c4009 |
mov %dh, %ch
|
|
Packit |
6c4009 |
and $15, %ch
|
|
Packit |
6c4009 |
jz L(exit_3)
|
|
Packit |
6c4009 |
add $2, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_1):
|
|
Packit |
6c4009 |
add $1, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_3):
|
|
Packit |
6c4009 |
add $3, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail0):
|
|
Packit |
6c4009 |
xor %eax, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail1):
|
|
Packit |
6c4009 |
mov $1, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail2):
|
|
Packit |
6c4009 |
mov $2, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail3):
|
|
Packit |
6c4009 |
mov $3, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail4):
|
|
Packit |
6c4009 |
mov $4, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail5):
|
|
Packit |
6c4009 |
mov $5, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail6):
|
|
Packit |
6c4009 |
mov $6, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit_tail7):
|
|
Packit |
6c4009 |
mov $7, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
END (__wcslen_sse2)
|
|
Packit |
6c4009 |
#endif
|