|
|
ce426f |
# commit 43b84013714c46e6dcae4a5564c5527777ad5e08
|
|
|
ce426f |
# Author: Alan Modra <amodra@gmail.com>
|
|
|
ce426f |
# Date: Sat Aug 17 18:45:31 2013 +0930
|
|
|
ce426f |
#
|
|
|
ce426f |
# PowerPC LE strcpy
|
|
|
ce426f |
# http://sourceware.org/ml/libc-alpha/2013-08/msg00100.html
|
|
|
ce426f |
#
|
|
|
ce426f |
# The strcpy changes for little-endian are quite straight-forward, just
|
|
|
ce426f |
# a matter of rotating the last word differently.
|
|
|
ce426f |
#
|
|
|
ce426f |
# I'll note that the powerpc64 version of stpcpy is just begging to be
|
|
|
ce426f |
# converted to use 64-bit loads and stores..
|
|
|
ce426f |
#
|
|
|
ce426f |
# * sysdeps/powerpc/powerpc64/strcpy.S: Add little-endian support:
|
|
|
ce426f |
# * sysdeps/powerpc/powerpc32/strcpy.S: Likewise.
|
|
|
ce426f |
# * sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
|
|
|
ce426f |
# * sysdeps/powerpc/powerpc32/stpcpy.S: Likewise.
|
|
|
ce426f |
#
|
|
|
ce426f |
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
@@ -74,7 +74,22 @@
|
|
|
ce426f |
|
|
|
ce426f |
mr rALT, rWORD
|
|
|
ce426f |
/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
ce426f |
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
+L(g1):
|
|
|
ce426f |
+#ifdef __LITTLE_ENDIAN__
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 0, 24, 31
|
|
|
ce426f |
+ stbu rALT, 4(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
ce426f |
+ stbu rTMP, 1(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
ce426f |
+ stbu rTMP, 1(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
+ stbu rTMP, 1(rDEST)
|
|
|
ce426f |
+ blr
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
stbu rTMP, 4(rDEST)
|
|
|
ce426f |
beqlr-
|
|
|
ce426f |
rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
ce426f |
@@ -87,6 +102,7 @@
|
|
|
ce426f |
CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
|
|
|
ce426f |
STORE_RETURN_VALUE (rDEST)
|
|
|
ce426f |
blr
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
ce426f |
.align 4
|
|
|
ce426f |
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
@@ -78,7 +78,22 @@
|
|
|
ce426f |
|
|
|
ce426f |
mr rALT, rWORD
|
|
|
ce426f |
/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
ce426f |
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
+L(g1):
|
|
|
ce426f |
+#ifdef __LITTLE_ENDIAN__
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 0, 24, 31
|
|
|
ce426f |
+ stb rALT, 4(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
ce426f |
+ stb rTMP, 5(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
ce426f |
+ stb rTMP, 6(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
+ stb rTMP, 7(rDEST)
|
|
|
ce426f |
+ blr
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
stb rTMP, 4(rDEST)
|
|
|
ce426f |
beqlr-
|
|
|
ce426f |
rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
ce426f |
@@ -90,6 +105,7 @@
|
|
|
ce426f |
stb rALT, 7(rDEST)
|
|
|
ce426f |
/* GKM FIXME: check high bound. */
|
|
|
ce426f |
blr
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
ce426f |
.align 4
|
|
|
ce426f |
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
@@ -75,7 +75,22 @@
|
|
|
ce426f |
|
|
|
ce426f |
mr rALT, rWORD
|
|
|
ce426f |
/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
ce426f |
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
+L(g1):
|
|
|
ce426f |
+#ifdef __LITTLE_ENDIAN__
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 0, 24, 31
|
|
|
ce426f |
+ stbu rALT, 4(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 24, 24, 31
|
|
|
ce426f |
+ stbu rTMP, 1(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
ce426f |
+ stbu rTMP, 1(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ rlwinm rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
+ stbu rTMP, 1(rDEST)
|
|
|
ce426f |
+ blr
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+ rlwinm. rTMP, rALT, 8, 24, 31
|
|
|
ce426f |
stbu rTMP, 4(rDEST)
|
|
|
ce426f |
beqlr-
|
|
|
ce426f |
rlwinm. rTMP, rALT, 16, 24, 31
|
|
|
ce426f |
@@ -88,6 +103,7 @@
|
|
|
ce426f |
CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
|
|
|
ce426f |
STORE_RETURN_VALUE (rDEST)
|
|
|
ce426f |
blr
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
ce426f |
.align 4
|
|
|
ce426f |
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S 2014-05-28 13:40:01.000000000 -0500
|
|
|
ce426f |
@@ -90,6 +90,32 @@
|
|
|
ce426f |
mr rALT, rWORD
|
|
|
ce426f |
/* We've hit the end of the string. Do the rest byte-by-byte. */
|
|
|
ce426f |
L(g1):
|
|
|
ce426f |
+#ifdef __LITTLE_ENDIAN__
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 56
|
|
|
ce426f |
+ stb rALT, 8(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 48
|
|
|
ce426f |
+ stb rTMP, 9(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 40
|
|
|
ce426f |
+ stb rTMP, 10(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 32
|
|
|
ce426f |
+ stb rTMP, 11(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 24
|
|
|
ce426f |
+ stb rTMP, 12(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 16
|
|
|
ce426f |
+ stb rTMP, 13(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi. rTMP, rALT, 8, 8
|
|
|
ce426f |
+ stb rTMP, 14(rDEST)
|
|
|
ce426f |
+ beqlr-
|
|
|
ce426f |
+ extrdi rTMP, rALT, 8, 0
|
|
|
ce426f |
+ stb rTMP, 15(rDEST)
|
|
|
ce426f |
+ blr
|
|
|
ce426f |
+#else
|
|
|
ce426f |
extrdi. rTMP, rALT, 8, 0
|
|
|
ce426f |
stb rTMP, 8(rDEST)
|
|
|
ce426f |
beqlr-
|
|
|
ce426f |
@@ -114,6 +140,7 @@
|
|
|
ce426f |
stb rALT, 15(rDEST)
|
|
|
ce426f |
/* GKM FIXME: check high bound. */
|
|
|
ce426f |
blr
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
|
|
|
ce426f |
/* Oh well. In this case, we just do a byte-by-byte copy. */
|
|
|
ce426f |
.align 4
|