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> 2015-06-01 Szabolcs Nagy <szabolcs.nagy@arm.com>
* libm/machine/aarch64/e_sqrt.c: New file. * libm/machine/aarch64/e_sqrt.c: New file.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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