summaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-04-18 22:41:46 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-04-22 20:00:24 +0200
commite71fc570caec4f2d4bbe729dfe9eb41bfe5a732a (patch)
tree3e9036c730288367ef489989e05b4452ca1116c8 /libc/string
parent298f58e073b2782bd264edea969769b7b5e7cf41 (diff)
arm: Add BX and BXC macros
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/arm/_memcpy.S18
-rw-r--r--libc/string/arm/memcmp.S12
-rw-r--r--libc/string/arm/memset.S13
-rw-r--r--libc/string/arm/strcmp.S6
-rw-r--r--libc/string/arm/strlen.S7
5 files changed, 9 insertions, 47 deletions
diff --git a/libc/string/arm/_memcpy.S b/libc/string/arm/_memcpy.S
index c59f5b808..2999e8ee6 100644
--- a/libc/string/arm/_memcpy.S
+++ b/libc/string/arm/_memcpy.S
@@ -111,11 +111,7 @@ _memcpy:
bcc .Lmemcpy_backwards
IT(t, eq) /* Quick abort for src=dst */
-#if defined(__USE_BX__)
- bxeq lr
-#else
- moveq pc, lr
-#endif
+ BXC(eq, lr)
stmdb sp!, {r0, lr} /* memcpy() returns dest addr */
subs r2, r2, #4
blt .Lmemcpy_fl4 /* less than 4 bytes */
@@ -455,11 +451,7 @@ _memcpy:
/* less than 4 bytes to go */
adds r2, r2, #4
IT(t, eq)
-#if defined(__USE_BX__)
- bxeq lr
-#else
- moveq pc, lr /* done */
-#endif
+ BXC(eq, lr) /* done */
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1, #-1]!
@@ -477,11 +469,7 @@ _memcpy:
ldrgtb r3, [r1, #-1]!
strgtb r3, [r0, #-1]!
#endif
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
/* erg - unaligned destination */
.Lmemcpy_bdestul:
cmp r12, #2
diff --git a/libc/string/arm/memcmp.S b/libc/string/arm/memcmp.S
index 9f7841559..5b9473cd0 100644
--- a/libc/string/arm/memcmp.S
+++ b/libc/string/arm/memcmp.S
@@ -67,11 +67,7 @@ memcmp:
subs r2, r2, #1
IT(tt, mi)
movmi r0, #0
-#if defined(__USE_BX__)
- bxmi lr
-#else
- movmi pc, lr
-#endif
+ BXC(mi, lr)
/* ip == last src address to compare */
add ip, r0, r2
1:
@@ -82,11 +78,7 @@ memcmp:
cmpcs r2, r3
beq 1b
sub r0, r2, r3
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
.size memcmp,.-memcmp
diff --git a/libc/string/arm/memset.S b/libc/string/arm/memset.S
index 8ddc47eb1..2be4850e4 100644
--- a/libc/string/arm/memset.S
+++ b/libc/string/arm/memset.S
@@ -17,7 +17,6 @@
<http://www.gnu.org/licenses/>. */
#include <features.h>
-#include <sys/syscall.h>
#include <bits/arm_asm.h>
#include <bits/arm_bx.h>
@@ -109,11 +108,7 @@ memset:
2:
movs a3, a3 @ anything left?
IT(t, eq)
-#if defined(__USE_BX__)
- bxeq lr
-#else
- moveq pc, lr @ nope
-#endif
+ BXC(eq, lr) @ nope
#if defined (__thumb2__)
1:
strb a2, [a4], #1
@@ -131,11 +126,7 @@ memset:
strb a2, [a4], $1
strb a2, [a4], $1
strb a2, [a4], $1
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
#endif
diff --git a/libc/string/arm/strcmp.S b/libc/string/arm/strcmp.S
index 8b77ab0f1..81416a9a5 100644
--- a/libc/string/arm/strcmp.S
+++ b/libc/string/arm/strcmp.S
@@ -63,11 +63,7 @@ strcmp:
cmpcs r2, r3
beq 1b
sub r0, r2, r3
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
.size strcmp,.-strcmp
diff --git a/libc/string/arm/strlen.S b/libc/string/arm/strlen.S
index 0e7737e23..9995d768c 100644
--- a/libc/string/arm/strlen.S
+++ b/libc/string/arm/strlen.S
@@ -18,7 +18,6 @@
#include <features.h>
#include <endian.h>
-#include <sys/syscall.h>
#include <bits/arm_asm.h>
#include <bits/arm_bx.h>
@@ -99,11 +98,7 @@ Llastword: @ drop through to here once we find a
IT(t, ne)
addne r0, r0, $1 @ must be zero)
#endif
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc,lr
-#endif
+ BX(lr)
#endif
.size strlen,.-strlen