summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32/power4/strncmp.S
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2011-04-17 22:03:53 -0400
committerUlrich Drepper <drepper@gmail.com>2011-04-17 22:03:53 -0400
commit4420675c9d361643d1179ad67e0bb35c8fbdd1ce (patch)
treeed77b603e1b450eab5bcc27d78ce246bf87a5260 /sysdeps/powerpc/powerpc32/power4/strncmp.S
parent75ea32abcde4e1699328354e1804ea94560d2950 (diff)
downloadglibc-4420675c9d361643d1179ad67e0bb35c8fbdd1ce.tar.gz
glibc-4420675c9d361643d1179ad67e0bb35c8fbdd1ce.tar.xz
glibc-4420675c9d361643d1179ad67e0bb35c8fbdd1ce.zip
Fix POWER4/POWER7 optimized strncmp to not read past differing bytes
Diffstat (limited to 'sysdeps/powerpc/powerpc32/power4/strncmp.S')
-rw-r--r--sysdeps/powerpc/powerpc32/power4/strncmp.S11
1 files changed, 6 insertions, 5 deletions
diff --git a/sysdeps/powerpc/powerpc32/power4/strncmp.S b/sysdeps/powerpc/powerpc32/power4/strncmp.S
index fc0835ebe0..f5d47af1eb 100644
--- a/sysdeps/powerpc/powerpc32/power4/strncmp.S
+++ b/sysdeps/powerpc/powerpc32/power4/strncmp.S
@@ -1,5 +1,5 @@
 /* Optimized strcmp implementation for PowerPC32.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -139,30 +139,31 @@ L(u1):
 	bdz	L(u4)
 	cmpw	rWORD1, rWORD2
 	beq-	cr1, L(u4)
+	bne-	L(u4)
 	lbzu    rWORD3, 1(rSTR1)
 	lbzu	rWORD4, 1(rSTR2)
-	bne-	L(u4)
 	cmpwi	cr1, rWORD3, 0
 	bdz	L(u3)
 	cmpw	rWORD3, rWORD4
 	beq-    cr1, L(u3)
+	bne-    L(u3)
 	lbzu	rWORD1, 1(rSTR1)
 	lbzu	rWORD2, 1(rSTR2)
-	bne-    L(u3)
 	cmpwi	cr1, rWORD1, 0
 	bdz	L(u4)
 	cmpw	rWORD1, rWORD2
 	beq-	cr1, L(u4)
+	bne-	L(u4)
 	lbzu	rWORD3, 1(rSTR1)
 	lbzu	rWORD4, 1(rSTR2)
-	bne-	L(u4)
 	cmpwi	cr1, rWORD3, 0
 	bdz	L(u3)
 	cmpw	rWORD3, rWORD4
 	beq-    cr1, L(u3)
+	bne-	L(u3)
 	lbzu	rWORD1, 1(rSTR1)
 	lbzu	rWORD2, 1(rSTR2)
-	beq+    L(u1)
+	b       L(u1)
 
 L(u3):  sub     rRTN, rWORD3, rWORD4
         blr