Blame sysdeps/i386/i686/multiarch/wcschr-sse2.S
|
Packit |
6c4009 |
/* wcschr with SSE2, without using bsf instructions
|
|
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 |
|
|
Packit |
6c4009 |
# define CFI_PUSH(REG) \
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (4); \
|
|
Packit |
6c4009 |
cfi_rel_offset (REG, 0)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define CFI_POP(REG) \
|
|
Packit |
6c4009 |
cfi_adjust_cfa_offset (-4); \
|
|
Packit |
6c4009 |
cfi_restore (REG)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define PUSH(REG) pushl REG; CFI_PUSH (REG)
|
|
Packit |
6c4009 |
# define POP(REG) popl REG; CFI_POP (REG)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define PARMS 4
|
|
Packit |
6c4009 |
# define STR1 PARMS
|
|
Packit |
6c4009 |
# define STR2 STR1+4
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
atom_text_section
|
|
Packit |
6c4009 |
ENTRY (__wcschr_sse2)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov STR1(%esp), %ecx
|
|
Packit |
6c4009 |
movd STR2(%esp), %xmm1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mov %ecx, %eax
|
|
Packit |
6c4009 |
punpckldq %xmm1, %xmm1
|
|
Packit |
6c4009 |
pxor %xmm2, %xmm2
|
|
Packit |
6c4009 |
punpckldq %xmm1, %xmm1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
and $63, %eax
|
|
Packit |
6c4009 |
cmp $48, %eax
|
|
Packit |
6c4009 |
ja L(cross_cache)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
movdqu (%ecx), %xmm0
|
|
Packit |
6c4009 |
pcmpeqd %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %eax
|
|
Packit |
6c4009 |
or %eax, %edx
|
|
Packit |
6c4009 |
jnz L(matches)
|
|
Packit |
6c4009 |
and $-16, %ecx
|
|
Packit |
6c4009 |
jmp L(loop)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(cross_cache):
|
|
Packit |
6c4009 |
PUSH (%edi)
|
|
Packit |
6c4009 |
mov %ecx, %edi
|
|
Packit |
6c4009 |
mov %eax, %ecx
|
|
Packit |
6c4009 |
and $-16, %edi
|
|
Packit |
6c4009 |
and $15, %ecx
|
|
Packit |
6c4009 |
movdqa (%edi), %xmm0
|
|
Packit |
6c4009 |
pcmpeqd %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %eax
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
sarl %cl, %edx
|
|
Packit |
6c4009 |
sarl %cl, %eax
|
|
Packit |
6c4009 |
test %eax, %eax
|
|
Packit |
6c4009 |
jz L(unaligned_no_match)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
add %edi, %ecx
|
|
Packit |
6c4009 |
POP (%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
jz L(match_case1)
|
|
Packit |
6c4009 |
test %al, %al
|
|
Packit |
6c4009 |
jz L(match_higth_case2)
|
|
Packit |
6c4009 |
test $15, %al
|
|
Packit |
6c4009 |
jnz L(match_case2_4)
|
|
Packit |
6c4009 |
test $15, %dl
|
|
Packit |
6c4009 |
jnz L(return_null)
|
|
Packit |
6c4009 |
lea 4(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
CFI_PUSH (%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(unaligned_no_match):
|
|
Packit |
6c4009 |
mov %edi, %ecx
|
|
Packit |
6c4009 |
POP (%edi)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
jnz L(return_null)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
pxor %xmm2, %xmm2
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Loop start on aligned string. */
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(loop):
|
|
Packit |
6c4009 |
add $16, %ecx
|
|
Packit |
6c4009 |
movdqa (%ecx), %xmm0
|
|
Packit |
6c4009 |
pcmpeqd %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %eax
|
|
Packit |
6c4009 |
or %eax, %edx
|
|
Packit |
6c4009 |
jnz L(matches)
|
|
Packit |
6c4009 |
add $16, %ecx
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
movdqa (%ecx), %xmm0
|
|
Packit |
6c4009 |
pcmpeqd %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %eax
|
|
Packit |
6c4009 |
or %eax, %edx
|
|
Packit |
6c4009 |
jnz L(matches)
|
|
Packit |
6c4009 |
add $16, %ecx
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
movdqa (%ecx), %xmm0
|
|
Packit |
6c4009 |
pcmpeqd %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %eax
|
|
Packit |
6c4009 |
or %eax, %edx
|
|
Packit |
6c4009 |
jnz L(matches)
|
|
Packit |
6c4009 |
add $16, %ecx
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
movdqa (%ecx), %xmm0
|
|
Packit |
6c4009 |
pcmpeqd %xmm0, %xmm2
|
|
Packit |
6c4009 |
pcmpeqd %xmm1, %xmm0
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
pmovmskb %xmm0, %eax
|
|
Packit |
6c4009 |
or %eax, %edx
|
|
Packit |
6c4009 |
jz L(loop)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(matches):
|
|
Packit |
6c4009 |
pmovmskb %xmm2, %edx
|
|
Packit |
6c4009 |
test %eax, %eax
|
|
Packit |
6c4009 |
jz L(return_null)
|
|
Packit |
6c4009 |
test %edx, %edx
|
|
Packit |
6c4009 |
jz L(match_case1)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(match_case2):
|
|
Packit |
6c4009 |
test %al, %al
|
|
Packit |
6c4009 |
jz L(match_higth_case2)
|
|
Packit |
6c4009 |
test $15, %al
|
|
Packit |
6c4009 |
jnz L(match_case2_4)
|
|
Packit |
6c4009 |
test $15, %dl
|
|
Packit |
6c4009 |
jnz L(return_null)
|
|
Packit |
6c4009 |
lea 4(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(match_case2_4):
|
|
Packit |
6c4009 |
mov %ecx, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(match_higth_case2):
|
|
Packit |
6c4009 |
test %dl, %dl
|
|
Packit |
6c4009 |
jnz L(return_null)
|
|
Packit |
6c4009 |
test $15, %ah
|
|
Packit |
6c4009 |
jnz L(match_case2_12)
|
|
Packit |
6c4009 |
test $15, %dh
|
|
Packit |
6c4009 |
jnz L(return_null)
|
|
Packit |
6c4009 |
lea 12(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(match_case2_12):
|
|
Packit |
6c4009 |
lea 8(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(match_case1):
|
|
Packit |
6c4009 |
test %al, %al
|
|
Packit |
6c4009 |
jz L(match_higth_case1)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
test $0x01, %al
|
|
Packit |
6c4009 |
jnz L(exit0)
|
|
Packit |
6c4009 |
lea 4(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(match_higth_case1):
|
|
Packit |
6c4009 |
test $0x01, %ah
|
|
Packit |
6c4009 |
jnz L(exit3)
|
|
Packit |
6c4009 |
lea 12(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit0):
|
|
Packit |
6c4009 |
mov %ecx, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(exit3):
|
|
Packit |
6c4009 |
lea 8(%ecx), %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.p2align 4
|
|
Packit |
6c4009 |
L(return_null):
|
|
Packit |
6c4009 |
xor %eax, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
END (__wcschr_sse2)
|
|
Packit |
6c4009 |
#endif
|