Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/arch/arm/string Thumbify
details: https://anonhg.NetBSD.org/src/rev/5727ebeabc49
branches: trunk
changeset: 789439:5727ebeabc49
user: matt <matt%NetBSD.org@localhost>
date: Mon Aug 19 02:54:02 2013 +0000
description:
Thumbify
diffstat:
common/lib/libc/arch/arm/string/strcat_naive.S | 27 +++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diffs (45 lines):
diff -r e8189664ceb6 -r 5727ebeabc49 common/lib/libc/arch/arm/string/strcat_naive.S
--- a/common/lib/libc/arch/arm/string/strcat_naive.S Mon Aug 19 02:37:12 2013 +0000
+++ b/common/lib/libc/arch/arm/string/strcat_naive.S Mon Aug 19 02:54:02 2013 +0000
@@ -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 @@
teq r2, #0 /* was it a NUL? */
bne 2b /* no, get next byte */
RET /* return */
+#endif
END(strcat)
Home |
Main Index |
Thread Index |
Old Index