Module Name:    src
Committed By:   matt
Date:           Mon Aug 19 02:54:02 UTC 2013

Modified Files:
        src/common/lib/libc/arch/arm/string: strcat_naive.S

Log Message:
Thumbify


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/strcat_naive.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/arm/string/strcat_naive.S
diff -u src/common/lib/libc/arch/arm/string/strcat_naive.S:1.1 src/common/lib/libc/arch/arm/string/strcat_naive.S:1.2
--- src/common/lib/libc/arch/arm/string/strcat_naive.S:1.1	Mon Jan 14 16:36:15 2013
+++ src/common/lib/libc/arch/arm/string/strcat_naive.S	Mon Aug 19 02:54:02 2013
@@ -29,10 +29,34 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: strcat_naive.S,v 1.1 2013/01/14 16:36:15 matt Exp $")
+RCSID("$NetBSD: strcat_naive.S,v 1.2 2013/08/19 02:54:02 matt Exp $")
 
 ENTRY(strcat)
 	mov	ip, r0			/* need to preserve r0 */
+#if defined(__thumb__)
+1:	ldrb	r2, [r0]		/* load next byte */
+	adds	r0, r0, #1		/* advance */
+#if defined(_ARM_ARCH_T2)
+	cbnz	r2, 1b			/* was it a NUL?  no, get next byte */
+#else
+	cmp	r2, #0			/* was it a NUL? */
+	bne	1b			/*   no, get next byte */
+#endif
+	subs	r0, r0, #1		/* back up one to the NUL */
+	subs	r1, r1, r0		/* save one increment */
+2:	ldrb	r2, [r1, r0]		/* load next byte from append */
+	strb	r2, [r0]		/* store it */
+	adds	r0, r0, #1		/* advance */
+#if defined(_ARM_ARCH_T2)
+	cbnz	r2, 1b			/* was it a NUL?  no, get next byte */
+#else
+	cmp	r2, #0			/* was it a NUL? */
+	bne	2b			/*   no, get next byte */
+#endif
+	mov	r0, ip			/* restore dst address */
+	RET				/* return */
+#else /* !__thumb__ */
+	mov	ip, r0			/* need to preserve r0 */
 1:	ldrb	r2, [ip], #1		/* load next byte */
 	teq	r2, #0			/* was it a NUL? */
 	bne	1b			/*   no, get next byte */
@@ -42,4 +66,5 @@ ENTRY(strcat)
 	teq	r2, #0			/* was it a NUL? */
 	bne	2b			/*   no, get next byte */
 	RET				/* return */
+#endif
 END(strcat)

Reply via email to