Define write_profiling functions only in profile library [BZ #31756]
[glibc.git] / sysdeps / alpha / alphaev67 / strcat.S
blob43d224bb88aa11dd7abd195273199348b00675b8
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.  */
20 #include <sysdep.h>
22         .arch ev6
23         .set noreorder
24         .text
26 ENTRY(strcat)
27         ldgp    gp, 0(pv)
28 #ifdef PROF
29         .set noat
30         lda     AT, _mcount
31         jsr     AT, (AT), _mcount
32         .set at
33 #endif
34         .prologue 1
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)
39         lda     $2, -1          # E :
40         insqh   $2, $16, $2     # U :
42         andnot  $16, 7, $16     # E :
43         or      $2, $1, $1      # E :
44         cmpbge  $31, $1, $2     # E : bits set iff byte == 0
45         bne     $2, $found      # U :
47 $loop:  ldq     $1, 8($16)      # L :
48         addq    $16, 8, $16     # E :
49         cmpbge  $31, $1, $2     # E :
50         beq     $2, $loop       # U :
52 $found: cttz    $2, $3          # U0 :
53         addq    $16, $3, $16    # E :
54         /* Now do the append.  */
55         mov     $26, $23        # E :
56         jmp     $31, __stxcpy   # L0 :
58         END(strcat)
59 libc_hidden_builtin_def (strcat)