summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2015-05-31 14:04:11 +0000
committerandrew <andrew@FreeBSD.org>2015-05-31 14:04:11 +0000
commitf860fdb4f87b16ee560bab5ee87a8bd11bc579ad (patch)
treefeb44ebb9072d0085e6e88e5c9f529f514768188 /lib/libc
parentd59d348b51fb13c54eb006186153f1dfacf301a9 (diff)
downloadFreeBSD-src-f860fdb4f87b16ee560bab5ee87a8bd11bc579ad.zip
FreeBSD-src-f860fdb4f87b16ee560bab5ee87a8bd11bc579ad.tar.gz
Add the needed if-then instructions to build as Thumb-2.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arm/string/ffs.S1
-rw-r--r--lib/libc/arm/string/memmove.S22
-rw-r--r--lib/libc/arm/string/memset.S22
-rw-r--r--lib/libc/arm/string/strcmp.S1
-rw-r--r--lib/libc/arm/string/strlen.S4
-rw-r--r--lib/libc/arm/string/strncmp.S3
6 files changed, 53 insertions, 0 deletions
diff --git a/lib/libc/arm/string/ffs.S b/lib/libc/arm/string/ffs.S
index 4567f6c..cc7f396 100644
--- a/lib/libc/arm/string/ffs.S
+++ b/lib/libc/arm/string/ffs.S
@@ -78,6 +78,7 @@ ENTRY(ffs)
.byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
.byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
#else
+ itt ne
clzne r0, r0
rsbne r0, r0, #32
RET
diff --git a/lib/libc/arm/string/memmove.S b/lib/libc/arm/string/memmove.S
index 94e5474..2cd5a5e 100644
--- a/lib/libc/arm/string/memmove.S
+++ b/lib/libc/arm/string/memmove.S
@@ -48,7 +48,9 @@ ENTRY(bcopy)
#endif
/* Do the buffers overlap? */
cmp r0, r1
+ it eq
RETeq /* Bail now if src/dst are the same */
+ ite cc
subcc r3, r0, r1 /* if (dst > src) r3 = dst - src */
subcs r3, r1, r0 /* if (src > dsr) r3 = src - dst */
cmp r3, r2 /* if (r3 < len) we have an overlap */
@@ -56,8 +58,10 @@ ENTRY(bcopy)
/* Determine copy direction */
cmp r1, r0
+ it cc
bcc .Lmemmove_backwards
+ itt eq
moveq r0, #0 /* Quick abort for len=0 */
RETeq
@@ -88,6 +92,7 @@ ENTRY(bcopy)
bge .Lmemmove_floop32
cmn r2, #0x10
+ ittt ge
ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmiage r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
@@ -98,6 +103,7 @@ ENTRY(bcopy)
/* blat 12 bytes at a time */
.Lmemmove_floop12:
+ ittt ge
ldmiage r1!, {r3, r12, lr}
stmiage r0!, {r3, r12, lr}
subsge r2, r2, #0x0c
@@ -108,8 +114,10 @@ ENTRY(bcopy)
blt .Lmemmove_fl4
subs r2, r2, #4
+ itt lt
ldrlt r3, [r1], #4
strlt r3, [r0], #4
+ ittt ge
ldmiage r1!, {r3, r12}
stmiage r0!, {r3, r12}
subge r2, r2, #4
@@ -117,14 +125,17 @@ ENTRY(bcopy)
.Lmemmove_fl4:
/* less than 4 bytes to go */
adds r2, r2, #4
+ it eq
ldmiaeq sp!, {r0, pc} /* done */
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1], #1
strb r3, [r0], #1
+ itt ge
ldrbge r3, [r1], #1
strbge r3, [r0], #1
+ itt gt
ldrbgt r3, [r1], #1
strbgt r3, [r0], #1
ldmia sp!, {r0, pc}
@@ -137,8 +148,10 @@ ENTRY(bcopy)
/* align destination with byte copies */
ldrb r3, [r1], #1
strb r3, [r0], #1
+ itt ge
ldrbge r3, [r1], #1
strbge r3, [r0], #1
+ itt gt
ldrbgt r3, [r1], #1
strbgt r3, [r0], #1
subs r2, r2, r12
@@ -355,10 +368,12 @@ ENTRY(bcopy)
.Lmemmove_bl32:
cmn r2, #0x10
+ ittt ge
ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmdbge r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
adds r2, r2, #0x14
+ ittt ge
ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
stmdbge r0!, {r3, r12, lr}
subge r2, r2, #0x0c
@@ -368,8 +383,10 @@ ENTRY(bcopy)
adds r2, r2, #8
blt .Lmemmove_bl4
subs r2, r2, #4
+ itt lt
ldrlt r3, [r1, #-4]!
strlt r3, [r0, #-4]!
+ ittt ge
ldmdbge r1!, {r3, r12}
stmdbge r0!, {r3, r12}
subge r2, r2, #4
@@ -377,14 +394,17 @@ ENTRY(bcopy)
.Lmemmove_bl4:
/* less than 4 bytes to go */
adds r2, r2, #4
+ it eq
RETeq /* done */
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
+ itt ge
ldrbge r3, [r1, #-1]!
strbge r3, [r0, #-1]!
+ itt gt
ldrbgt r3, [r1, #-1]!
strbgt r3, [r0, #-1]!
RET
@@ -396,8 +416,10 @@ ENTRY(bcopy)
/* align destination with byte copies */
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
+ itt ge
ldrbge r3, [r1, #-1]!
strbge r3, [r0, #-1]!
+ itt gt
ldrbgt r3, [r1, #-1]!
strbgt r3, [r0, #-1]!
subs r2, r2, r12
diff --git a/lib/libc/arm/string/memset.S b/lib/libc/arm/string/memset.S
index 66af33e..6d76901 100644
--- a/lib/libc/arm/string/memset.S
+++ b/lib/libc/arm/string/memset.S
@@ -114,6 +114,7 @@ ENTRY(memset)
orr r3, r3, r3, lsl #16 /* Extend value to 32-bits */
#endif
#ifdef _ARM_ARCH_5E
+ itt ne
subne r1, r1, #0x04 /* Quad-align if necessary */
strne r3, [ip], #0x04
cmp r1, #0x10
@@ -127,18 +128,22 @@ ENTRY(memset)
.Lmemset_loop128:
subs r1, r1, #0x80
#ifdef _ARM_ARCH_5E
+ itttt ge
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
+ itttt ge
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
+ itttt ge
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
+ itttt ge
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
@@ -162,6 +167,7 @@ ENTRY(memset)
stmiage ip!, {r2-r3}
#endif
bgt .Lmemset_loop128
+ it eq
RETeq /* Zero length so just exit */
add r1, r1, #0x80 /* Adjust for extra sub */
@@ -169,6 +175,7 @@ ENTRY(memset)
/* Do 32 bytes at a time */
.Lmemset_loop32:
subs r1, r1, #0x20
+ itttt ge
#ifdef _ARM_ARCH_5E
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
@@ -181,11 +188,13 @@ ENTRY(memset)
stmiage ip!, {r2-r3}
#endif
bgt .Lmemset_loop32
+ it eq
RETeq /* Zero length so just exit */
adds r1, r1, #0x10 /* Partially adjust for extra sub */
/* Deal with 16 bytes or more */
+ itt ge
#ifdef _ARM_ARCH_5E
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
@@ -193,20 +202,25 @@ ENTRY(memset)
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
#endif
+ it eq
RETeq /* Zero length so just exit */
+ it lt
addlt r1, r1, #0x10 /* Possibly adjust for extra sub */
/* We have at least 4 bytes so copy as words */
.Lmemset_loop4:
subs r1, r1, #0x04
+ it ge
strge r3, [ip], #0x04
bgt .Lmemset_loop4
+ it eq
RETeq /* Zero length so just exit */
#ifdef _ARM_ARCH_5E
/* Compensate for 64-bit alignment check */
adds r1, r1, #0x04
+ it eq
RETeq
cmp r1, #2
#else
@@ -214,7 +228,9 @@ ENTRY(memset)
#endif
strb r3, [ip], #0x01 /* Set 1 byte */
+ it ge
strbge r3, [ip], #0x01 /* Set another byte */
+ it gt
strbgt r3, [ip] /* and a third */
RET /* Exit */
@@ -222,18 +238,24 @@ ENTRY(memset)
rsb r2, r2, #0x004
strb r3, [ip], #0x01 /* Set 1 byte */
cmp r2, #0x02
+ it ge
strbge r3, [ip], #0x01 /* Set another byte */
sub r1, r1, r2
+ it gt
strbgt r3, [ip], #0x01 /* and a third */
cmp r1, #0x04 /* More than 4 bytes left? */
+ it ge
bge .Lmemset_wordaligned /* Yup */
.Lmemset_lessthanfour:
cmp r1, #0x00
+ it eq
RETeq /* Zero length so exit */
strb r3, [ip], #0x01 /* Set 1 byte */
cmp r1, #0x02
+ it ge
strbge r3, [ip], #0x01 /* Set another byte */
+ it gt
strbgt r3, [ip] /* and a third */
RET /* Exit */
#ifdef _BZERO
diff --git a/lib/libc/arm/string/strcmp.S b/lib/libc/arm/string/strcmp.S
index 3dd7453..d610fea 100644
--- a/lib/libc/arm/string/strcmp.S
+++ b/lib/libc/arm/string/strcmp.S
@@ -37,6 +37,7 @@ ENTRY(strcmp)
ldrb r2, [r0], #1
ldrb r3, [r1], #1
cmp r2, #1
+ it cs
cmpcs r2, r3
beq 1b
sub r0, r2, r3
diff --git a/lib/libc/arm/string/strlen.S b/lib/libc/arm/string/strlen.S
index 7447710..c9334f9 100644
--- a/lib/libc/arm/string/strlen.S
+++ b/lib/libc/arm/string/strlen.S
@@ -52,8 +52,10 @@ ENTRY(strlen)
#else
ands r3, r2, #0xff000000
#endif
+ it ne
addne r1, r1, #1
.Ldo_3:
+ itt ne
#ifndef __ARMEB__
andsne r3, r2, #0x0000ff00
#else
@@ -61,6 +63,7 @@ ENTRY(strlen)
#endif
addne r1, r1, #1
.Ldo_2:
+ itt ne
#ifndef __ARMEB__
andsne r3, r2, #0x00ff0000
#else
@@ -68,6 +71,7 @@ ENTRY(strlen)
#endif
addne r1, r1, #1
.Ldo_1:
+ ittt ne
#ifndef __ARMEB__
andsne r3, r2, #0xff000000
#else
diff --git a/lib/libc/arm/string/strncmp.S b/lib/libc/arm/string/strncmp.S
index ac59deb..a5c0320 100644
--- a/lib/libc/arm/string/strncmp.S
+++ b/lib/libc/arm/string/strncmp.S
@@ -35,18 +35,21 @@ __FBSDID("$FreeBSD$");
ENTRY(strncmp)
/* if (len == 0) return 0 */
cmp r2, #0
+ itt eq
moveq r0, #0
moveq pc, lr
/* ip == last src address to compare */
adds ip, r0, r2
/* Use last possible address on overflow. */
+ it cs
movcs ip, #0
sub ip, ip, #1
1:
ldrb r2, [r0], #1
ldrb r3, [r1], #1
cmp ip, r0
+ itt cs
cmpcs r2, #1
cmpcs r2, r3
beq 1b
OpenPOWER on IntegriCloud