Blame sysdeps/x86_64/multiarch/strcat-sse2-unaligned.S
|
Packit Service |
82fcde |
/* strcat with SSE2
|
|
Packit Service |
82fcde |
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
Contributed by Intel Corporation.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if IS_IN (libc)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# include <sysdep.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# ifndef STRCAT
|
|
Packit Service |
82fcde |
# define STRCAT __strcat_sse2_unaligned
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# define USE_AS_STRCAT
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.text
|
|
Packit Service |
82fcde |
ENTRY (STRCAT)
|
|
Packit Service |
82fcde |
mov %rdi, %r9
|
|
Packit Service |
82fcde |
# ifdef USE_AS_STRNCAT
|
|
Packit Service |
82fcde |
mov %rdx, %r8
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Inline corresponding strlen file, temporary until new strcpy
|
|
Packit Service |
82fcde |
implementation gets merged. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
xor %rax, %rax
|
|
Packit Service |
82fcde |
mov %edi, %ecx
|
|
Packit Service |
82fcde |
and $0x3f, %ecx
|
|
Packit Service |
82fcde |
pxor %xmm0, %xmm0
|
|
Packit Service |
82fcde |
cmp $0x30, %ecx
|
|
Packit Service |
82fcde |
ja L(next)
|
|
Packit Service |
82fcde |
movdqu (%rdi), %xmm1
|
|
Packit Service |
82fcde |
pcmpeqb %xmm1, %xmm0
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit_less16)
|
|
Packit Service |
82fcde |
mov %rdi, %rax
|
|
Packit Service |
82fcde |
and $-16, %rax
|
|
Packit Service |
82fcde |
jmp L(align16_start)
|
|
Packit Service |
82fcde |
L(next):
|
|
Packit Service |
82fcde |
mov %rdi, %rax
|
|
Packit Service |
82fcde |
and $-16, %rax
|
|
Packit Service |
82fcde |
pcmpeqb (%rax), %xmm0
|
|
Packit Service |
82fcde |
mov $-1, %r10d
|
|
Packit Service |
82fcde |
sub %rax, %rcx
|
|
Packit Service |
82fcde |
shl %cl, %r10d
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
and %r10d, %edx
|
|
Packit Service |
82fcde |
jnz L(exit)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
L(align16_start):
|
|
Packit Service |
82fcde |
pxor %xmm0, %xmm0
|
|
Packit Service |
82fcde |
pxor %xmm1, %xmm1
|
|
Packit Service |
82fcde |
pxor %xmm2, %xmm2
|
|
Packit Service |
82fcde |
pxor %xmm3, %xmm3
|
|
Packit Service |
82fcde |
pcmpeqb 16(%rax), %xmm0
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit16)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 32(%rax), %xmm1
|
|
Packit Service |
82fcde |
pmovmskb %xmm1, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit32)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 48(%rax), %xmm2
|
|
Packit Service |
82fcde |
pmovmskb %xmm2, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit48)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 64(%rax), %xmm3
|
|
Packit Service |
82fcde |
pmovmskb %xmm3, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit64)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 80(%rax), %xmm0
|
|
Packit Service |
82fcde |
add $64, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit16)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 32(%rax), %xmm1
|
|
Packit Service |
82fcde |
pmovmskb %xmm1, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit32)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 48(%rax), %xmm2
|
|
Packit Service |
82fcde |
pmovmskb %xmm2, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit48)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 64(%rax), %xmm3
|
|
Packit Service |
82fcde |
pmovmskb %xmm3, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit64)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 80(%rax), %xmm0
|
|
Packit Service |
82fcde |
add $64, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit16)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 32(%rax), %xmm1
|
|
Packit Service |
82fcde |
pmovmskb %xmm1, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit32)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 48(%rax), %xmm2
|
|
Packit Service |
82fcde |
pmovmskb %xmm2, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit48)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 64(%rax), %xmm3
|
|
Packit Service |
82fcde |
pmovmskb %xmm3, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit64)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 80(%rax), %xmm0
|
|
Packit Service |
82fcde |
add $64, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit16)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 32(%rax), %xmm1
|
|
Packit Service |
82fcde |
pmovmskb %xmm1, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit32)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 48(%rax), %xmm2
|
|
Packit Service |
82fcde |
pmovmskb %xmm2, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit48)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 64(%rax), %xmm3
|
|
Packit Service |
82fcde |
pmovmskb %xmm3, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit64)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
test $0x3f, %rax
|
|
Packit Service |
82fcde |
jz L(align64_loop)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 80(%rax), %xmm0
|
|
Packit Service |
82fcde |
add $80, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
test $0x3f, %rax
|
|
Packit Service |
82fcde |
jz L(align64_loop)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 16(%rax), %xmm1
|
|
Packit Service |
82fcde |
add $16, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm1, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
test $0x3f, %rax
|
|
Packit Service |
82fcde |
jz L(align64_loop)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 16(%rax), %xmm2
|
|
Packit Service |
82fcde |
add $16, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm2, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
test $0x3f, %rax
|
|
Packit Service |
82fcde |
jz L(align64_loop)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 16(%rax), %xmm3
|
|
Packit Service |
82fcde |
add $16, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm3, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
add $16, %rax
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(align64_loop):
|
|
Packit Service |
82fcde |
movaps (%rax), %xmm4
|
|
Packit Service |
82fcde |
pminub 16(%rax), %xmm4
|
|
Packit Service |
82fcde |
movaps 32(%rax), %xmm5
|
|
Packit Service |
82fcde |
pminub 48(%rax), %xmm5
|
|
Packit Service |
82fcde |
add $64, %rax
|
|
Packit Service |
82fcde |
pminub %xmm4, %xmm5
|
|
Packit Service |
82fcde |
pcmpeqb %xmm0, %xmm5
|
|
Packit Service |
82fcde |
pmovmskb %xmm5, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jz L(align64_loop)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb -64(%rax), %xmm0
|
|
Packit Service |
82fcde |
sub $80, %rax
|
|
Packit Service |
82fcde |
pmovmskb %xmm0, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit16)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 32(%rax), %xmm1
|
|
Packit Service |
82fcde |
pmovmskb %xmm1, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit32)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 48(%rax), %xmm2
|
|
Packit Service |
82fcde |
pmovmskb %xmm2, %edx
|
|
Packit Service |
82fcde |
test %edx, %edx
|
|
Packit Service |
82fcde |
jnz L(exit48)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pcmpeqb 64(%rax), %xmm3
|
|
Packit Service |
82fcde |
pmovmskb %xmm3, %edx
|
|
Packit Service |
82fcde |
sub %rdi, %rax
|
|
Packit Service |
82fcde |
bsf %rdx, %rdx
|
|
Packit Service |
82fcde |
add %rdx, %rax
|
|
Packit Service |
82fcde |
add $64, %rax
|
|
Packit Service |
82fcde |
jmp L(StartStrcpyPart)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(exit):
|
|
Packit Service |
82fcde |
sub %rdi, %rax
|
|
Packit Service |
82fcde |
L(exit_less16):
|
|
Packit Service |
82fcde |
bsf %rdx, %rdx
|
|
Packit Service |
82fcde |
add %rdx, %rax
|
|
Packit Service |
82fcde |
jmp L(StartStrcpyPart)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(exit16):
|
|
Packit Service |
82fcde |
sub %rdi, %rax
|
|
Packit Service |
82fcde |
bsf %rdx, %rdx
|
|
Packit Service |
82fcde |
add %rdx, %rax
|
|
Packit Service |
82fcde |
add $16, %rax
|
|
Packit Service |
82fcde |
jmp L(StartStrcpyPart)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(exit32):
|
|
Packit Service |
82fcde |
sub %rdi, %rax
|
|
Packit Service |
82fcde |
bsf %rdx, %rdx
|
|
Packit Service |
82fcde |
add %rdx, %rax
|
|
Packit Service |
82fcde |
add $32, %rax
|
|
Packit Service |
82fcde |
jmp L(StartStrcpyPart)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(exit48):
|
|
Packit Service |
82fcde |
sub %rdi, %rax
|
|
Packit Service |
82fcde |
bsf %rdx, %rdx
|
|
Packit Service |
82fcde |
add %rdx, %rax
|
|
Packit Service |
82fcde |
add $48, %rax
|
|
Packit Service |
82fcde |
jmp L(StartStrcpyPart)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(exit64):
|
|
Packit Service |
82fcde |
sub %rdi, %rax
|
|
Packit Service |
82fcde |
bsf %rdx, %rdx
|
|
Packit Service |
82fcde |
add %rdx, %rax
|
|
Packit Service |
82fcde |
add $64, %rax
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.p2align 4
|
|
Packit Service |
82fcde |
L(StartStrcpyPart):
|
|
Packit Service |
82fcde |
lea (%r9, %rax), %rdi
|
|
Packit Service |
82fcde |
mov %rsi, %rcx
|
|
Packit Service |
82fcde |
mov %r9, %rax /* save result */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# ifdef USE_AS_STRNCAT
|
|
Packit Service |
82fcde |
test %r8, %r8
|
|
Packit Service |
82fcde |
jz L(ExitZero)
|
|
Packit Service |
82fcde |
# define USE_AS_STRNCPY
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# include "strcpy-sse2-unaligned.S"
|
|
Packit Service |
82fcde |
#endif
|