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