|
|
bca718 |
Backport of the following patch as a prerequistite for
|
|
|
bca718 |
96d6fd6c4060d739abb1822e7ad633af749532b2:
|
|
|
bca718 |
commit 69f13dbf06c6195de0ada8632271d58ca3cf55da
|
|
|
bca718 |
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
bca718 |
Date: Thu Sep 26 09:29:19 2013 -0500
|
|
|
bca718 |
|
|
|
bca718 |
PowerPC: strcpy/stpcpy optimization for PPC64/POWER7
|
|
|
bca718 |
|
|
|
bca718 |
This patch intends to unify both strcpy and stpcpy implementationsi
|
|
|
bca718 |
for PPC64 and PPC64/POWER7. The idead default powerpc64 implementation
|
|
|
bca718 |
is to provide both doubleword and word aligned memory access.
|
|
|
bca718 |
|
|
|
bca718 |
For PPC64/POWER7 is also provide doubleword and word memory access,
|
|
|
bca718 |
remove the branch hints, use the cmpb instruction for compare
|
|
|
bca718 |
doubleword/words, and add an optimization for inputs of same alignment.
|
|
|
bca718 |
|
|
|
bca718 |
ChangeLog:
|
|
|
bca718 |
|
|
|
bca718 |
2013-10-04 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
bca718 |
|
|
|
bca718 |
* sysdeps/powerpc/powerpc64/strcpy.S (strcpy): Add word load/store
|
|
|
bca718 |
to provide a boost for large inputs with word alignment.
|
|
|
bca718 |
* sysdeps/powerpc/powerpc64/stpcpy.S (__stpcpy): Rewrite
|
|
|
bca718 |
implementation based on optimized PPC64 strcpy.
|
|
|
bca718 |
* sysdeps/powerpc/powerpc64/power7/strcpy.S: New file: optimized
|
|
|
bca718 |
strcpy for PPC64/POWER7 based on both doubleword and word load/store.
|
|
|
bca718 |
* sysdeps/powerpc/powerpc64/power7/stpcpy.S: New file: optimized
|
|
|
bca718 |
stpcpy for PPC64/POWER7 based on PPC64/POWER7 strcpy.
|
|
|
bca718 |
|
|
|
bca718 |
diff --git a/sysdeps/powerpc/powerpc64/power7/stpcpy.S b/sysdeps/powerpc/powerpc64/power7/stpcpy.S
|
|
|
bca718 |
new file mode 100644
|
|
|
bca718 |
index 0000000..727dd06
|
|
|
bca718 |
--- /dev/null
|
|
|
bca718 |
+++ b/sysdeps/powerpc/powerpc64/power7/stpcpy.S
|
|
|
bca718 |
@@ -0,0 +1,24 @@
|
|
|
bca718 |
+/* Optimized stpcpy implementation for PowerPC64/POWER7.
|
|
|
bca718 |
+ Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
bca718 |
+ This file is part of the GNU C Library.
|
|
|
bca718 |
+
|
|
|
bca718 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
bca718 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
bca718 |
+ License as published by the Free Software Foundation; either
|
|
|
bca718 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
bca718 |
+
|
|
|
bca718 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
bca718 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
bca718 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
bca718 |
+ Lesser General Public License for more details.
|
|
|
bca718 |
+
|
|
|
bca718 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
bca718 |
+ License along with the GNU C Library; if not, see
|
|
|
bca718 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
bca718 |
+
|
|
|
bca718 |
+#define USE_AS_STPCPY
|
|
|
bca718 |
+#include <sysdeps/powerpc/powerpc64/power7/strcpy.S>
|
|
|
bca718 |
+
|
|
|
bca718 |
+weak_alias (__stpcpy, stpcpy)
|
|
|
bca718 |
+libc_hidden_def (__stpcpy)
|
|
|
bca718 |
+libc_hidden_builtin_def (stpcpy)
|
|
|
bca718 |
diff --git a/sysdeps/powerpc/powerpc64/power7/strcpy.S b/sysdeps/powerpc/powerpc64/power7/strcpy.S
|
|
|
bca718 |
new file mode 100644
|
|
|
bca718 |
index 0000000..5c341a1
|
|
|
bca718 |
--- /dev/null
|
|
|
bca718 |
+++ b/sysdeps/powerpc/powerpc64/power7/strcpy.S
|
|
|
bca718 |
@@ -0,0 +1,274 @@
|
|
|
bca718 |
+/* Optimized strcpy/stpcpy implementation for PowerPC64/POWER7.
|
|
|
bca718 |
+ Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
bca718 |
+ This file is part of the GNU C Library.
|
|
|
bca718 |
+
|
|
|
bca718 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
bca718 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
bca718 |
+ License as published by the Free Software Foundation; either
|
|
|
bca718 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
bca718 |
+
|
|
|
bca718 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
bca718 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
bca718 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
bca718 |
+ Lesser General Public License for more details.
|
|
|
bca718 |
+
|
|
|
bca718 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
bca718 |
+ License along with the GNU C Library; if not, see
|
|
|
bca718 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
bca718 |
+
|
|
|
bca718 |
+#include <sysdep.h>
|
|
|
bca718 |
+
|
|
|
bca718 |
+/* Implements the function
|
|
|
bca718 |
+
|
|
|
bca718 |
+ char * [r3] strcpy (char *dest [r3], const char *src [r4])
|
|
|
bca718 |
+
|
|
|
bca718 |
+ or
|
|
|
bca718 |
+
|
|
|
bca718 |
+ char * [r3] strcpy (char *dest [r3], const char *src [r4])
|
|
|
bca718 |
+
|
|
|
bca718 |
+ if USE_AS_STPCPY is defined. It tries to use aligned memory accesses
|
|
|
bca718 |
+ when possible using the following algorithm:
|
|
|
bca718 |
+
|
|
|
bca718 |
+ if (((((uintptr_t)dst & 0x7UL) == 0) && ((uintptr_t)src & 0x7UL) == 0))
|
|
|
bca718 |
+ goto aligned_doubleword_copy;
|
|
|
bca718 |
+ if (((((uintptr_t)dst & 0x3UL) == 0) && ((uintptr_t)src & 0x3UL) == 0))
|
|
|
bca718 |
+ goto aligned_word_copy;
|
|
|
bca718 |
+ if (((uintptr_t)dst & 0x7UL) == ((uintptr_t)src & 0x7UL))
|
|
|
bca718 |
+ goto same_alignment;
|
|
|
bca718 |
+ goto unaligned;
|
|
|
bca718 |
+
|
|
|
bca718 |
+ The aligned comparison are made using cmpb instructions. */
|
|
|
bca718 |
+
|
|
|
bca718 |
+#ifdef USE_AS_STPCPY
|
|
|
bca718 |
+# define FUNC_NAME __stpcpy
|
|
|
bca718 |
+#else
|
|
|
bca718 |
+# define FUNC_NAME strcpy
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
+
|
|
|
bca718 |
+ .machine power7
|
|
|
bca718 |
+EALIGN (FUNC_NAME, 4, 0)
|
|
|
bca718 |
+ CALL_MCOUNT 2
|
|
|
bca718 |
+
|
|
|
bca718 |
+#define rTMP r0
|
|
|
bca718 |
+#ifdef USE_AS_STPCPY
|
|
|
bca718 |
+#define rRTN r3 /* pointer to previous word/doubleword in dest */
|
|
|
bca718 |
+#else
|
|
|
bca718 |
+#define rRTN r12 /* pointer to previous word/doubleword in dest */
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
+#define rSRC r4 /* pointer to previous word/doubleword in src */
|
|
|
bca718 |
+#define rMASK r5 /* mask 0xffffffff | 0xffffffffffffffff */
|
|
|
bca718 |
+#define rWORD r6 /* current word from src */
|
|
|
bca718 |
+#define rALT r7 /* alternate word from src */
|
|
|
bca718 |
+#define rRTNAL r8 /* alignment of return pointer */
|
|
|
bca718 |
+#define rSRCAL r9 /* alignment of source pointer */
|
|
|
bca718 |
+#define rALCNT r10 /* bytes to read to reach 8 bytes alignment */
|
|
|
bca718 |
+#define rSUBAL r11 /* doubleword minus unaligned displacement */
|
|
|
bca718 |
+
|
|
|
bca718 |
+#ifndef USE_AS_STPCPY
|
|
|
bca718 |
+/* Save the dst pointer to use as return value. */
|
|
|
bca718 |
+ mr rRTN, r3
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
+ or rTMP, rSRC, rRTN
|
|
|
bca718 |
+ clrldi. rTMP, rTMP, 61
|
|
|
bca718 |
+ bne L(check_word_alignment)
|
|
|
bca718 |
+ b L(aligned_doubleword_copy)
|
|
|
bca718 |
+
|
|
|
bca718 |
+L(same_alignment):
|
|
|
bca718 |
+/* Src and dst with same alignment: align both to doubleword. */
|
|
|
bca718 |
+ mr rALCNT, rRTN
|
|
|
bca718 |
+ lbz rWORD, 0(rSRC)
|
|
|
bca718 |
+ subfic rSUBAL, rRTNAL, 8
|
|
|
bca718 |
+ addi rRTN, rRTN, 1
|
|
|
bca718 |
+ addi rSRC, rSRC, 1
|
|
|
bca718 |
+ cmpdi cr7, rWORD, 0
|
|
|
bca718 |
+ stb rWORD, 0(rALCNT)
|
|
|
bca718 |
+ beq cr7, L(s2)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ add rALCNT, rALCNT, rSUBAL
|
|
|
bca718 |
+ subf rALCNT, rRTN, rALCNT
|
|
|
bca718 |
+ addi rALCNT, rALCNT, 1
|
|
|
bca718 |
+ mtctr rALCNT
|
|
|
bca718 |
+ b L(s1)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(s0):
|
|
|
bca718 |
+ addi rSRC, rSRC, 1
|
|
|
bca718 |
+ lbz rWORD, -1(rSRC)
|
|
|
bca718 |
+ cmpdi cr7, rWORD, 0
|
|
|
bca718 |
+ stb rWORD, -1(rALCNT)
|
|
|
bca718 |
+ beqlr cr7
|
|
|
bca718 |
+ mr rRTN, rALCNT
|
|
|
bca718 |
+L(s1):
|
|
|
bca718 |
+ addi rALCNT, rRTN,1
|
|
|
bca718 |
+ bdnz L(s0)
|
|
|
bca718 |
+ b L(aligned_doubleword_copy)
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(s2):
|
|
|
bca718 |
+ mr rRTN, rALCNT
|
|
|
bca718 |
+ blr
|
|
|
bca718 |
+
|
|
|
bca718 |
+/* For doubleword aligned memory, operate using doubleword load and stores. */
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(aligned_doubleword_copy):
|
|
|
bca718 |
+ li rMASK, 0
|
|
|
bca718 |
+ addi rRTN, rRTN, -8
|
|
|
bca718 |
+ ld rWORD, 0(rSRC)
|
|
|
bca718 |
+ b L(g2)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(g0): ldu rALT, 8(rSRC)
|
|
|
bca718 |
+ stdu rWORD, 8(rRTN)
|
|
|
bca718 |
+ cmpb rTMP, rALT, rMASK
|
|
|
bca718 |
+ cmpdi rTMP, 0
|
|
|
bca718 |
+ bne L(g1)
|
|
|
bca718 |
+ ldu rWORD, 8(rSRC)
|
|
|
bca718 |
+ stdu rALT, 8(rRTN)
|
|
|
bca718 |
+L(g2): cmpb rTMP, rWORD, rMASK
|
|
|
bca718 |
+ cmpdi rTMP, 0 /* If rTMP is 0, no null's have been found. */
|
|
|
bca718 |
+ beq L(g0)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ mr rALT, rWORD
|
|
|
bca718 |
+/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
bca718 |
+L(g1):
|
|
|
bca718 |
+#ifdef __LITTLE_ENDIAN__
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 56
|
|
|
bca718 |
+ stbu rALT, 8(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 48
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 40
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 32
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 24
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 16
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 8
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ extrdi rTMP, rALT, 8, 0
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+#else
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 0
|
|
|
bca718 |
+ stbu rTMP, 8(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 8
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 16
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 24
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 32
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 40
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ extrdi. rTMP, rALT, 8, 48
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
+ blr
|
|
|
bca718 |
+
|
|
|
bca718 |
+L(check_word_alignment):
|
|
|
bca718 |
+ clrldi. rTMP, rTMP, 62
|
|
|
bca718 |
+ beq L(aligned_word_copy)
|
|
|
bca718 |
+ rldicl rRTNAL, rRTN, 0, 61
|
|
|
bca718 |
+ rldicl rSRCAL, rSRC, 0, 61
|
|
|
bca718 |
+ cmpld cr7, rSRCAL, rRTNAL
|
|
|
bca718 |
+ beq cr7, L(same_alignment)
|
|
|
bca718 |
+ b L(unaligned)
|
|
|
bca718 |
+
|
|
|
bca718 |
+/* For word aligned memory, operate using word load and stores. */
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(aligned_word_copy):
|
|
|
bca718 |
+ li rMASK, 0
|
|
|
bca718 |
+ addi rRTN, rRTN, -4
|
|
|
bca718 |
+ lwz rWORD, 0(rSRC)
|
|
|
bca718 |
+ b L(g5)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(g3): lwzu rALT, 4(rSRC)
|
|
|
bca718 |
+ stwu rWORD, 4(rRTN)
|
|
|
bca718 |
+ cmpb rTMP, rALT, rMASK
|
|
|
bca718 |
+ cmpwi rTMP, 0
|
|
|
bca718 |
+ bne L(g4)
|
|
|
bca718 |
+ lwzu rWORD, 4(rSRC)
|
|
|
bca718 |
+ stwu rALT, 4(rRTN)
|
|
|
bca718 |
+L(g5): cmpb rTMP, rWORD, rMASK
|
|
|
bca718 |
+ cmpwi rTMP, 0 /* If rTMP is 0, no null in word. */
|
|
|
bca718 |
+ beq L(g3)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ mr rALT, rWORD
|
|
|
bca718 |
+/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
bca718 |
+L(g4):
|
|
|
bca718 |
+#ifdef __LITTLE_ENDIAN__
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 0, 24, 31
|
|
|
bca718 |
+ stbu rALT, 4(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm rTMP, rALT, 8, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+#else
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 4(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
+ blr
|
|
|
bca718 |
+
|
|
|
bca718 |
+/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
bca718 |
+ .align 4
|
|
|
bca718 |
+L(unaligned):
|
|
|
bca718 |
+ lbz rWORD, 0(rSRC)
|
|
|
bca718 |
+ addi rRTN, rRTN, -1
|
|
|
bca718 |
+ cmpdi rWORD, 0
|
|
|
bca718 |
+ beq L(u2)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ .align 5
|
|
|
bca718 |
+L(u0): lbzu rALT, 1(rSRC)
|
|
|
bca718 |
+ stbu rWORD, 1(rRTN)
|
|
|
bca718 |
+ cmpdi rALT, 0
|
|
|
bca718 |
+ beq L(u1)
|
|
|
bca718 |
+ lbzu rWORD, 1(rSRC)
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
+ cmpdi rWORD, 0
|
|
|
bca718 |
+ beq L(u2)
|
|
|
bca718 |
+ lbzu rALT, 1(rSRC)
|
|
|
bca718 |
+ stbu rWORD, 1(rRTN)
|
|
|
bca718 |
+ cmpdi rALT, 0
|
|
|
bca718 |
+ beq L(u1)
|
|
|
bca718 |
+ lbzu rWORD, 1(rSRC)
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
+ cmpdi rWORD, 0
|
|
|
bca718 |
+ bne L(u0)
|
|
|
bca718 |
+L(u2): stbu rWORD, 1(rRTN)
|
|
|
bca718 |
+ blr
|
|
|
bca718 |
+L(u1): stbu rALT, 1(rRTN)
|
|
|
bca718 |
+ blr
|
|
|
bca718 |
+END (FUNC_NAME)
|
|
|
bca718 |
+
|
|
|
bca718 |
+#ifndef USE_AS_STPCPY
|
|
|
bca718 |
+libc_hidden_builtin_def (strcpy)
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
diff --git a/sysdeps/powerpc/powerpc64/stpcpy.S b/sysdeps/powerpc/powerpc64/stpcpy.S
|
|
|
bca718 |
index d795b61..09aa3be 100644
|
|
|
bca718 |
--- a/sysdeps/powerpc/powerpc64/stpcpy.S
|
|
|
bca718 |
+++ b/sysdeps/powerpc/powerpc64/stpcpy.S
|
|
|
bca718 |
@@ -1,5 +1,5 @@
|
|
|
bca718 |
/* Optimized stpcpy implementation for PowerPC64.
|
|
|
bca718 |
- Copyright (C) 1997, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
|
|
|
bca718 |
+ Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
|
|
bca718 |
This file is part of the GNU C Library.
|
|
|
bca718 |
|
|
|
bca718 |
The GNU C Library is free software; you can redistribute it and/or
|
|
|
bca718 |
@@ -16,123 +16,9 @@
|
|
|
bca718 |
License along with the GNU C Library; if not, see
|
|
|
bca718 |
<http://www.gnu.org/licenses/>. */
|
|
|
bca718 |
|
|
|
bca718 |
-#include <sysdep.h>
|
|
|
bca718 |
-#include <bp-sym.h>
|
|
|
bca718 |
-#include <bp-asm.h>
|
|
|
bca718 |
+#define USE_AS_STPCPY
|
|
|
bca718 |
+#include <sysdeps/powerpc/powerpc64/strcpy.S>
|
|
|
bca718 |
|
|
|
bca718 |
-/* See strlen.s for comments on how the end-of-string testing works. */
|
|
|
bca718 |
-
|
|
|
bca718 |
-/* char * [r3] stpcpy (char *dest [r3], const char *src [r4]) */
|
|
|
bca718 |
-
|
|
|
bca718 |
-EALIGN (BP_SYM (__stpcpy), 4, 0)
|
|
|
bca718 |
- CALL_MCOUNT 2
|
|
|
bca718 |
-
|
|
|
bca718 |
-#define rTMP r0
|
|
|
bca718 |
-#define rRTN r3
|
|
|
bca718 |
-#if __BOUNDED_POINTERS__
|
|
|
bca718 |
-# define rDEST r4 /* pointer to previous word in dest */
|
|
|
bca718 |
-# define rSRC r5 /* pointer to previous word in src */
|
|
|
bca718 |
-# define rLOW r11
|
|
|
bca718 |
-# define rHIGH r12
|
|
|
bca718 |
-#else
|
|
|
bca718 |
-# define rDEST r3 /* pointer to previous word in dest */
|
|
|
bca718 |
-# define rSRC r4 /* pointer to previous word in src */
|
|
|
bca718 |
-#endif
|
|
|
bca718 |
-#define rWORD r6 /* current word from src */
|
|
|
bca718 |
-#define rFEFE r7 /* 0xfefefeff */
|
|
|
bca718 |
-#define r7F7F r8 /* 0x7f7f7f7f */
|
|
|
bca718 |
-#define rNEG r9 /* ~(word in src | 0x7f7f7f7f) */
|
|
|
bca718 |
-#define rALT r10 /* alternate word from src */
|
|
|
bca718 |
-
|
|
|
bca718 |
- CHECK_BOUNDS_LOW (rSRC, rLOW, rHIGH)
|
|
|
bca718 |
- CHECK_BOUNDS_LOW (rDEST, rLOW, rHIGH)
|
|
|
bca718 |
- STORE_RETURN_BOUNDS (rLOW, rHIGH)
|
|
|
bca718 |
-
|
|
|
bca718 |
- or rTMP, rSRC, rDEST
|
|
|
bca718 |
- clrldi. rTMP, rTMP, 62
|
|
|
bca718 |
- addi rDEST, rDEST, -4
|
|
|
bca718 |
- bne L(unaligned)
|
|
|
bca718 |
-
|
|
|
bca718 |
- lis rFEFE, -0x101
|
|
|
bca718 |
- lis r7F7F, 0x7f7f
|
|
|
bca718 |
- lwz rWORD, 0(rSRC)
|
|
|
bca718 |
- addi rFEFE, rFEFE, -0x101
|
|
|
bca718 |
- addi r7F7F, r7F7F, 0x7f7f
|
|
|
bca718 |
- b L(g2)
|
|
|
bca718 |
-
|
|
|
bca718 |
-L(g0): lwzu rALT, 4(rSRC)
|
|
|
bca718 |
- stwu rWORD, 4(rDEST)
|
|
|
bca718 |
- add rTMP, rFEFE, rALT
|
|
|
bca718 |
- nor rNEG, r7F7F, rALT
|
|
|
bca718 |
- and. rTMP, rTMP, rNEG
|
|
|
bca718 |
- bne- L(g1)
|
|
|
bca718 |
- lwzu rWORD, 4(rSRC)
|
|
|
bca718 |
- stwu rALT, 4(rDEST)
|
|
|
bca718 |
-L(g2): add rTMP, rFEFE, rWORD
|
|
|
bca718 |
- nor rNEG, r7F7F, rWORD
|
|
|
bca718 |
- and. rTMP, rTMP, rNEG
|
|
|
bca718 |
- beq+ L(g0)
|
|
|
bca718 |
-
|
|
|
bca718 |
- mr rALT, rWORD
|
|
|
bca718 |
-/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
bca718 |
-L(g1):
|
|
|
bca718 |
-#ifdef __LITTLE_ENDIAN__
|
|
|
bca718 |
- rlwinm. rTMP, rALT, 0, 24, 31
|
|
|
bca718 |
- stbu rALT, 4(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
- rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
bca718 |
- stbu rTMP, 1(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
- rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
bca718 |
- stbu rTMP, 1(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
- rlwinm rTMP, rALT, 8, 24, 31
|
|
|
bca718 |
- stbu rTMP, 1(rDEST)
|
|
|
bca718 |
- blr
|
|
|
bca718 |
-#else
|
|
|
bca718 |
- rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
bca718 |
- stbu rTMP, 4(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
- rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
bca718 |
- stbu rTMP, 1(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
- rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
bca718 |
- stbu rTMP, 1(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
- stbu rALT, 1(rDEST)
|
|
|
bca718 |
- CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
|
|
|
bca718 |
- STORE_RETURN_VALUE (rDEST)
|
|
|
bca718 |
- blr
|
|
|
bca718 |
-#endif
|
|
|
bca718 |
-
|
|
|
bca718 |
-/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
bca718 |
- .align 4
|
|
|
bca718 |
- nop
|
|
|
bca718 |
-L(unaligned):
|
|
|
bca718 |
- lbz rWORD, 0(rSRC)
|
|
|
bca718 |
- addi rDEST, rDEST, 3
|
|
|
bca718 |
- cmpwi rWORD, 0
|
|
|
bca718 |
- beq- L(u2)
|
|
|
bca718 |
-
|
|
|
bca718 |
-L(u0): lbzu rALT, 1(rSRC)
|
|
|
bca718 |
- stbu rWORD, 1(rDEST)
|
|
|
bca718 |
- cmpwi rALT, 0
|
|
|
bca718 |
- beq- L(u1)
|
|
|
bca718 |
- nop /* Let 601 load start of loop. */
|
|
|
bca718 |
- lbzu rWORD, 1(rSRC)
|
|
|
bca718 |
- stbu rALT, 1(rDEST)
|
|
|
bca718 |
- cmpwi rWORD, 0
|
|
|
bca718 |
- bne+ L(u0)
|
|
|
bca718 |
-L(u2): stbu rWORD, 1(rDEST)
|
|
|
bca718 |
- CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
|
|
|
bca718 |
- STORE_RETURN_VALUE (rDEST)
|
|
|
bca718 |
- blr
|
|
|
bca718 |
-L(u1): stbu rALT, 1(rDEST)
|
|
|
bca718 |
- CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
|
|
|
bca718 |
- STORE_RETURN_VALUE (rDEST)
|
|
|
bca718 |
- blr
|
|
|
bca718 |
-END (BP_SYM (__stpcpy))
|
|
|
bca718 |
-
|
|
|
bca718 |
-weak_alias (BP_SYM (__stpcpy), BP_SYM (stpcpy))
|
|
|
bca718 |
+weak_alias (__stpcpy, stpcpy)
|
|
|
bca718 |
libc_hidden_def (__stpcpy)
|
|
|
bca718 |
libc_hidden_builtin_def (stpcpy)
|
|
|
bca718 |
diff --git a/sysdeps/powerpc/powerpc64/strcpy.S b/sysdeps/powerpc/powerpc64/strcpy.S
|
|
|
bca718 |
index 9434c27..793325d 100644
|
|
|
bca718 |
--- a/sysdeps/powerpc/powerpc64/strcpy.S
|
|
|
bca718 |
+++ b/sysdeps/powerpc/powerpc64/strcpy.S
|
|
|
bca718 |
@@ -1,5 +1,5 @@
|
|
|
bca718 |
/* Optimized strcpy implementation for PowerPC64.
|
|
|
bca718 |
- Copyright (C) 1997, 1999, 2000, 2002, 2003, 2011 Free Software Foundation, Inc.
|
|
|
bca718 |
+ Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
|
|
bca718 |
This file is part of the GNU C Library.
|
|
|
bca718 |
|
|
|
bca718 |
The GNU C Library is free software; you can redistribute it and/or
|
|
|
bca718 |
@@ -17,52 +17,43 @@
|
|
|
bca718 |
<http://www.gnu.org/licenses/>. */
|
|
|
bca718 |
|
|
|
bca718 |
#include <sysdep.h>
|
|
|
bca718 |
-#include <bp-sym.h>
|
|
|
bca718 |
-#include <bp-asm.h>
|
|
|
bca718 |
|
|
|
bca718 |
/* See strlen.s for comments on how the end-of-string testing works. */
|
|
|
bca718 |
|
|
|
bca718 |
/* char * [r3] strcpy (char *dest [r3], const char *src [r4]) */
|
|
|
bca718 |
|
|
|
bca718 |
-EALIGN (BP_SYM (strcpy), 4, 0)
|
|
|
bca718 |
+#ifdef USE_AS_STPCPY
|
|
|
bca718 |
+# define FUNC_NAME __stpcpy
|
|
|
bca718 |
+#else
|
|
|
bca718 |
+# define FUNC_NAME strcpy
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
+
|
|
|
bca718 |
+EALIGN (FUNC_NAME, 4, 0)
|
|
|
bca718 |
CALL_MCOUNT 2
|
|
|
bca718 |
|
|
|
bca718 |
#define rTMP r0
|
|
|
bca718 |
-#define rRTN r3 /* incoming DEST arg preserved as result */
|
|
|
bca718 |
-/* Note. The Bounded pointer support in this code is broken. This code
|
|
|
bca718 |
- was inherited from PPC32 and that support was never completed.
|
|
|
bca718 |
- Current PPC gcc does not support -fbounds-check or -fbounded-pointers.
|
|
|
bca718 |
- These artifacts are left in the code as a reminder in case we need
|
|
|
bca718 |
- bounded pointer support in the future. */
|
|
|
bca718 |
-#if __BOUNDED_POINTERS__
|
|
|
bca718 |
-# define rDEST r4 /* pointer to previous word in dest */
|
|
|
bca718 |
-# define rSRC r5 /* pointer to previous word in src */
|
|
|
bca718 |
-# define rLOW r11
|
|
|
bca718 |
-# define rHIGH r12
|
|
|
bca718 |
+#ifdef USE_AS_STPCPY
|
|
|
bca718 |
+#define rRTN r3 /* pointer to previous word/doubleword in dest */
|
|
|
bca718 |
#else
|
|
|
bca718 |
-# define rSRC r4 /* pointer to previous word in src */
|
|
|
bca718 |
-# define rDEST r5 /* pointer to previous word in dest */
|
|
|
bca718 |
+#define rRTN r12 /* pointer to previous word/doubleword in dest */
|
|
|
bca718 |
#endif
|
|
|
bca718 |
+#define rSRC r4 /* pointer to previous word/doubleword in src */
|
|
|
bca718 |
#define rWORD r6 /* current word from src */
|
|
|
bca718 |
-#define rFEFE r7 /* constant 0xfefefefefefefeff (-0x0101010101010101) */
|
|
|
bca718 |
-#define r7F7F r8 /* constant 0x7f7f7f7f7f7f7f7f */
|
|
|
bca718 |
-#define rNEG r9 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
|
|
|
bca718 |
+#define rFEFE r7 /* constant 0xfefefeff | 0xfefefefefefefeff */
|
|
|
bca718 |
+#define r7F7F r8 /* constant 0x7f7f7f7f | 0x7f7f7f7f7f7f7f7f */
|
|
|
bca718 |
+#define rNEG r9 /* ~(word in s1 | r7F7F) */
|
|
|
bca718 |
#define rALT r10 /* alternate word from src */
|
|
|
bca718 |
|
|
|
bca718 |
- CHECK_BOUNDS_LOW (rSRC, rLOW, rHIGH)
|
|
|
bca718 |
- CHECK_BOUNDS_LOW (rDEST, rLOW, rHIGH)
|
|
|
bca718 |
- STORE_RETURN_BOUNDS (rLOW, rHIGH)
|
|
|
bca718 |
-
|
|
|
bca718 |
- dcbt 0,rSRC
|
|
|
bca718 |
+#ifndef USE_AS_STPCPY
|
|
|
bca718 |
+/* Save the dst pointer to use as return value. */
|
|
|
bca718 |
+ mr rRTN, r3
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
or rTMP, rSRC, rRTN
|
|
|
bca718 |
clrldi. rTMP, rTMP, 61
|
|
|
bca718 |
-#if __BOUNDED_POINTERS__
|
|
|
bca718 |
- addi rDEST, rDEST, -8
|
|
|
bca718 |
-#else
|
|
|
bca718 |
- addi rDEST, rRTN, -8
|
|
|
bca718 |
-#endif
|
|
|
bca718 |
- dcbtst 0,rRTN
|
|
|
bca718 |
- bne L(unaligned)
|
|
|
bca718 |
+ bne L(check_word_alignment)
|
|
|
bca718 |
+
|
|
|
bca718 |
+/* For doubleword aligned memory, operate using doubleword load and stores. */
|
|
|
bca718 |
+ addi rRTN, rRTN, -8
|
|
|
bca718 |
|
|
|
bca718 |
lis rFEFE, -0x101
|
|
|
bca718 |
lis r7F7F, 0x7f7f
|
|
|
bca718 |
@@ -75,13 +66,13 @@ EALIGN (BP_SYM (strcpy), 4, 0)
|
|
|
bca718 |
b L(g2)
|
|
|
bca718 |
|
|
|
bca718 |
L(g0): ldu rALT, 8(rSRC)
|
|
|
bca718 |
- stdu rWORD, 8(rDEST)
|
|
|
bca718 |
+ stdu rWORD, 8(rRTN)
|
|
|
bca718 |
add rTMP, rFEFE, rALT
|
|
|
bca718 |
nor rNEG, r7F7F, rALT
|
|
|
bca718 |
and. rTMP, rTMP, rNEG
|
|
|
bca718 |
bne- L(g1)
|
|
|
bca718 |
ldu rWORD, 8(rSRC)
|
|
|
bca718 |
- stdu rALT, 8(rDEST)
|
|
|
bca718 |
+ stdu rALT, 8(rRTN)
|
|
|
bca718 |
L(g2): add rTMP, rFEFE, rWORD
|
|
|
bca718 |
nor rNEG, r7F7F, rWORD
|
|
|
bca718 |
and. rTMP, rTMP, rNEG
|
|
|
bca718 |
@@ -92,80 +83,134 @@ L(g2): add rTMP, rFEFE, rWORD
|
|
|
bca718 |
L(g1):
|
|
|
bca718 |
#ifdef __LITTLE_ENDIAN__
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 56
|
|
|
bca718 |
- stb rALT, 8(rDEST)
|
|
|
bca718 |
+ stbu rALT, 8(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 48
|
|
|
bca718 |
- stb rTMP, 9(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 40
|
|
|
bca718 |
- stb rTMP, 10(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 32
|
|
|
bca718 |
- stb rTMP, 11(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 24
|
|
|
bca718 |
- stb rTMP, 12(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 16
|
|
|
bca718 |
- stb rTMP, 13(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 8
|
|
|
bca718 |
- stb rTMP, 14(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi rTMP, rALT, 8, 0
|
|
|
bca718 |
- stb rTMP, 15(rDEST)
|
|
|
bca718 |
- blr
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
#else
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 0
|
|
|
bca718 |
- stb rTMP, 8(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 8(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 8
|
|
|
bca718 |
- stb rTMP, 9(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 16
|
|
|
bca718 |
- stb rTMP, 10(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 24
|
|
|
bca718 |
- stb rTMP, 11(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 32
|
|
|
bca718 |
- stb rTMP, 12(rDEST)
|
|
|
bca718 |
- beqlr-
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 40
|
|
|
bca718 |
- stb rTMP, 13(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
extrdi. rTMP, rALT, 8, 48
|
|
|
bca718 |
- stb rTMP, 14(rDEST)
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
beqlr-
|
|
|
bca718 |
- stb rALT, 15(rDEST)
|
|
|
bca718 |
- /* GKM FIXME: check high bound. */
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
+#endif
|
|
|
bca718 |
blr
|
|
|
bca718 |
+
|
|
|
bca718 |
+L(check_word_alignment):
|
|
|
bca718 |
+ clrldi. rTMP, rTMP, 62
|
|
|
bca718 |
+ bne L(unaligned)
|
|
|
bca718 |
+
|
|
|
bca718 |
+/* For word aligned memory, operate using word load and stores. */
|
|
|
bca718 |
+ addi rRTN, rRTN, -4
|
|
|
bca718 |
+
|
|
|
bca718 |
+ lis rFEFE, -0x101
|
|
|
bca718 |
+ lis r7F7F, 0x7f7f
|
|
|
bca718 |
+ lwz rWORD, 0(rSRC)
|
|
|
bca718 |
+ addi rFEFE, rFEFE, -0x101
|
|
|
bca718 |
+ addi r7F7F, r7F7F, 0x7f7f
|
|
|
bca718 |
+ b L(g5)
|
|
|
bca718 |
+
|
|
|
bca718 |
+L(g3): lwzu rALT, 4(rSRC)
|
|
|
bca718 |
+ stwu rWORD, 4(rRTN)
|
|
|
bca718 |
+ add rTMP, rFEFE, rALT
|
|
|
bca718 |
+ nor rNEG, r7F7F, rALT
|
|
|
bca718 |
+ and. rTMP, rTMP, rNEG
|
|
|
bca718 |
+ bne- L(g4)
|
|
|
bca718 |
+ lwzu rWORD, 4(rSRC)
|
|
|
bca718 |
+ stwu rALT, 4(rRTN)
|
|
|
bca718 |
+L(g5): add rTMP, rFEFE, rWORD
|
|
|
bca718 |
+ nor rNEG, r7F7F, rWORD
|
|
|
bca718 |
+ and. rTMP, rTMP, rNEG
|
|
|
bca718 |
+ beq+ L(g3)
|
|
|
bca718 |
+
|
|
|
bca718 |
+ mr rALT, rWORD
|
|
|
bca718 |
+/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
bca718 |
+L(g4):
|
|
|
bca718 |
+#ifdef __LITTLE_ENDIAN__
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 0, 24, 31
|
|
|
bca718 |
+ stbu rALT, 4(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm rTMP, rALT, 8, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+#else
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 4(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
bca718 |
+ stbu rTMP, 1(rRTN)
|
|
|
bca718 |
+ beqlr-
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
#endif
|
|
|
bca718 |
+ blr
|
|
|
bca718 |
|
|
|
bca718 |
/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
bca718 |
.align 4
|
|
|
bca718 |
nop
|
|
|
bca718 |
L(unaligned):
|
|
|
bca718 |
lbz rWORD, 0(rSRC)
|
|
|
bca718 |
- addi rDEST, rRTN, -1
|
|
|
bca718 |
+ addi rRTN, rRTN, -1
|
|
|
bca718 |
cmpwi rWORD, 0
|
|
|
bca718 |
beq- L(u2)
|
|
|
bca718 |
|
|
|
bca718 |
L(u0): lbzu rALT, 1(rSRC)
|
|
|
bca718 |
- stbu rWORD, 1(rDEST)
|
|
|
bca718 |
+ stbu rWORD, 1(rRTN)
|
|
|
bca718 |
cmpwi rALT, 0
|
|
|
bca718 |
beq- L(u1)
|
|
|
bca718 |
nop /* Let 601 load start of loop. */
|
|
|
bca718 |
lbzu rWORD, 1(rSRC)
|
|
|
bca718 |
- stbu rALT, 1(rDEST)
|
|
|
bca718 |
+ stbu rALT, 1(rRTN)
|
|
|
bca718 |
cmpwi rWORD, 0
|
|
|
bca718 |
bne+ L(u0)
|
|
|
bca718 |
-L(u2): stb rWORD, 1(rDEST)
|
|
|
bca718 |
- /* GKM FIXME: check high bound. */
|
|
|
bca718 |
+L(u2): stbu rWORD, 1(rRTN)
|
|
|
bca718 |
blr
|
|
|
bca718 |
-L(u1): stb rALT, 1(rDEST)
|
|
|
bca718 |
- /* GKM FIXME: check high bound. */
|
|
|
bca718 |
+L(u1): stbu rALT, 1(rRTN)
|
|
|
bca718 |
blr
|
|
|
bca718 |
+END (FUNC_NAME)
|
|
|
bca718 |
|
|
|
bca718 |
-END (BP_SYM (strcpy))
|
|
|
bca718 |
+#ifndef USE_AS_STPCPY
|
|
|
bca718 |
libc_hidden_builtin_def (strcpy)
|
|
|
bca718 |
+#endif
|