1 /* strcat (dest, src) -- Append SRC on the end of DEST.
3 Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
25 to find out if any byte in xword could be zero. This is fast, but
26 also gives false alarm for any byte in range 0x81-0xff. It does
27 not matter for correctness, as if this test tells us there could
28 be some zero byte, we check it byte by byte, but if bytes with
29 high bits set are common in the strings, then this will give poor
30 performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
31 will use one tick slower, but more precise test
32 ((xword - 0x01010101) & (~xword) & 0x80808080),
33 which does not give any false alarms (but if some bits are set,
34 one cannot assume from it which bytes are zero and which are not).
35 It is yet to be measured, what is the correct default for glibc
36 in these days for an average user.
46 sethi %hi(0x80808080), %o4
54 or %o4, %lo(0x80808080), %o3
61 sethi %hi(0x01010101), %o4
67 or %o4, %lo(0x01010101), %o2
68 1: or %o4, %lo(0x80808080), %o3
69 2: sethi %hi(0x01010101), %o4
70 3: or %o4, %lo(0x01010101), %o2
74 30: or %o4, %lo(0x80808080), %o3
75 7: sethi %hi(0x01010101), %o4
76 8: or %o4, %lo(0x01010101), %o2
79 #ifdef EIGHTBIT_NOT_RARE
126 12: andcc %o5, 0xff, %o5
141 #ifdef EIGHTBIT_NOT_RARE
172 1: stb %g0, [%o0 - 4]
195 #ifdef EIGHTBIT_NOT_RARE
230 5: andcc %g5, 0xff, %g4
250 2: andcc %o4, %o3, %g0
261 #ifdef EIGHTBIT_NOT_RARE
276 1: andcc %o4, 0xff, %g0
291 8: stb %g0, [%o0 + 4]
317 #ifdef EIGHTBIT_NOT_RARE
328 1: andcc %o4, 0xff, %g0
345 5: andcc %g5, 0xff, %g0
353 libc_hidden_builtin_def (strcat)