Improve 64 bit strcat functions with SSE2/SSSE3
[platform/upstream/glibc.git] / sysdeps / x86_64 / multiarch / strcat-sse2-unaligned.S
1 /* strcat with SSE2
2    Copyright (C) 2011 Free Software Foundation, Inc.
3    Contributed by Intel Corporation.
4    This file is part of the GNU C Library.
5
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, write to the Free
18    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA.  */
20
21 #ifndef NOT_IN_libc
22
23 # include <sysdep.h>
24
25 # ifndef STRCAT
26 #  define STRCAT  __strcat_sse2_unaligned
27 # endif
28
29 # define USE_AS_STRCAT
30
31 .text
32 ENTRY (STRCAT)
33         mov     %rdi, %r9
34 # ifdef USE_AS_STRNCAT
35         mov     %rdx, %r8
36 # endif
37
38 # define RETURN  jmp L(StartStrcpyPart)
39 # include "strlen-sse2-pminub.S"
40 # undef RETURN
41
42 L(StartStrcpyPart):
43         lea     (%r9, %rax), %rdi
44         mov     %rsi, %rcx
45         mov     %r9, %rax      /* save result */
46
47 # ifdef USE_AS_STRNCAT
48         test    %r8, %r8
49         jz      L(ExitZero)
50 #  define USE_AS_STRNCPY
51 # endif
52
53 # include "strcpy-sse2-unaligned.S"
54 #endif
55