about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32/strcpy.S
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-08-17 18:45:31 +0930
committerAlan Modra <amodra@gmail.com>2013-10-04 10:40:11 +0930
commit43b84013714c46e6dcae4a5564c5527777ad5e08 (patch)
tree7d7c8aa8ec9c84991e0fc2f1e24a2c711c5de3ed /sysdeps/powerpc/powerpc32/strcpy.S
parent8a7413f9b036da83ffde491a37d9d2340bc321a7 (diff)
downloadglibc-43b84013714c46e6dcae4a5564c5527777ad5e08.tar.gz
glibc-43b84013714c46e6dcae4a5564c5527777ad5e08.tar.xz
glibc-43b84013714c46e6dcae4a5564c5527777ad5e08.zip
PowerPC LE strcpy
http://sourceware.org/ml/libc-alpha/2013-08/msg00100.html

The strcpy changes for little-endian are quite straight-forward, just
a matter of rotating the last word differently.

I'll note that the powerpc64 version of stpcpy is just begging to be
converted to use 64-bit loads and stores..

	* sysdeps/powerpc/powerpc64/strcpy.S: Add little-endian support:
	* sysdeps/powerpc/powerpc32/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
	* sysdeps/powerpc/powerpc32/stpcpy.S: Likewise.
Diffstat (limited to 'sysdeps/powerpc/powerpc32/strcpy.S')
-rw-r--r--sysdeps/powerpc/powerpc32/strcpy.S18
1 files changed, 17 insertions, 1 deletions
diff --git a/sysdeps/powerpc/powerpc32/strcpy.S b/sysdeps/powerpc/powerpc32/strcpy.S
index 4ae577dbb6..e938cc42a7 100644
--- a/sysdeps/powerpc/powerpc32/strcpy.S
+++ b/sysdeps/powerpc/powerpc32/strcpy.S
@@ -62,7 +62,22 @@ L(g2):	add	rTMP, rFEFE, rWORD
 
 	mr	rALT, rWORD
 /* We've hit the end of the string.  Do the rest byte-by-byte.  */
-L(g1):	rlwinm.	rTMP, rALT, 8, 24, 31
+L(g1):
+#ifdef __LITTLE_ENDIAN__
+	rlwinm.	rTMP, rALT, 0, 24, 31
+	stb	rALT, 4(rDEST)
+	beqlr-
+	rlwinm.	rTMP, rALT, 24, 24, 31
+	stb	rTMP, 5(rDEST)
+	beqlr-
+	rlwinm.	rTMP, rALT, 16, 24, 31
+	stb	rTMP, 6(rDEST)
+	beqlr-
+	rlwinm	rTMP, rALT, 8, 24, 31
+	stb	rTMP, 7(rDEST)
+	blr
+#else
+	rlwinm.	rTMP, rALT, 8, 24, 31
 	stb	rTMP, 4(rDEST)
 	beqlr-
 	rlwinm.	rTMP, rALT, 16, 24, 31
@@ -73,6 +88,7 @@ L(g1):	rlwinm.	rTMP, rALT, 8, 24, 31
 	beqlr-
 	stb	rALT, 7(rDEST)
 	blr
+#endif
 
 /* Oh well.  In this case, we just do a byte-by-byte copy.  */
 	.align 4