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