Module Name:    src
Committed By:   matt
Date:           Fri Jul 19 16:42:12 UTC 2013

Modified Files:
        src/common/lib/libc/arch/m68k/string: memset.S strcmp.S strncmp.S

Log Message:
With these changes, they now produce identical binary as before the coldfire
changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/m68k/string/memset.S \
    src/common/lib/libc/arch/m68k/string/strcmp.S \
    src/common/lib/libc/arch/m68k/string/strncmp.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/m68k/string/memset.S
diff -u src/common/lib/libc/arch/m68k/string/memset.S:1.5 src/common/lib/libc/arch/m68k/string/memset.S:1.6
--- src/common/lib/libc/arch/m68k/string/memset.S:1.5	Thu Jul 18 22:42:50 2013
+++ src/common/lib/libc/arch/m68k/string/memset.S	Fri Jul 19 16:42:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: memset.S,v 1.5 2013/07/18 22:42:50 matt Exp $	*/
+/*	$NetBSD: memset.S,v 1.6 2013/07/19 16:42:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 	RCSID("from: @(#)bzero.s	5.1 (Berkeley) 5/12/90")
 #else
-	RCSID("$NetBSD: memset.S,v 1.5 2013/07/18 22:42:50 matt Exp $")
+	RCSID("$NetBSD: memset.S,v 1.6 2013/07/19 16:42:12 matt Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -76,11 +76,7 @@ ENTRY(memset)
 	movl	%d2,-(%sp)
 	movl	8(%sp),%a0		| destination
 	movl	16(%sp),%d1		| count
-#ifdef __mcoldfire__
-	mvzb	15(%sp),%d2		| zero extend fill character
-#else
 	movb	15(%sp),%d2		| get fill character
-#endif
 
 	/* 
 	 * It isn't worth the overhead of aligning to {long}word boundries
@@ -89,15 +85,15 @@ ENTRY(memset)
 	cmpl	#15,%d1
 	jlt	Lbzbyte
 
-#ifndef __mcoldfire__
-	andb	0xff,%d2		| clear high bytes
-#endif
-	movl	%d2,%d0
-	lsll	#8,%d0			| shift to 8-15
-	orl	%d0,%d2			| merge so low word is done
-	movl	%d2,%d0 		| copy word
-	swap	%d0			| swap it
-	orl	%d0,%d2			| put it upper half
+	clrl %d0
+	moveb	%d2,%d0
+	movel	%d0,%d2
+	lsll	#8,%d0
+	orl	%d0,%d2
+	lsll	#8,%d0	
+	orl	%d0,%d2	
+	lsll	#8,%d0	
+	orl	%d0,%d2	
 
 	/* word align */
 	movl	%a0,%d0
Index: src/common/lib/libc/arch/m68k/string/strcmp.S
diff -u src/common/lib/libc/arch/m68k/string/strcmp.S:1.5 src/common/lib/libc/arch/m68k/string/strcmp.S:1.6
--- src/common/lib/libc/arch/m68k/string/strcmp.S:1.5	Thu Jul 18 22:42:50 2013
+++ src/common/lib/libc/arch/m68k/string/strcmp.S	Fri Jul 19 16:42:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: strcmp.S,v 1.5 2013/07/18 22:42:50 matt Exp $	*/
+/*	$NetBSD: strcmp.S,v 1.6 2013/07/19 16:42:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include <machine/asm.h>
 
 #if defined(LIBC_SCCS) && !defined(lint)
-	RCSID("$NetBSD: strcmp.S,v 1.5 2013/07/18 22:42:50 matt Exp $")
+	RCSID("$NetBSD: strcmp.S,v 1.6 2013/07/19 16:42:12 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef __mcoldfire__
@@ -69,10 +69,13 @@ L1:				/* unrolled by 4 for 680[23]0's *
 	jeq	L1
 
 L3:
-#ifndef __mcoldfire__
-	EXTBL(%d1)
-#endif
+#ifdef __mcoldfire__
 	movl	%d1,%d0
+#else
+	scs	%d0
+	EXTBL(%d0)
+	movb	%d1,%d0
+#endif
 	rts
 
 L2:	movq	#0,%d0
Index: src/common/lib/libc/arch/m68k/string/strncmp.S
diff -u src/common/lib/libc/arch/m68k/string/strncmp.S:1.5 src/common/lib/libc/arch/m68k/string/strncmp.S:1.6
--- src/common/lib/libc/arch/m68k/string/strncmp.S:1.5	Thu Jul 18 22:42:50 2013
+++ src/common/lib/libc/arch/m68k/string/strncmp.S	Fri Jul 19 16:42:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: strncmp.S,v 1.5 2013/07/18 22:42:50 matt Exp $	*/
+/*	$NetBSD: strncmp.S,v 1.6 2013/07/19 16:42:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include <machine/asm.h>
 
 #if defined(LIBC_SCCS) && !defined(lint)
-	RCSID("$NetBSD: strncmp.S,v 1.5 2013/07/18 22:42:50 matt Exp $")
+	RCSID("$NetBSD: strncmp.S,v 1.6 2013/07/19 16:42:12 matt Exp $")
 #endif /* LIBC_SCCS and not lint */
 
 
@@ -50,7 +50,9 @@ ENTRY(strncmp)
 	jeq	L4
 	movl	4(%sp),%a0
 	movl	8(%sp),%a1
+#ifdef __coldfire__
 	movl	%d2,-(%sp)	| save temp
+#endif
 L1:				/* unroll by 4 for m680[23]0's */
 	GETC((%a0)+,%d1)
 	jeq	L2
@@ -88,9 +90,11 @@ L2:	SUBC((%a1),%d1)
 L3:	
 #ifdef __mcoldfire__
 	movl	(%sp)+,%d2		| restore temp
+	movl	%d1,%d0
 #else
-	EXTBL(%d1)
+	scs	%d0
+	EXTBL(%d0)
+	moveb	%d1,%d0
 #endif
-	movl	%d1,%d0
 	rts
 END(strncmp)

Reply via email to