5de29b
# commit 8a7413f9b036da83ffde491a37d9d2340bc321a7
5de29b
# Author: Alan Modra <amodra@gmail.com>
5de29b
# Date:   Sat Aug 17 18:41:17 2013 +0930
5de29b
# 
5de29b
#     PowerPC LE strcmp and strncmp
5de29b
#     http://sourceware.org/ml/libc-alpha/2013-08/msg00099.html
5de29b
#     
5de29b
#     More little-endian support.  I leave the main strcmp loops unchanged,
5de29b
#     (well, except for renumbering rTMP to something other than r0 since
5de29b
#     it's needed in an addi insn) and modify the tail for little-endian.
5de29b
#     
5de29b
#     I noticed some of the big-endian tail code was a little untidy so have
5de29b
#     cleaned that up too.
5de29b
#     
5de29b
#         * sysdeps/powerpc/powerpc64/strcmp.S (rTMP2): Define as r0.
5de29b
#         (rTMP): Define as r11.
5de29b
#         (strcmp): Add little-endian support.  Optimise tail.
5de29b
#         * sysdeps/powerpc/powerpc32/strcmp.S: Similarly.
5de29b
#         * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
5de29b
#         * sysdeps/powerpc/powerpc32/strncmp.S: Likewise.
5de29b
#         * sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
5de29b
#         * sysdeps/powerpc/powerpc32/power4/strncmp.S: Likewise.
5de29b
#         * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
5de29b
#         * sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
5de29b
# 
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S	2014-05-28 13:27:02.000000000 -0500
5de29b
@@ -26,7 +26,7 @@
5de29b
 
5de29b
 EALIGN (BP_SYM(strncmp), 4, 0)
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -42,6 +42,7 @@
5de29b
 #define r7F7F	r9	/* constant 0x7f7f7f7f */
5de29b
 #define rNEG	r10	/* ~(word in s1 | 0x7f7f7f7f) */
5de29b
 #define rBITDIF	r11	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r12
5de29b
 
5de29b
 	dcbt	0,rSTR1
5de29b
 	or	rTMP, rSTR2, rSTR1
5de29b
@@ -80,12 +81,45 @@
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
 
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	slwi	rTMP, rTMP, 1
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	and	rWORD2, rWORD2, rTMP2		/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rldimi	rTMP2, rWORD2, 24, 32
5de29b
+	rldimi	rTMP, rWORD1, 24, 32
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr+
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	lwz	rWORD1, -4(rSTR1)
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rldimi	rTMP2, rWORD2, 24, 32
5de29b
+	rldimi	rTMP, rWORD1, 24, 32
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr+
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
 L(endstring):
5de29b
 	and	rTMP, r7F7F, rWORD1
5de29b
 	beq	cr1, L(equal)
5de29b
 	add	rTMP, rTMP, r7F7F
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
-
5de29b
 	andc	rNEG, rNEG, rTMP
5de29b
 	blt-	L(highbit)
5de29b
 	cntlzw	rBITDIF, rBITDIF
5de29b
@@ -93,28 +127,20 @@
5de29b
 	addi	rNEG, rNEG, 7
5de29b
 	cmpw	cr1, rNEG, rBITDIF
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
-	blt-	cr1, L(equal)
5de29b
-	srawi	rRTN, rRTN, 31
5de29b
-	ori	rRTN, rRTN, 1
5de29b
-	blr
5de29b
+	bgelr+	cr1
5de29b
 L(equal):
5de29b
 	li	rRTN, 0
5de29b
 	blr
5de29b
 
5de29b
 L(different):
5de29b
-	lwzu	rWORD1, -4(rSTR1)
5de29b
+	lwz	rWORD1, -4(rSTR1)
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
-	blt-	L(highbit)
5de29b
-	srawi	rRTN, rRTN, 31
5de29b
-	ori	rRTN, rRTN, 1
5de29b
-	blr
5de29b
+	bgelr+
5de29b
 L(highbit):
5de29b
-	srwi	rWORD2, rWORD2, 24
5de29b
-	srwi	rWORD1, rWORD1, 24
5de29b
-	sub	rRTN, rWORD1, rWORD2
5de29b
+	ori	rRTN, rWORD2, 1
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align 4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S	2014-05-28 13:27:02.000000000 -0500
5de29b
@@ -28,7 +28,7 @@
5de29b
 
5de29b
 EALIGN (BP_SYM(strncmp),5,0)
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -44,6 +44,7 @@
5de29b
 #define r7F7F	r9	/* constant 0x7f7f7f7f */
5de29b
 #define rNEG	r10	/* ~(word in s1 | 0x7f7f7f7f) */
5de29b
 #define rBITDIF	r11	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r12
5de29b
 
5de29b
 	dcbt	0,rSTR1
5de29b
 	nop
5de29b
@@ -83,13 +84,45 @@
5de29b
 /* OK. We've hit the end of the string. We need to be careful that
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	slwi	rTMP, rTMP, 1
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	and	rWORD2, rWORD2, rTMP2		/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rldimi	rTMP2, rWORD2, 24, 32
5de29b
+	rldimi	rTMP, rWORD1, 24, 32
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	lwz	rWORD1, -4(rSTR1)
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rldimi	rTMP2, rWORD2, 24, 32
5de29b
+	rldimi	rTMP, rWORD1, 24, 32
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
 
5de29b
+#else
5de29b
 L(endstring):
5de29b
 	and	rTMP,r7F7F,rWORD1
5de29b
 	beq	cr1,L(equal)
5de29b
 	add	rTMP,rTMP,r7F7F
5de29b
 	xor.	rBITDIF,rWORD1,rWORD2
5de29b
-
5de29b
 	andc	rNEG,rNEG,rTMP
5de29b
 	blt	L(highbit)
5de29b
 	cntlzw	rBITDIF,rBITDIF
5de29b
@@ -97,28 +130,20 @@
5de29b
 	addi	rNEG,rNEG,7
5de29b
 	cmpw	cr1,rNEG,rBITDIF
5de29b
 	sub	rRTN,rWORD1,rWORD2
5de29b
-	blt	cr1,L(equal)
5de29b
-	srawi	rRTN,rRTN,31
5de29b
-	ori	rRTN,rRTN,1
5de29b
-	blr
5de29b
+	bgelr	cr1
5de29b
 L(equal):
5de29b
 	li	rRTN,0
5de29b
 	blr
5de29b
 
5de29b
 L(different):
5de29b
-	lwzu	rWORD1,-4(rSTR1)
5de29b
+	lwz	rWORD1,-4(rSTR1)
5de29b
 	xor.	rBITDIF,rWORD1,rWORD2
5de29b
 	sub	rRTN,rWORD1,rWORD2
5de29b
-	blt	L(highbit)
5de29b
-	srawi	rRTN,rRTN,31
5de29b
-	ori	rRTN,rRTN,1
5de29b
-	blr
5de29b
+	bgelr
5de29b
 L(highbit):
5de29b
-	srwi	rWORD2,rWORD2,24
5de29b
-	srwi	rWORD1,rWORD1,24
5de29b
-	sub	rRTN,rWORD1,rWORD2
5de29b
+	ori	rRTN, rWORD2, 1
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well. In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align	4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S	2014-05-28 13:27:02.000000000 -0500
5de29b
@@ -26,7 +26,7 @@
5de29b
 
5de29b
 EALIGN (BP_SYM (strcmp), 4, 0)
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -40,6 +40,7 @@
5de29b
 #define r7F7F	r8	/* constant 0x7f7f7f7f */
5de29b
 #define rNEG	r9	/* ~(word in s1 | 0x7f7f7f7f) */
5de29b
 #define rBITDIF	r10	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r11
5de29b
 
5de29b
 	CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1)
5de29b
 	CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2)
5de29b
@@ -64,10 +65,45 @@
5de29b
 	and.	rTMP, rTMP, rNEG
5de29b
 	cmpw	cr1, rWORD1, rWORD2
5de29b
 	beq+	L(g0)
5de29b
-L(endstring):
5de29b
+
5de29b
 /* OK. We've hit the end of the string. We need to be careful that
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	rlwimi	rTMP2, rTMP2, 1, 0, 30
5de29b
+	and	rWORD2, rWORD2, rTMP2		/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 0, 7
5de29b
+	rlwimi	rTMP, rWORD1, 24, 0, 7
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr+
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	lwz	rWORD1, -4(rSTR1)
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 0, 7
5de29b
+	rlwimi	rTMP, rWORD1, 24, 0, 7
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr+
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
+L(endstring):
5de29b
 	and	rTMP, r7F7F, rWORD1
5de29b
 	beq	cr1, L(equal)
5de29b
 	add	rTMP, rTMP, r7F7F
5de29b
@@ -94,7 +130,7 @@
5de29b
 	ori	rRTN, rWORD2, 1
5de29b
 	/* GKM FIXME: check high bounds.  */
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align 4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S	2014-05-28 13:27:02.000000000 -0500
5de29b
@@ -26,7 +26,7 @@
5de29b
 
5de29b
 EALIGN (BP_SYM(strncmp), 4, 0)
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -40,6 +40,7 @@
5de29b
 #define r7F7F	r9	/* constant 0x7f7f7f7f */
5de29b
 #define rNEG	r10	/* ~(word in s1 | 0x7f7f7f7f) */
5de29b
 #define rBITDIF	r11	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r12
5de29b
 
5de29b
 	dcbt	0,rSTR1
5de29b
 	or	rTMP, rSTR2, rSTR1
5de29b
@@ -78,12 +79,45 @@
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
 
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	slwi	rTMP, rTMP, 1
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	and	rWORD2, rWORD2, rTMP2		/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 0, 7
5de29b
+	rlwimi	rTMP, rWORD1, 24, 0, 7
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr+
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	lwz	rWORD1, -4(rSTR1)
5de29b
+	rlwinm	rTMP2, rWORD2, 8, 0xffffffff	/* Byte reverse word.  */
5de29b
+	rlwinm	rTMP, rWORD1, 8, 0xffffffff
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 0, 7
5de29b
+	rlwimi	rTMP, rWORD1, 24, 0, 7
5de29b
+	rlwimi	rTMP2, rWORD2, 24, 16, 23
5de29b
+	rlwimi	rTMP, rWORD1, 24, 16, 23
5de29b
+	xor.	rBITDIF, rTMP, rTMP2
5de29b
+	sub	rRTN, rTMP, rTMP2
5de29b
+	bgelr+
5de29b
+	ori	rRTN, rTMP2, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
 L(endstring):
5de29b
 	and	rTMP, r7F7F, rWORD1
5de29b
 	beq	cr1, L(equal)
5de29b
 	add	rTMP, rTMP, r7F7F
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
-
5de29b
 	andc	rNEG, rNEG, rTMP
5de29b
 	blt-	L(highbit)
5de29b
 	cntlzw	rBITDIF, rBITDIF
5de29b
@@ -91,28 +125,20 @@
5de29b
 	addi	rNEG, rNEG, 7
5de29b
 	cmpw	cr1, rNEG, rBITDIF
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
-	blt-	cr1, L(equal)
5de29b
-	srawi	rRTN, rRTN, 31
5de29b
-	ori	rRTN, rRTN, 1
5de29b
-	blr
5de29b
+	bgelr+	cr1
5de29b
 L(equal):
5de29b
 	li	rRTN, 0
5de29b
 	blr
5de29b
 
5de29b
 L(different):
5de29b
-	lwzu	rWORD1, -4(rSTR1)
5de29b
+	lwz	rWORD1, -4(rSTR1)
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
-	blt-	L(highbit)
5de29b
-	srawi	rRTN, rRTN, 31
5de29b
-	ori	rRTN, rRTN, 1
5de29b
-	blr
5de29b
+	bgelr+
5de29b
 L(highbit):
5de29b
-	srwi	rWORD2, rWORD2, 24
5de29b
-	srwi	rWORD1, rWORD1, 24
5de29b
-	sub	rRTN, rWORD1, rWORD2
5de29b
+	ori	rRTN, rWORD2, 1
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align 4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S	2014-05-28 13:27:02.000000000 -0500
5de29b
@@ -27,7 +27,7 @@
5de29b
 EALIGN (BP_SYM(strncmp), 4, 0)
5de29b
 	CALL_MCOUNT 3
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -43,6 +43,7 @@
5de29b
 #define r7F7F	r9	/* constant 0x7f7f7f7f7f7f7f7f */
5de29b
 #define rNEG	r10	/* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
5de29b
 #define rBITDIF	r11	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r12
5de29b
 
5de29b
 	dcbt	0,rSTR1
5de29b
 	or	rTMP, rSTR2, rSTR1
5de29b
@@ -84,12 +85,59 @@
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
 
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	beq	cr1, L(equal)
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	rldimi	rTMP2, rTMP2, 1, 0
5de29b
+	and	rWORD2, rWORD2, rTMP2	/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	cmpd	cr1, rWORD1, rWORD2
5de29b
+	beq	cr1, L(equal)
5de29b
+	xor	rBITDIF, rWORD1, rWORD2	/* rBITDIF has bits that differ.  */
5de29b
+	neg	rNEG, rBITDIF
5de29b
+	and	rNEG, rNEG, rBITDIF	/* rNEG has LS bit that differs.  */
5de29b
+	cntlzd	rNEG, rNEG		/* bitcount of the bit.  */
5de29b
+	andi.	rNEG, rNEG, 56		/* bitcount to LS byte that differs. */
5de29b
+	sld	rWORD1, rWORD1, rNEG	/* shift left to clear MS bytes.  */
5de29b
+	sld	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt-	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(equal):
5de29b
+	li	rRTN, 0
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	ld	rWORD1, -8(rSTR1)
5de29b
+	xor	rBITDIF, rWORD1, rWORD2	/* rBITDIF has bits that differ.  */
5de29b
+	neg	rNEG, rBITDIF
5de29b
+	and	rNEG, rNEG, rBITDIF	/* rNEG has LS bit that differs.  */
5de29b
+	cntlzd	rNEG, rNEG		/* bitcount of the bit.  */
5de29b
+	andi.	rNEG, rNEG, 56		/* bitcount to LS byte that differs. */
5de29b
+	sld	rWORD1, rWORD1, rNEG	/* shift left to clear MS bytes.  */
5de29b
+	sld	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt-	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(highbit):
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
 L(endstring):
5de29b
 	and	rTMP, r7F7F, rWORD1
5de29b
 	beq	cr1, L(equal)
5de29b
 	add	rTMP, rTMP, r7F7F
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
-
5de29b
 	andc	rNEG, rNEG, rTMP
5de29b
 	blt-	L(highbit)
5de29b
 	cntlzd	rBITDIF, rBITDIF
5de29b
@@ -98,7 +146,7 @@
5de29b
 	cmpd	cr1, rNEG, rBITDIF
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
 	blt-	cr1, L(equal)
5de29b
-	sradi	rRTN, rRTN, 63
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
 	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
 L(equal):
5de29b
@@ -106,7 +154,7 @@
5de29b
 	blr
5de29b
 
5de29b
 L(different):
5de29b
-	ldu	rWORD1, -8(rSTR1)
5de29b
+	ld	rWORD1, -8(rSTR1)
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
 	blt-	L(highbit)
5de29b
@@ -114,11 +162,10 @@
5de29b
 	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
 L(highbit):
5de29b
-	srdi	rWORD2, rWORD2, 56
5de29b
-	srdi	rWORD1, rWORD1, 56
5de29b
-	sub	rRTN, rWORD1, rWORD2
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align 4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S	2014-05-28 13:27:02.000000000 -0500
5de29b
@@ -29,7 +29,7 @@
5de29b
 EALIGN (BP_SYM(strncmp),5,0)
5de29b
 	CALL_MCOUNT 3
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -45,6 +45,7 @@
5de29b
 #define r7F7F	r9	/* constant 0x7f7f7f7f7f7f7f7f */
5de29b
 #define rNEG	r10	/* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
5de29b
 #define rBITDIF	r11	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r12
5de29b
 
5de29b
 	dcbt	0,rSTR1
5de29b
 	nop
5de29b
@@ -88,12 +89,57 @@
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
 
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	beq	cr1, L(equal)
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	rldimi	rTMP2, rTMP2, 1, 0
5de29b
+	and	rWORD2, rWORD2, rTMP2	/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	cmpd	cr1, rWORD1, rWORD2
5de29b
+	beq	cr1, L(equal)
5de29b
+	cmpb	rBITDIF, rWORD1, rWORD2	/* 0xff on equal bytes.  */
5de29b
+	addi	rNEG, rBITDIF, 1
5de29b
+	orc	rNEG, rNEG, rBITDIF	/* 0's below LS differing byte.  */
5de29b
+	sldi	rNEG, rNEG, 8		/* 1's above LS differing byte.  */
5de29b
+	andc	rWORD1, rWORD1, rNEG	/* mask off MS bytes.  */
5de29b
+	andc	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(equal):
5de29b
+	li	rRTN, 0
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	ld	rWORD1, -8(rSTR1)
5de29b
+	cmpb	rBITDIF, rWORD1, rWORD2	/* 0xff on equal bytes.  */
5de29b
+	addi	rNEG, rBITDIF, 1
5de29b
+	orc	rNEG, rNEG, rBITDIF	/* 0's below LS differing byte.  */
5de29b
+	sldi	rNEG, rNEG, 8		/* 1's above LS differing byte.  */
5de29b
+	andc	rWORD1, rWORD1, rNEG	/* mask off MS bytes.  */
5de29b
+	andc	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(highbit):
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
 L(endstring):
5de29b
 	and	rTMP,r7F7F,rWORD1
5de29b
 	beq	cr1,L(equal)
5de29b
 	add	rTMP,rTMP,r7F7F
5de29b
 	xor.	rBITDIF,rWORD1,rWORD2
5de29b
-
5de29b
 	andc	rNEG,rNEG,rTMP
5de29b
 	blt	L(highbit)
5de29b
 	cntlzd	rBITDIF,rBITDIF
5de29b
@@ -102,7 +148,7 @@
5de29b
 	cmpd	cr1,rNEG,rBITDIF
5de29b
 	sub	rRTN,rWORD1,rWORD2
5de29b
 	blt	cr1,L(equal)
5de29b
-	sradi	rRTN,rRTN,63
5de29b
+	sradi	rRTN,rRTN,63		/* must return an int.  */
5de29b
 	ori	rRTN,rRTN,1
5de29b
 	blr
5de29b
 L(equal):
5de29b
@@ -110,7 +156,7 @@
5de29b
 	blr
5de29b
 
5de29b
 L(different):
5de29b
-	ldu	rWORD1,-8(rSTR1)
5de29b
+	ld	rWORD1,-8(rSTR1)
5de29b
 	xor.	rBITDIF,rWORD1,rWORD2
5de29b
 	sub	rRTN,rWORD1,rWORD2
5de29b
 	blt	L(highbit)
5de29b
@@ -118,11 +164,10 @@
5de29b
 	ori	rRTN,rRTN,1
5de29b
 	blr
5de29b
 L(highbit):
5de29b
-	srdi	rWORD2,rWORD2,56
5de29b
-	srdi	rWORD1,rWORD1,56
5de29b
-	sub	rRTN,rWORD1,rWORD2
5de29b
+	sradi	rRTN,rWORD2,63
5de29b
+	ori	rRTN,rRTN,1
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align	4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S	2014-05-28 13:37:15.000000000 -0500
5de29b
@@ -27,7 +27,7 @@
5de29b
 EALIGN (BP_SYM(strcmp), 4, 0)
5de29b
 	CALL_MCOUNT 2
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -46,6 +46,7 @@
5de29b
 #define r7F7F	r8	/* constant 0x7f7f7f7f7f7f7f7f */
5de29b
 #define rNEG	r9	/* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
5de29b
 #define rBITDIF	r10	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r11
5de29b
 
5de29b
 	CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1)
5de29b
 	CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2)
5de29b
@@ -72,19 +73,66 @@
5de29b
 	ldu	rWORD2, 8(rSTR2)
5de29b
 L(g1):	add	rTMP, rFEFE, rWORD1
5de29b
 	nor	rNEG, r7F7F, rWORD1
5de29b
-
5de29b
 	and.	rTMP, rTMP, rNEG
5de29b
 	cmpd	cr1, rWORD1, rWORD2
5de29b
 	beq+	L(g0)
5de29b
-L(endstring):
5de29b
+
5de29b
 /* OK. We've hit the end of the string. We need to be careful that
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	beq	cr1, L(equal)
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	rldimi	rTMP2, rTMP2, 1, 0
5de29b
+	and	rWORD2, rWORD2, rTMP2	/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	cmpd	cr1, rWORD1, rWORD2
5de29b
+	beq	cr1, L(equal)
5de29b
+	xor	rBITDIF, rWORD1, rWORD2	/* rBITDIF has bits that differ.  */
5de29b
+	neg	rNEG, rBITDIF
5de29b
+	and	rNEG, rNEG, rBITDIF	/* rNEG has LS bit that differs.  */
5de29b
+	cntlzd	rNEG, rNEG		/* bitcount of the bit.  */
5de29b
+	andi.	rNEG, rNEG, 56		/* bitcount to LS byte that differs. */
5de29b
+	sld	rWORD1, rWORD1, rNEG	/* shift left to clear MS bytes.  */
5de29b
+	sld	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt-	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(equal):
5de29b
+	li	rRTN, 0
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	ld	rWORD1, -8(rSTR1)
5de29b
+	xor	rBITDIF, rWORD1, rWORD2	/* rBITDIF has bits that differ.  */
5de29b
+	neg	rNEG, rBITDIF
5de29b
+	and	rNEG, rNEG, rBITDIF	/* rNEG has LS bit that differs.  */
5de29b
+	cntlzd	rNEG, rNEG		/* bitcount of the bit.  */
5de29b
+	andi.	rNEG, rNEG, 56		/* bitcount to LS byte that differs. */
5de29b
+	sld	rWORD1, rWORD1, rNEG	/* shift left to clear MS bytes.  */
5de29b
+	sld	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt-	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(highbit):
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
+L(endstring):
5de29b
 	and	rTMP, r7F7F, rWORD1
5de29b
 	beq	cr1, L(equal)
5de29b
 	add	rTMP, rTMP, r7F7F
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
-
5de29b
 	andc	rNEG, rNEG, rTMP
5de29b
 	blt-	L(highbit)
5de29b
 	cntlzd	rBITDIF, rBITDIF
5de29b
@@ -93,7 +141,7 @@
5de29b
 	cmpd	cr1, rNEG, rBITDIF
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
 	blt-	cr1, L(equal)
5de29b
-	sradi	rRTN, rRTN, 63
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
 	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
 L(equal):
5de29b
@@ -110,12 +158,11 @@
5de29b
 	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
 L(highbit):
5de29b
-	srdi	rWORD2, rWORD2, 56
5de29b
-	srdi	rWORD1, rWORD1, 56
5de29b
-	sub	rRTN, rWORD1, rWORD2
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
 	/* GKM FIXME: check high bounds.  */
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align 4
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S	2014-05-28 13:26:59.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S	2014-05-28 13:38:31.000000000 -0500
5de29b
@@ -27,7 +27,7 @@
5de29b
 EALIGN (BP_SYM(strncmp), 4, 0)
5de29b
 	CALL_MCOUNT 3
5de29b
 
5de29b
-#define rTMP	r0
5de29b
+#define rTMP2	r0
5de29b
 #define rRTN	r3
5de29b
 #define rSTR1	r3	/* first string arg */
5de29b
 #define rSTR2	r4	/* second string arg */
5de29b
@@ -41,6 +41,7 @@
5de29b
 #define r7F7F	r9	/* constant 0x7f7f7f7f7f7f7f7f */
5de29b
 #define rNEG	r10	/* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
5de29b
 #define rBITDIF	r11	/* bits that differ in s1 & s2 words */
5de29b
+#define rTMP	r12
5de29b
 
5de29b
 	dcbt	0,rSTR1
5de29b
 	or	rTMP, rSTR2, rSTR1
5de29b
@@ -81,13 +82,60 @@
5de29b
 /* OK. We've hit the end of the string. We need to be careful that
5de29b
    we don't compare two strings as different because of gunk beyond
5de29b
    the end of the strings...  */
5de29b
-	
5de29b
+
5de29b
+#ifdef __LITTLE_ENDIAN__
5de29b
+L(endstring):
5de29b
+	addi    rTMP2, rTMP, -1
5de29b
+	beq	cr1, L(equal)
5de29b
+	andc    rTMP2, rTMP2, rTMP
5de29b
+	rldimi	rTMP2, rTMP2, 1, 0
5de29b
+	and	rWORD2, rWORD2, rTMP2	/* Mask off gunk.  */
5de29b
+	and	rWORD1, rWORD1, rTMP2
5de29b
+	cmpd	cr1, rWORD1, rWORD2
5de29b
+	beq	cr1, L(equal)
5de29b
+	xor	rBITDIF, rWORD1, rWORD2	/* rBITDIF has bits that differ.  */
5de29b
+	neg	rNEG, rBITDIF
5de29b
+	and	rNEG, rNEG, rBITDIF	/* rNEG has LS bit that differs.  */
5de29b
+	cntlzd	rNEG, rNEG		/* bitcount of the bit.  */
5de29b
+	andi.	rNEG, rNEG, 56		/* bitcount to LS byte that differs. */
5de29b
+	sld	rWORD1, rWORD1, rNEG	/* shift left to clear MS bytes.  */
5de29b
+	sld	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt-	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(equal):
5de29b
+	li	rRTN, 0
5de29b
+	blr
5de29b
+
5de29b
+L(different):
5de29b
+	ld	rWORD1, -8(rSTR1)
5de29b
+	xor	rBITDIF, rWORD1, rWORD2	/* rBITDIF has bits that differ.  */
5de29b
+	neg	rNEG, rBITDIF
5de29b
+	and	rNEG, rNEG, rBITDIF	/* rNEG has LS bit that differs.  */
5de29b
+	cntlzd	rNEG, rNEG		/* bitcount of the bit.  */
5de29b
+	andi.	rNEG, rNEG, 56		/* bitcount to LS byte that differs. */
5de29b
+	sld	rWORD1, rWORD1, rNEG	/* shift left to clear MS bytes.  */
5de29b
+	sld	rWORD2, rWORD2, rNEG
5de29b
+	xor.	rBITDIF, rWORD1, rWORD2
5de29b
+	sub	rRTN, rWORD1, rWORD2
5de29b
+	blt-	L(highbit)
5de29b
+	sradi	rRTN, rRTN, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+L(highbit):
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
+	blr
5de29b
+
5de29b
+#else
5de29b
 L(endstring):
5de29b
 	and	rTMP, r7F7F, rWORD1
5de29b
 	beq	cr1, L(equal)
5de29b
 	add	rTMP, rTMP, r7F7F
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
-
5de29b
 	andc	rNEG, rNEG, rTMP
5de29b
 	blt-	L(highbit)
5de29b
 	cntlzd	rBITDIF, rBITDIF
5de29b
@@ -96,7 +144,7 @@
5de29b
 	cmpd	cr1, rNEG, rBITDIF
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
 	blt-	cr1, L(equal)
5de29b
-	sradi	rRTN, rRTN, 63
5de29b
+	sradi	rRTN, rRTN, 63		/* must return an int.  */
5de29b
 	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
 L(equal):
5de29b
@@ -104,7 +152,7 @@
5de29b
 	blr
5de29b
 
5de29b
 L(different):
5de29b
-	ldu	rWORD1, -8(rSTR1)
5de29b
+	ld	rWORD1, -8(rSTR1)
5de29b
 	xor.	rBITDIF, rWORD1, rWORD2
5de29b
 	sub	rRTN, rWORD1, rWORD2
5de29b
 	blt-	L(highbit)
5de29b
@@ -112,11 +160,10 @@
5de29b
 	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
 L(highbit):
5de29b
-	srdi	rWORD2, rWORD2, 56
5de29b
-	srdi	rWORD1, rWORD1, 56
5de29b
-	sub	rRTN, rWORD1, rWORD2
5de29b
+	sradi	rRTN, rWORD2, 63
5de29b
+	ori	rRTN, rRTN, 1
5de29b
 	blr
5de29b
-
5de29b
+#endif
5de29b
 
5de29b
 /* Oh well.  In this case, we just do a byte-by-byte comparison.  */
5de29b
 	.align 4