1 /* Copyright (C) 2000-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
18 /* Append a null-terminated string from SRC to DST. */
36 mov $16, $0 # E : set up return value
37 /* Find the end of the string. */
38 ldq_u $1, 0($16) # L : load first quadword (a0 may be misaligned)
40 insqh $2, $16, $2 # U :
42 andnot $16, 7, $16 # E :
44 cmpbge $31, $1, $2 # E : bits set iff byte == 0
47 $loop: ldq $1, 8($16) # L :
48 addq $16, 8, $16 # E :
49 cmpbge $31, $1, $2 # E :
52 $found: cttz $2, $3 # U0 :
53 addq $16, $3, $16 # E :
54 /* Now do the append. */
56 jmp $31, __stxcpy # L0 :
59 libc_hidden_builtin_def (strcat)