Update the assembler code to support old ARM architectures.

* libc/machine/arm/aeabi_memmove-arm.S (__aeabi_memmove): Update the
        assembler implementation.
        * libc/machine/arm/aeabi_memmove-thumb.S (__aeabi_memmove): Ditto.
        * libc/machine/arm/aeabi_memmove-thumb2.S (__aeabi_memmove): Ditto.
        * libc/machine/arm/aeabi_memset-arm.S (__aeabi_memset): Ditto.
        * libc/machine/arm/aeabi_memset-thumb.S (__aeabi_memset): Ditto.
        * libc/machine/arm/aeabi_memset-thumb2.S (__aeabi_memset): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Hale Wang 2015-06-01 12:49:37 +02:00 committed by Corinna Vinschen
parent b27c7d1d9a
commit 24e054c8c8
7 changed files with 189 additions and 183 deletions

View File

@ -1,3 +1,13 @@
2015-06-01 Hale Wang <hale.wang@arm.com>
* libc/machine/arm/aeabi_memmove-arm.S (__aeabi_memmove): Update the
assembler implementation.
* libc/machine/arm/aeabi_memmove-thumb.S (__aeabi_memmove): Ditto.
* libc/machine/arm/aeabi_memmove-thumb2.S (__aeabi_memmove): Ditto.
* libc/machine/arm/aeabi_memset-arm.S (__aeabi_memset): Ditto.
* libc/machine/arm/aeabi_memset-thumb.S (__aeabi_memset): Ditto.
* libc/machine/arm/aeabi_memset-thumb2.S (__aeabi_memset): Ditto.
2015-06-01 Szabolcs Nagy <szabolcs.nagy@arm.com>
* libm/machine/aarch64/e_sqrt.c: New file.

View File

@ -33,31 +33,32 @@
ASM_ALIAS __aeabi_memmove4 __aeabi_memmove
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
__aeabi_memmove:
.cfi_startproc
cmp r0, r1
bls 2f
add r3, r1, r2
bhi .L2
.L4:
sub r2, r0, #1
b .L3
.L2:
cmp r0, r3
addcc r1, r0, r2
rsbcc r2, r3, r2
bcs .L4
.L5:
cmn r3, r2
ldrneb ip, [r3, #-1]!
strneb ip, [r1, #-1]!
bne .L5
.L11:
bcs 2f
cmp r2, #0
add r1, r0, r2
bxeq lr
rsb r2, r2, r3
1:
ldrb ip, [r3, #-1]!
cmp r2, r3
strb ip, [r1, #-1]!
bne 1b
bx lr
.L3:
cmp r1, r3
ldrneb ip, [r1], #1
strneb ip, [r2, #1]!
bne .L3
.L12:
2:
cmp r2, #0
addne r2, r1, r2
subne r3, r0, #1
beq 4f
3:
ldrb ip, [r1], #1
cmp r2, r1
strb ip, [r3, #1]!
bne 3b
bx lr
4:
bx lr
.cfi_endproc
.size __aeabi_memmove, . - __aeabi_memmove

View File

@ -33,32 +33,34 @@
ASM_ALIAS __aeabi_memmove4 __aeabi_memmove
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
__aeabi_memmove:
.cfi_startproc
push {r4, lr}
cmp r0, r1
bls .L9
adds r3, r1, r2
cmp r0, r3
bcc .L3
.L9:
bls 3f
adds r4, r1, r2
cmp r0, r4
bcs 3f
subs r3, r2, #1
cmp r2, #0
beq 2f
subs r2, r4, r2
1:
ldrb r1, [r2, r3]
strb r1, [r0, r3]
subs r3, r3, #1
bcs 1b
2:
pop {r4}
pop {r1}
bx r1
3:
movs r3, #0
b .L4
.L3:
subs r3, r3, r2
.L5:
subs r2, r2, #1
bcc .L10
ldrb r1, [r3, r2]
strb r1, [r0, r2]
b .L5
.L4:
cmp r3, r2
beq .L10
cmp r2, #0
beq 2b
4:
ldrb r4, [r1, r3]
strb r4, [r0, r3]
adds r3, r3, #1
b .L4
.L10:
pop {r4, pc}
.cfi_endproc
cmp r2, r3
bne 4b
b 2b
.size __aeabi_memmove, . - __aeabi_memmove

View File

@ -33,34 +33,33 @@
ASM_ALIAS __aeabi_memmove4 __aeabi_memmove
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
__aeabi_memmove:
.cfi_startproc
cmp r0, r1
add r3, r1, r2
push {r4, lr}
bhi .L2
.L4:
subs r2, r0, #1
b .L3
.L2:
push {r4}
bls 3f
adds r3, r1, r2
cmp r0, r3
bcs .L4
bcs 3f
adds r1, r0, r2
subs r2, r2, r3
.L5:
cmn r3, r2
beq .L12
cbz r2, 2f
subs r2, r3, r2
1:
ldrb r4, [r3, #-1]!
cmp r2, r3
strb r4, [r1, #-1]!
b .L5
.L12:
pop {r4, pc}
.L3:
cmp r1, r3
beq .L13
bne 1b
2:
pop {r4}
bx lr
3:
cmp r2, #0
beq 2b
add r2, r2, r1
subs r3, r0, #1
4:
ldrb r4, [r1], #1
strb r4, [r2, #1]!
b .L3
.L13:
pop {r4, pc}
.cfi_endproc
cmp r2, r1
strb r4, [r3, #1]!
bne 4b
pop {r4}
bx lr
.size __aeabi_memmove, . - __aeabi_memmove

View File

@ -33,81 +33,75 @@
ASM_ALIAS __aeabi_memset4 __aeabi_memset
ASM_ALIAS __aeabi_memset8 __aeabi_memset
__aeabi_memset:
.cfi_startproc
tst r0, #3
stmfd sp!, {r4, r5, lr}
beq .L14
stmfd sp!, {r4, lr}
beq 10f
cmp r1, #0
sub r1, r1, #1
ldmeqfd sp!, {r4, r5, pc}
uxtb lr, r2
beq 9f
and ip, r2, #255
mov r3, r0
b .L4
.L6:
b 2f
1:
cmp r1, #0
mov r1, ip
ldmeqfd sp!, {r4, r5, pc}
.L4:
strb lr, [r3], #1
sub r1, r1, #1
beq 9f
2:
strb ip, [r3], #1
tst r3, #3
sub ip, r1, #1
bne .L6
.L2:
bne 1b
3:
cmp r1, #3
bls .L11
uxtb lr, r2
cmp r1, #15
bls 7f
and lr, r2, #255
orr lr, lr, lr, asl #8
cmp r1, #15
orr lr, lr, lr, asl #16
bls .L15
sub r4, r1, #16
bls 5f
mov r4, r1
add ip, r3, #16
mov r4, r4, lsr #4
add r5, r4, #2
add r5, r3, r5, lsl #4
.L10:
4:
sub r4, r4, #16
cmp r4, #15
str lr, [ip, #-16]
str lr, [ip, #-12]
str lr, [ip, #-8]
str lr, [ip, #-4]
add ip, ip, #16
str lr, [ip, #-28]
str lr, [ip, #-24]
str lr, [ip, #-20]
cmp ip, r5
bne .L10
bhi 4b
sub ip, r1, #16
bic ip, ip, #15
and r1, r1, #15
add ip, r4, #1
add ip, ip, #16
cmp r1, #3
add ip, r3, ip, lsl #4
bls .L28
.L9:
sub r3, r1, #4
bic r3, r3, #3
add r3, r3, #4
add r3, ip, r3
.L12:
str lr, [ip], #4
cmp r3, ip
bne .L12
add r3, r3, ip
bls 7f
5:
mov r4, r3
mov ip, r1
6:
sub ip, ip, #4
cmp ip, #3
str lr, [r4], #4
bhi 6b
sub ip, r1, #4
bic ip, ip, #3
add ip, ip, #4
add r3, r3, ip
and r1, r1, #3
.L11:
7:
cmp r1, #0
uxtbne r2, r2
andne r2, r2, #255
addne r1, r3, r1
beq .L29
.L13:
beq 9f
8:
strb r2, [r3], #1
cmp r3, r1
bne .L13
ldmfd sp!, {r4, r5, pc}
.L29:
ldmfd sp!, {r4, r5, pc}
.L14:
bne 8b
9:
ldmfd sp!, {r4, lr}
bx lr
10:
mov r3, r0
b .L2
.L15:
mov ip, r3
b .L9
.L28:
mov r3, ip
b .L11
.cfi_endproc
b 3b
.size __aeabi_memset, . - __aeabi_memset

View File

@ -33,31 +33,31 @@
ASM_ALIAS __aeabi_memset4 __aeabi_memset
ASM_ALIAS __aeabi_memset8 __aeabi_memset
__aeabi_memset:
.cfi_startproc
push {r4, r5, r6, lr}
lsls r3, r0, #30
beq .L14
beq 10f
subs r4, r1, #1
cmp r1, #0
beq .L16
uxtb r6, r2
beq 9f
lsls r5, r2, #24
lsrs r5, r5, #24
movs r3, r0
movs r5, #3
b .L4
.L6:
movs r6, #3
b 2f
1:
subs r1, r4, #1
cmp r4, #0
beq .L16
beq 9f
movs r4, r1
.L4:
2:
adds r3, r3, #1
subs r1, r3, #1
strb r6, [r1]
tst r3, r5
bne .L6
.L2:
strb r5, [r1]
tst r3, r6
bne 1b
3:
cmp r4, #3
bls .L11
bls 7f
movs r5, #255
ands r5, r2
lsls r1, r5, #8
@ -65,7 +65,7 @@ __aeabi_memset:
lsls r1, r5, #16
orrs r5, r1
cmp r4, #15
bls .L9
bls 5f
movs r6, r4
subs r6, r6, #16
lsrs r6, r6, #4
@ -73,46 +73,48 @@ __aeabi_memset:
lsls r6, r6, #4
movs r1, r3
adds r3, r3, r6
.L10:
4:
str r5, [r1]
str r5, [r1, #4]
str r5, [r1, #8]
str r5, [r1, #12]
adds r1, r1, #16
cmp r3, r1
bne .L10
bne 4b
movs r1, #15
ands r4, r1
cmp r4, #3
bls .L11
.L9:
bls 7f
5:
subs r6, r4, #4
lsrs r6, r6, #2
adds r6, r6, #1
lsls r6, r6, #2
movs r1, r3
adds r3, r3, r6
.L12:
6:
stmia r1!, {r5}
cmp r3, r1
bne .L12
bne 6b
movs r1, #3
ands r4, r1
.L11:
7:
cmp r4, #0
beq .L16
uxtb r2, r2
beq 9f
lsls r2, r2, #24
lsrs r2, r2, #24
adds r4, r3, r4
.L13:
8:
strb r2, [r3]
adds r3, r3, #1
cmp r4, r3
bne .L13
.L16:
pop {r4, r5, r6, pc}
.L14:
movs r4, r1
bne 8b
9:
pop {r4, r5, r6}
pop {r1}
bx r1
10:
movs r3, r0
b .L2
.cfi_endproc
movs r4, r1
b 3b
.size __aeabi_memset, . - __aeabi_memset

View File

@ -33,35 +33,34 @@
ASM_ALIAS __aeabi_memset4 __aeabi_memset
ASM_ALIAS __aeabi_memset8 __aeabi_memset
__aeabi_memset:
.cfi_startproc
push {r4, r5, r6}
lsls r4, r0, #30
beq .L14
beq 10f
subs r4, r1, #1
cmp r1, #0
beq .L16
beq 9f
uxtb r5, r2
mov r3, r0
b .L4
.L6:
b 2f
1:
subs r1, r4, #1
cbz r4, .L16
cbz r4, 9f
mov r4, r1
.L4:
2:
strb r5, [r3], #1
lsls r1, r3, #30
bne .L6
.L2:
bne 1b
3:
cmp r4, #3
bls .L11
bls 7f
uxtb r5, r2
orr r5, r5, r5, lsl #8
cmp r4, #15
orr r5, r5, r5, lsl #16
bls .L9
add r1, r3, #16
bls 5f
mov r6, r4
.L10:
add r1, r3, #16
4:
subs r6, r6, #16
cmp r6, #15
str r5, [r1, #-16]
@ -69,41 +68,40 @@ __aeabi_memset:
str r5, [r1, #-8]
str r5, [r1, #-4]
add r1, r1, #16
bhi .L10
bhi 4b
sub r1, r4, #16
bic r1, r1, #15
and r4, r4, #15
adds r1, r1, #16
cmp r4, #3
add r3, r3, r1
bls .L11
.L9:
bls 7f
5:
mov r6, r3
mov r1, r4
.L12:
6:
subs r1, r1, #4
cmp r1, #3
str r5, [r6], #4
bhi .L12
bhi 6b
subs r1, r4, #4
bic r1, r1, #3
adds r1, r1, #4
add r3, r3, r1
and r4, r4, #3
.L11:
cbz r4, .L16
7:
cbz r4, 9f
uxtb r2, r2
add r4, r4, r3
.L13:
8:
strb r2, [r3], #1
cmp r3, r4
bne .L13
.L16:
bne 8b
9:
pop {r4, r5, r6}
bx lr
.L14:
10:
mov r4, r1
mov r3, r0
b .L2
.cfi_endproc
b 3b
.size __aeabi_memset, . - __aeabi_memset