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 Switch to unified syntax
details: https://anonhg.NetBSD.org/src/rev/c45dd77436cb
branches: trunk
changeset: 789221:c45dd77436cb
user: matt <matt%NetBSD.org@localhost>
date: Sun Aug 11 04:56:32 2013 +0000
description:
Switch to unified syntax
use RET/RETc
use push/pop
diffstat:
common/lib/libc/arch/arm/string/memcmp.S | 20 +-
common/lib/libc/arch/arm/string/memcpy_arm.S | 57 +++---
common/lib/libc/arch/arm/string/memcpy_xscale.S | 198 ++++++++++++------------
common/lib/libc/arch/arm/string/memmove.S | 98 +++++-----
common/lib/libc/arch/arm/string/memset.S | 102 ++++++------
common/lib/libc/arch/arm/string/strcpy_arm.S | 8 +-
common/lib/libc/arch/arm/string/strrchr_arm.S | 6 +-
7 files changed, 245 insertions(+), 244 deletions(-)
diffs (truncated from 1464 to 300 lines):
diff -r aa9a7bfd055f -r c45dd77436cb common/lib/libc/arch/arm/string/memcmp.S
--- a/common/lib/libc/arch/arm/string/memcmp.S Sun Aug 11 04:41:17 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memcmp.S Sun Aug 11 04:56:32 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: memcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
+/* $NetBSD: memcmp.S,v 1.2 2013/08/11 04:56:32 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -64,7 +64,7 @@
#include <machine/asm.h>
-RCSID("$NetBSD: memcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $")
+RCSID("$NetBSD: memcmp.S,v 1.2 2013/08/11 04:56:32 matt Exp $")
ENTRY(memcmp)
mov ip, r0
@@ -76,7 +76,7 @@
/* Are both addresses aligned the same way? */
cmp r2, #0x00
- eornes r3, ip, r1
+ eorsne r3, ip, r1
RETc(eq) /* len == 0, or same addresses! */
tst r3, #0x03
subne r2, r2, #0x01
@@ -157,23 +157,23 @@
ldrb r0, [ip, #0x00] /* r0 = b1#0 */
ldrb r2, [r1, #0x01] /* r2 = b2#1 */
subs r0, r0, r3 /* r0 = b1#0 - b2#0 */
- ldreqb r3, [ip, #0x01] /* r3 = b1#1 */
+ ldrbeq r3, [ip, #0x01] /* r3 = b1#1 */
RETc(ne) /* Return if mismatch on #0 */
subs r0, r3, r2 /* r0 = b1#1 - b2#1 */
- ldreqb r3, [r1, #0x02] /* r3 = b2#2 */
- ldreqb r0, [ip, #0x02] /* r0 = b1#2 */
+ ldrbeq r3, [r1, #0x02] /* r3 = b2#2 */
+ ldrbeq r0, [ip, #0x02] /* r0 = b1#2 */
RETc(ne) /* Return if mismatch on #1 */
ldrb r2, [r1, #0x03] /* r2 = b2#3 */
subs r0, r0, r3 /* r0 = b1#2 - b2#2 */
- ldreqb r3, [ip, #0x03] /* r3 = b1#3 */
+ ldrbeq r3, [ip, #0x03] /* r3 = b1#3 */
RETc(ne) /* Return if mismatch on #2 */
subs r0, r3, r2 /* r0 = b1#3 - b2#3 */
- ldreqb r3, [r1, #0x04] /* r3 = b2#4 */
- ldreqb r0, [ip, #0x04] /* r0 = b1#4 */
+ ldrbeq r3, [r1, #0x04] /* r3 = b2#4 */
+ ldrbeq r0, [ip, #0x04] /* r0 = b1#4 */
RETc(ne) /* Return if mismatch on #3 */
ldrb r2, [r1, #0x05] /* r2 = b2#5 */
subs r0, r0, r3 /* r0 = b1#4 - b2#4 */
- ldreqb r3, [ip, #0x05] /* r3 = b1#5 */
+ ldrbeq r3, [ip, #0x05] /* r3 = b1#5 */
RETc(ne) /* Return if mismatch on #4 */
sub r0, r3, r2 /* r0 = b1#5 - b2#5 */
RET
diff -r aa9a7bfd055f -r c45dd77436cb common/lib/libc/arch/arm/string/memcpy_arm.S
--- a/common/lib/libc/arch/arm/string/memcpy_arm.S Sun Aug 11 04:41:17 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memcpy_arm.S Sun Aug 11 04:56:32 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: memcpy_arm.S,v 1.3 2013/01/28 06:23:44 matt Exp $ */
+/* $NetBSD: memcpy_arm.S,v 1.4 2013/08/11 04:56:32 matt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
/* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */
ENTRY(memcpy)
/* save leaf functions having to store this away */
- stmdb sp!, {r0, lr} /* memcpy() returns dest addr */
+ push {r0, lr} /* memcpy() returns dest addr */
subs r2, r2, #4
blt .Lmemcpy_l4 /* less than 4 bytes */
@@ -82,7 +82,7 @@
blt .Lmemcpy_l12 /* less than 12 bytes (4 from above) */
subs r2, r2, #0x14
blt .Lmemcpy_l32 /* less than 32 bytes (12 from above) */
- stmdb sp!, {r4} /* borrow r4 */
+ push {r4} /* borrow r4 */
/* blat 32 bytes at a time */
/* XXX for really big copies perhaps we should use more registers */
@@ -95,19 +95,19 @@
bge .Lmemcpy_loop32
cmn r2, #0x10
- ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
- stmgeia r0!, {r3, r4, r12, lr}
+ ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
+ stmiage r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
- ldmia sp!, {r4} /* return r4 */
+ pop {r4} /* return r4 */
.Lmemcpy_l32:
adds r2, r2, #0x14
/* blat 12 bytes at a time */
.Lmemcpy_loop12:
- ldmgeia r1!, {r3, r12, lr}
- stmgeia r0!, {r3, r12, lr}
- subges r2, r2, #0x0c
+ ldmiage r1!, {r3, r12, lr}
+ stmiage r0!, {r3, r12, lr}
+ subsge r2, r2, #0x0c
bge .Lmemcpy_loop12
.Lmemcpy_l12:
@@ -117,27 +117,27 @@
subs r2, r2, #4
ldrlt r3, [r1], #4
strlt r3, [r0], #4
- ldmgeia r1!, {r3, r12}
- stmgeia r0!, {r3, r12}
+ ldmiage r1!, {r3, r12}
+ stmiage r0!, {r3, r12}
subge r2, r2, #4
.Lmemcpy_l4:
/* less than 4 bytes to go */
adds r2, r2, #4
#ifdef __APCS_26_
- ldmeqia sp!, {r0, pc}^ /* done */
+ ldmiaeq sp!, {r0, pc}^ /* done */
#else
- ldmeqia sp!, {r0, pc} /* done */
+ popeq {r0, pc} /* done */
#endif
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1], #1
strb r3, [r0], #1
- ldrgeb r3, [r1], #1
- strgeb r3, [r0], #1
- ldrgtb r3, [r1], #1
- strgtb r3, [r0], #1
- ldmia sp!, {r0, pc}
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
+ pop {r0, pc}
/* erg - unaligned destination */
.Lmemcpy_destul:
@@ -147,10 +147,10 @@
/* align destination with byte copies */
ldrb r3, [r1], #1
strb r3, [r0], #1
- ldrgeb r3, [r1], #1
- strgeb r3, [r0], #1
- ldrgtb r3, [r1], #1
- strgtb r3, [r0], #1
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
subs r2, r2, r12
blt .Lmemcpy_l4 /* less the 4 bytes */
@@ -168,7 +168,7 @@
cmp r2, #0x0c
blt .Lmemcpy_srcul1loop4
sub r2, r2, #0x0c
- stmdb sp!, {r4, r5}
+ push {r4, r5}
.Lmemcpy_srcul1loop16:
#ifdef __ARMEB__
@@ -197,7 +197,7 @@
stmia r0!, {r3-r5, r12}
subs r2, r2, #0x10
bge .Lmemcpy_srcul1loop16
- ldmia sp!, {r4, r5}
+ pop {r4, r5}
adds r2, r2, #0x0c
blt .Lmemcpy_srcul1l4
@@ -225,7 +225,7 @@
cmp r2, #0x0c
blt .Lmemcpy_srcul2loop4
sub r2, r2, #0x0c
- stmdb sp!, {r4, r5}
+ push {r4, r5}
.Lmemcpy_srcul2loop16:
#ifdef __ARMEB__
@@ -254,7 +254,7 @@
stmia r0!, {r3-r5, r12}
subs r2, r2, #0x10
bge .Lmemcpy_srcul2loop16
- ldmia sp!, {r4, r5}
+ pop {r4, r5}
adds r2, r2, #0x0c
blt .Lmemcpy_srcul2l4
@@ -282,7 +282,7 @@
cmp r2, #0x0c
blt .Lmemcpy_srcul3loop4
sub r2, r2, #0x0c
- stmdb sp!, {r4, r5}
+ push {r4, r5}
.Lmemcpy_srcul3loop16:
#ifdef __ARMEB__
@@ -311,7 +311,7 @@
stmia r0!, {r3-r5, r12}
subs r2, r2, #0x10
bge .Lmemcpy_srcul3loop16
- ldmia sp!, {r4, r5}
+ pop {r4, r5}
adds r2, r2, #0x0c
blt .Lmemcpy_srcul3l4
@@ -334,3 +334,4 @@
.Lmemcpy_srcul3l4:
sub r1, r1, #1
b .Lmemcpy_l4
+END(memcpy)
diff -r aa9a7bfd055f -r c45dd77436cb common/lib/libc/arch/arm/string/memcpy_xscale.S
--- a/common/lib/libc/arch/arm/string/memcpy_xscale.S Sun Aug 11 04:41:17 2013 +0000
+++ b/common/lib/libc/arch/arm/string/memcpy_xscale.S Sun Aug 11 04:56:32 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: memcpy_xscale.S,v 1.2 2007/06/21 21:37:04 scw Exp $ */
+/* $NetBSD: memcpy_xscale.S,v 1.3 2013/08/11 04:56:32 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -51,12 +51,12 @@
ldrb ip, [r1], #0x01
sub r2, r2, #0x01
strb ip, [r3], #0x01
- ldrleb ip, [r1], #0x01
+ ldrble ip, [r1], #0x01
suble r2, r2, #0x01
- strleb ip, [r3], #0x01
- ldrltb ip, [r1], #0x01
+ strble ip, [r3], #0x01
+ ldrblt ip, [r1], #0x01
sublt r2, r2, #0x01
- strltb ip, [r3], #0x01
+ strblt ip, [r3], #0x01
/* Destination buffer is now word aligned */
.Lmemcpy_wordaligned:
@@ -66,7 +66,7 @@
/* Quad-align the destination buffer */
tst r3, #0x07 /* Already quad aligned? */
ldrne ip, [r1], #0x04
- stmfd sp!, {r4-r9} /* Free up some registers */
+ push {r4-r9} /* Free up some registers */
subne r2, r2, #0x04
strne ip, [r3], #0x04
@@ -133,8 +133,8 @@
.Lmemcpy_w_lessthan128:
adds r2, r2, #0x80 /* Adjust for extra sub */
- ldmeqfd sp!, {r4-r9}
- bxeq lr /* Return now if done */
+ popeq {r4-r9}
+ RETc(eq) /* Return now if done */
subs r2, r2, #0x20
blt .Lmemcpy_w_lessthan32
@@ -158,8 +158,8 @@
.Lmemcpy_w_lessthan32:
adds r2, r2, #0x20 /* Adjust for extra sub */
- ldmeqfd sp!, {r4-r9}
- bxeq lr /* Return now if done */
+ popeq {r4-r9}
+ RETc(eq) /* Return now if done */
and r4, r2, #0x18
rsbs r4, r4, #0x18
@@ -185,21 +185,21 @@
strd r4, [r3], #0x08
/* Less than 8 bytes remaining */
- ldmfd sp!, {r4-r9}
- bxeq lr /* Return now if done */
+ pop {r4-r9}
+ RETc(eq) /* Return now if done */
subs r2, r2, #0x04
ldrge ip, [r1], #0x04
strge ip, [r3], #0x04
- bxeq lr /* Return now if done */
+ RETc(eq) /* Return now if done */
addlt r2, r2, #0x04
ldrb ip, [r1], #0x01
cmp r2, #0x02
- ldrgeb r2, [r1], #0x01
+ ldrbge r2, [r1], #0x01
strb ip, [r3], #0x01
- ldrgtb ip, [r1]
- strgeb r2, [r3], #0x01
Home |
Main Index |
Thread Index |
Old Index