diff mbox

[COMMITTED] Sparc memchr/memcmp/strncmp fixes from Il'ya Malakhov.

Message ID 20150417.132716.2222341333915566706.davem@davemloft.net
State New
Headers show

Commit Message

David Miller April 17, 2015, 5:27 p.m. UTC
[BZ #17825]
	* sysdeps/sparc/sparc64/memchr.S: Fix signedness handling of length.
	* sysdeps/sparc/sparc64/memcmp.S: Likewise.
	* sysdeps/sparc/sparc64/strncmp.S: Likewise.
---
 ChangeLog                       | 7 +++++++
 sysdeps/sparc/sparc64/memchr.S  | 3 ++-
 sysdeps/sparc/sparc64/memcmp.S  | 4 ++--
 sysdeps/sparc/sparc64/strncmp.S | 4 ++--
 4 files changed, 13 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index 215fd11..d8580ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@ 
+2015-04-16  Il'ya Malakhov <ilmalakhov@yandex.ru>
+
+	[BZ #17825]
+	* sysdeps/sparc/sparc64/memchr.S: Fix signedness handling of length.
+	* sysdeps/sparc/sparc64/memcmp.S: Likewise.
+	* sysdeps/sparc/sparc64/strncmp.S: Likewise.
+
 2015-04-16  David S. Miller  <davem@davemloft.net>
 
 	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Make use of
diff --git a/sysdeps/sparc/sparc64/memchr.S b/sysdeps/sparc/sparc64/memchr.S
index 23ed62e..d92bad1 100644
--- a/sysdeps/sparc/sparc64/memchr.S
+++ b/sysdeps/sparc/sparc64/memchr.S
@@ -63,7 +63,8 @@  ENTRY(__memchr)
 	be,pn		%XCC, 12f			/* CTI				*/
 #endif
 	 sll		%o1, 8, %g3			/* IEU0		Group		*/
-	add		%o0, %o2, %o2			/* IEU1				*/
+	addcc		%o0, %o2, %o2			/* IEU1				*/
+	movcs		%XCC, -1, %o2			/* IEU0		Group		*/
 
 	sethi		%hi(0x01010101), %g1		/* IEU0		Group		*/
 	or		%g3, %o1, %g3			/* IEU1				*/
diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
index 18ed0ce..552307e 100644
--- a/sysdeps/sparc/sparc64/memcmp.S
+++ b/sysdeps/sparc/sparc64/memcmp.S
@@ -51,7 +51,7 @@  ENTRY(memcmp)
 2:	mov		%g1, %o3			/* IEU0		Group		*/
 	subcc		%o2, 8, %o2			/* IEU1				*/
 
-	bl,pn		%XCC, 5f			/* CTI				*/
+	bcs,pn		%XCC, 5f			/* CTI				*/
 	 ldxa		[%o0] ASI_PNF, %g1		/* Load		Group		*/
 	mov		%g2, %o4			/* IEU0				*/
 	ldxa		[%o0 + %o1] ASI_PNF, %g2	/* Load		Group		*/
@@ -125,7 +125,7 @@  ENTRY(memcmp)
 
 	ldxa		[%o0] ASI_PNF, %g5		/* Load				*/
 	subcc		%o2, 8, %o2			/* IEU1		Group		*/
-	bl,pn		%XCC, 6b			/* CTI				*/
+	bcs,pn		%XCC, 6b			/* CTI				*/
 	 or		%o4, %o5, %o4			/* IEU0				*/
 
 	cmp		%o3, %o4			/* IEU1		Group		*/
diff --git a/sysdeps/sparc/sparc64/strncmp.S b/sysdeps/sparc/sparc64/strncmp.S
index cf8f56e..233b62b 100644
--- a/sysdeps/sparc/sparc64/strncmp.S
+++ b/sysdeps/sparc/sparc64/strncmp.S
@@ -72,7 +72,7 @@  ENTRY(strncmp)
 
 	add		%o0, 8, %o0			/* IEU1				*/
 2:	subcc		%o2, 8, %o2			/* IEU1		Group		*/
-	bl,pn		%XCC, 5f			/* CTI				*/
+	bcs,pn		%XCC, 5f			/* CTI				*/
 	 add		%o1, 8, %o1			/* IEU0				*/
 
 	sub		%g4, %g1, %g3			/* IEU0		Group		*/
@@ -310,7 +310,7 @@  ENTRY(strncmp)
 	addcc		%o0, 8, %o0			/* IEU1				*/
 	srlx		%o4, %g6, %o5			/* IEU0				*/
 	subcc		%o2, 8, %o2			/* IEU1		Group		*/
-	bl,pn		%XCC, 5b			/* CTI				*/
+	bcs,pn		%XCC, 5b			/* CTI				*/
 
 	 or		%o3, %o5, %o3			/* IEU0				*/
 	cmp		%g4, %o3			/* IEU1		Group		*/