]>
Commit | Line | Data |
---|---|---|
45327bf7 UD |
1 | /* Copyright (C) 2000 Free Software Foundation, Inc. |
2 | Contributed by Richard Henderson <rth@tamu.edu>, 1996. | |
3 | EV67 optimized by Rick Gorton <rick.gorton@alpha-processor.com>. | |
4 | ||
5 | This file is part of the GNU C Library. | |
6 | ||
7 | The GNU C Library is free software; you can redistribute it and/or | |
8 | modify it under the terms of the GNU Library General Public License as | |
9 | published by the Free Software Foundation; either version 2 of the | |
10 | License, or (at your option) any later version. | |
11 | ||
12 | The GNU C Library is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | Library General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU Library General Public | |
18 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
19 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | /* Append a null-terminated string from SRC to DST. */ | |
23 | ||
24 | #include <sysdep.h> | |
25 | ||
26 | .arch ev6 | |
27 | .set noreorder | |
28 | .text | |
29 | ||
30 | ENTRY(strcat) | |
31 | ldgp gp, 0(pv) | |
32 | #ifdef PROF | |
33 | .set noat | |
34 | lda AT, _mcount | |
35 | jsr AT, (AT), _mcount | |
36 | .set at | |
37 | #endif | |
38 | .prologue 1 | |
39 | ||
40 | mov $16, $0 # E : set up return value | |
41 | /* Find the end of the string. */ | |
42 | ldq_u $1, 0($16) # L : load first quadword (a0 may be misaligned) | |
43 | lda $2, -1 # E : | |
44 | insqh $2, $16, $2 # U : | |
45 | ||
46 | andnot $16, 7, $16 # E : | |
47 | or $2, $1, $1 # E : | |
48 | cmpbge $31, $1, $2 # E : bits set iff byte == 0 | |
49 | bne $2, $found # U : | |
50 | ||
51 | $loop: ldq $1, 8($16) # L : | |
52 | addq $16, 8, $16 # E : | |
53 | cmpbge $31, $1, $2 # E : | |
54 | beq $2, $loop # U : | |
55 | ||
56 | $found: cttz $2, $3 # U0 : | |
57 | addq $16, $3, $16 # E : | |
58 | /* Now do the append. */ | |
59 | mov $26, $23 # E : | |
60 | jmp $31, __stxcpy # L0 : | |
61 | ||
62 | END(strcat) |