libgcc: arm: convert thumb1 code to unified syntax
Unified syntax has been the official syntax for thumb1 assembly for over 10 years now. It's time we made preparations for that becoming the default in the assembler. But before we can start doing that we really need to clean up some laggards from the olden days. Libgcc support for thumb1 is one such example. This patch converts all of the legacy (disjoint) syntax that I could find over to unified code. The identification was done by using a trick version of gas that defaulted to unified mode which then faults if legacy syntax is encountered. The code produced was then compared against the old code to check for differences. One such difference does exist, but that is because in unified syntax 'movs rd, rn' is encoded as 'lsls rd, rn, #0', rather than 'adds rd, rn, #0'; but that is a deliberate change that was introduced because the lsls encoding more closely reflects the behaviour of 'movs' in arm state (where only some of the condition flags are modified). * config/arm/bpabi-v6m.S (aeabi_lcmp): Convert thumb1 code to unified syntax. (aeabi_ulcmp, aeabi_ldivmod, aeabi_uldivmod): Likewise. (aeabi_frsub, aeabi_cfcmpeq, aeabi_fcmpeq): Likewise. (aeabi_fcmp, aeabi_drsub, aeabi_cdrcmple): Likewise. (aeabi_cdcmpeq, aeabi_dcmpeq, aeabi_dcmp): Likewise. * config/arm/lib1funcs.S (Lend_fde): Convert thumb1 code to unified syntax. (divsi3, modsi3): Likewise. (clzdi2, ctzsi2): Likewise. * config/arm/libunwind.S (restore_core_regs): Convert thumb1 code to unified syntax. (UNWIND_WRAPPER): Likewise.
This commit is contained in:
parent
8e6d0dba16
commit
6b9ce2b4eb
|
@ -1,3 +1,19 @@
|
||||||
|
2020-03-03 Richard Earnshaw <rearnsha@arm.com>
|
||||||
|
|
||||||
|
* config/arm/bpabi-v6m.S (aeabi_lcmp): Convert thumb1 code to unified
|
||||||
|
syntax.
|
||||||
|
(aeabi_ulcmp, aeabi_ldivmod, aeabi_uldivmod): Likewise.
|
||||||
|
(aeabi_frsub, aeabi_cfcmpeq, aeabi_fcmpeq): Likewise.
|
||||||
|
(aeabi_fcmp, aeabi_drsub, aeabi_cdrcmple): Likewise.
|
||||||
|
(aeabi_cdcmpeq, aeabi_dcmpeq, aeabi_dcmp): Likewise.
|
||||||
|
* config/arm/lib1funcs.S (Lend_fde): Convert thumb1 code to unified
|
||||||
|
syntax.
|
||||||
|
(divsi3, modsi3): Likewise.
|
||||||
|
(clzdi2, ctzsi2): Likewise.
|
||||||
|
* config/arm/libunwind.S (restore_core_regs): Convert thumb1 code to
|
||||||
|
unified syntax.
|
||||||
|
(UNWIND_WRAPPER): Likewise.
|
||||||
|
|
||||||
2020-03-02 Martin Liska <mliska@suse.cz>
|
2020-03-02 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
* libgcov-interface.c: Remove duplicate
|
* libgcov-interface.c: Remove duplicate
|
||||||
|
|
|
@ -39,21 +39,21 @@ FUNC_START aeabi_lcmp
|
||||||
cmp xxh, yyh
|
cmp xxh, yyh
|
||||||
beq 1f
|
beq 1f
|
||||||
bgt 2f
|
bgt 2f
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
neg r0, r0
|
negs r0, r0
|
||||||
RET
|
RET
|
||||||
2:
|
2:
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
RET
|
RET
|
||||||
1:
|
1:
|
||||||
sub r0, xxl, yyl
|
subs r0, xxl, yyl
|
||||||
beq 1f
|
beq 1f
|
||||||
bhi 2f
|
bhi 2f
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
neg r0, r0
|
negs r0, r0
|
||||||
RET
|
RET
|
||||||
2:
|
2:
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
1:
|
1:
|
||||||
RET
|
RET
|
||||||
FUNC_END aeabi_lcmp
|
FUNC_END aeabi_lcmp
|
||||||
|
@ -65,15 +65,15 @@ FUNC_START aeabi_lcmp
|
||||||
FUNC_START aeabi_ulcmp
|
FUNC_START aeabi_ulcmp
|
||||||
cmp xxh, yyh
|
cmp xxh, yyh
|
||||||
bne 1f
|
bne 1f
|
||||||
sub r0, xxl, yyl
|
subs r0, xxl, yyl
|
||||||
beq 2f
|
beq 2f
|
||||||
1:
|
1:
|
||||||
bcs 1f
|
bcs 1f
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
neg r0, r0
|
negs r0, r0
|
||||||
RET
|
RET
|
||||||
1:
|
1:
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
2:
|
2:
|
||||||
RET
|
RET
|
||||||
FUNC_END aeabi_ulcmp
|
FUNC_END aeabi_ulcmp
|
||||||
|
@ -91,29 +91,29 @@ FUNC_START aeabi_ulcmp
|
||||||
cmp xxl, #0
|
cmp xxl, #0
|
||||||
2:
|
2:
|
||||||
beq 3f
|
beq 3f
|
||||||
mov xxh, #0
|
movs xxh, #0
|
||||||
mvn xxh, xxh @ 0xffffffff
|
mvns xxh, xxh @ 0xffffffff
|
||||||
mov xxl, xxh
|
movs xxl, xxh
|
||||||
3:
|
3:
|
||||||
.else
|
.else
|
||||||
blt 6f
|
blt 6f
|
||||||
bgt 4f
|
bgt 4f
|
||||||
cmp xxl, #0
|
cmp xxl, #0
|
||||||
beq 5f
|
beq 5f
|
||||||
4: mov xxl, #0
|
4: movs xxl, #0
|
||||||
mvn xxl, xxl @ 0xffffffff
|
mvns xxl, xxl @ 0xffffffff
|
||||||
lsr xxh, xxl, #1 @ 0x7fffffff
|
lsrs xxh, xxl, #1 @ 0x7fffffff
|
||||||
b 5f
|
b 5f
|
||||||
6: mov xxh, #0x80
|
6: movs xxh, #0x80
|
||||||
lsl xxh, xxh, #24 @ 0x80000000
|
lsls xxh, xxh, #24 @ 0x80000000
|
||||||
mov xxl, #0
|
movs xxl, #0
|
||||||
5:
|
5:
|
||||||
.endif
|
.endif
|
||||||
@ tailcalls are tricky on v6-m.
|
@ tailcalls are tricky on v6-m.
|
||||||
push {r0, r1, r2}
|
push {r0, r1, r2}
|
||||||
ldr r0, 1f
|
ldr r0, 1f
|
||||||
adr r1, 1f
|
adr r1, 1f
|
||||||
add r0, r1
|
adds r0, r1
|
||||||
str r0, [sp, #8]
|
str r0, [sp, #8]
|
||||||
@ We know we are not on armv4t, so pop pc is safe.
|
@ We know we are not on armv4t, so pop pc is safe.
|
||||||
pop {r0, r1, pc}
|
pop {r0, r1, pc}
|
||||||
|
@ -128,15 +128,15 @@ FUNC_START aeabi_ulcmp
|
||||||
FUNC_START aeabi_ldivmod
|
FUNC_START aeabi_ldivmod
|
||||||
test_div_by_zero signed
|
test_div_by_zero signed
|
||||||
|
|
||||||
push {r0, r1}
|
push {r0, r1}
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
push {r0, lr}
|
push {r0, lr}
|
||||||
ldr r0, [sp, #8]
|
ldr r0, [sp, #8]
|
||||||
bl SYM(__gnu_ldivmod_helper)
|
bl SYM(__gnu_ldivmod_helper)
|
||||||
ldr r3, [sp, #4]
|
ldr r3, [sp, #4]
|
||||||
mov lr, r3
|
mov lr, r3
|
||||||
add sp, sp, #8
|
add sp, sp, #8
|
||||||
pop {r2, r3}
|
pop {r2, r3}
|
||||||
RET
|
RET
|
||||||
FUNC_END aeabi_ldivmod
|
FUNC_END aeabi_ldivmod
|
||||||
|
|
||||||
|
@ -147,15 +147,15 @@ FUNC_START aeabi_ldivmod
|
||||||
FUNC_START aeabi_uldivmod
|
FUNC_START aeabi_uldivmod
|
||||||
test_div_by_zero unsigned
|
test_div_by_zero unsigned
|
||||||
|
|
||||||
push {r0, r1}
|
push {r0, r1}
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
push {r0, lr}
|
push {r0, lr}
|
||||||
ldr r0, [sp, #8]
|
ldr r0, [sp, #8]
|
||||||
bl SYM(__udivmoddi4)
|
bl SYM(__udivmoddi4)
|
||||||
ldr r3, [sp, #4]
|
ldr r3, [sp, #4]
|
||||||
mov lr, r3
|
mov lr, r3
|
||||||
add sp, sp, #8
|
add sp, sp, #8
|
||||||
pop {r2, r3}
|
pop {r2, r3}
|
||||||
RET
|
RET
|
||||||
FUNC_END aeabi_uldivmod
|
FUNC_END aeabi_uldivmod
|
||||||
|
|
||||||
|
@ -166,9 +166,9 @@ FUNC_START aeabi_uldivmod
|
||||||
FUNC_START aeabi_frsub
|
FUNC_START aeabi_frsub
|
||||||
|
|
||||||
push {r4, lr}
|
push {r4, lr}
|
||||||
mov r4, #1
|
movs r4, #1
|
||||||
lsl r4, #31
|
lsls r4, #31
|
||||||
eor r0, r0, r4
|
eors r0, r0, r4
|
||||||
bl __aeabi_fadd
|
bl __aeabi_fadd
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ FUNC_START aeabi_frsub
|
||||||
FUNC_START aeabi_cfrcmple
|
FUNC_START aeabi_cfrcmple
|
||||||
|
|
||||||
mov ip, r0
|
mov ip, r0
|
||||||
mov r0, r1
|
movs r0, r1
|
||||||
mov r1, ip
|
mov r1, ip
|
||||||
b 6f
|
b 6f
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
|
||||||
cmp r0, #0
|
cmp r0, #0
|
||||||
@ Clear the C flag if the return value was -1, indicating
|
@ Clear the C flag if the return value was -1, indicating
|
||||||
@ that the first operand was smaller than the second.
|
@ that the first operand was smaller than the second.
|
||||||
bmi 1f
|
bmi 1f
|
||||||
mov r1, #0
|
movs r1, #0
|
||||||
cmn r0, r1
|
cmn r0, r1
|
||||||
1:
|
1:
|
||||||
pop {r0, r1, r2, r3, r4, pc}
|
pop {r0, r1, r2, r3, r4, pc}
|
||||||
|
@ -210,8 +210,8 @@ FUNC_START aeabi_fcmpeq
|
||||||
|
|
||||||
push {r4, lr}
|
push {r4, lr}
|
||||||
bl __eqsf2
|
bl __eqsf2
|
||||||
neg r0, r0
|
negs r0, r0
|
||||||
add r0, r0, #1
|
adds r0, r0, #1
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
FUNC_END aeabi_fcmpeq
|
FUNC_END aeabi_fcmpeq
|
||||||
|
@ -223,10 +223,10 @@ FUNC_START aeabi_fcmp\cond
|
||||||
bl __\helper\mode
|
bl __\helper\mode
|
||||||
cmp r0, #0
|
cmp r0, #0
|
||||||
b\cond 1f
|
b\cond 1f
|
||||||
mov r0, #0
|
movs r0, #0
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
1:
|
1:
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
FUNC_END aeabi_fcmp\cond
|
FUNC_END aeabi_fcmp\cond
|
||||||
|
@ -244,9 +244,9 @@ COMPARISON ge, ge
|
||||||
FUNC_START aeabi_drsub
|
FUNC_START aeabi_drsub
|
||||||
|
|
||||||
push {r4, lr}
|
push {r4, lr}
|
||||||
mov r4, #1
|
movs r4, #1
|
||||||
lsl r4, #31
|
lsls r4, #31
|
||||||
eor xxh, xxh, r4
|
eors xxh, xxh, r4
|
||||||
bl __aeabi_dadd
|
bl __aeabi_dadd
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
|
@ -259,10 +259,10 @@ FUNC_START aeabi_drsub
|
||||||
FUNC_START aeabi_cdrcmple
|
FUNC_START aeabi_cdrcmple
|
||||||
|
|
||||||
mov ip, r0
|
mov ip, r0
|
||||||
mov r0, r2
|
movs r0, r2
|
||||||
mov r2, ip
|
mov r2, ip
|
||||||
mov ip, r1
|
mov ip, r1
|
||||||
mov r1, r3
|
movs r1, r3
|
||||||
mov r3, ip
|
mov r3, ip
|
||||||
b 6f
|
b 6f
|
||||||
|
|
||||||
|
@ -277,8 +277,8 @@ FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
|
||||||
cmp r0, #0
|
cmp r0, #0
|
||||||
@ Clear the C flag if the return value was -1, indicating
|
@ Clear the C flag if the return value was -1, indicating
|
||||||
@ that the first operand was smaller than the second.
|
@ that the first operand was smaller than the second.
|
||||||
bmi 1f
|
bmi 1f
|
||||||
mov r1, #0
|
movs r1, #0
|
||||||
cmn r0, r1
|
cmn r0, r1
|
||||||
1:
|
1:
|
||||||
pop {r0, r1, r2, r3, r4, pc}
|
pop {r0, r1, r2, r3, r4, pc}
|
||||||
|
@ -291,8 +291,8 @@ FUNC_START aeabi_dcmpeq
|
||||||
|
|
||||||
push {r4, lr}
|
push {r4, lr}
|
||||||
bl __eqdf2
|
bl __eqdf2
|
||||||
neg r0, r0
|
negs r0, r0
|
||||||
add r0, r0, #1
|
adds r0, r0, #1
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
FUNC_END aeabi_dcmpeq
|
FUNC_END aeabi_dcmpeq
|
||||||
|
@ -304,10 +304,10 @@ FUNC_START aeabi_dcmp\cond
|
||||||
bl __\helper\mode
|
bl __\helper\mode
|
||||||
cmp r0, #0
|
cmp r0, #0
|
||||||
b\cond 1f
|
b\cond 1f
|
||||||
mov r0, #0
|
movs r0, #0
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
1:
|
1:
|
||||||
mov r0, #1
|
movs r0, #1
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
FUNC_END aeabi_dcmp\cond
|
FUNC_END aeabi_dcmp\cond
|
||||||
|
|
|
@ -22,6 +22,10 @@ a copy of the GCC Runtime Library Exception along with this program;
|
||||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* Everything in this file should now use unified syntax. */
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
|
||||||
/* An executable stack is *not* required for these functions. */
|
/* An executable stack is *not* required for these functions. */
|
||||||
#if defined(__ELF__) && defined(__linux__)
|
#if defined(__ELF__) && defined(__linux__)
|
||||||
.section .note.GNU-stack,"",%progbits
|
.section .note.GNU-stack,"",%progbits
|
||||||
|
@ -270,7 +274,7 @@ LSYM(Lend_fde):
|
||||||
#ifdef NOT_ISA_TARGET_32BIT
|
#ifdef NOT_ISA_TARGET_32BIT
|
||||||
|
|
||||||
push {r0, lr}
|
push {r0, lr}
|
||||||
mov r0, #0
|
movs r0, #0
|
||||||
bl SYM(__aeabi_idiv0)
|
bl SYM(__aeabi_idiv0)
|
||||||
@ We know we are not on armv4t, so pop pc is safe.
|
@ We know we are not on armv4t, so pop pc is safe.
|
||||||
pop {r1, pc}
|
pop {r1, pc}
|
||||||
|
@ -310,7 +314,7 @@ LSYM(Lend_fde):
|
||||||
push { r1, lr }
|
push { r1, lr }
|
||||||
98: cfi_push 98b - __\name, 0xe, -0x4, 0x8
|
98: cfi_push 98b - __\name, 0xe, -0x4, 0x8
|
||||||
bl SYM (__div0)
|
bl SYM (__div0)
|
||||||
mov r0, #0 @ About as wrong as it could be.
|
movs r0, #0 @ About as wrong as it could be.
|
||||||
#if defined (__INTERWORKING__)
|
#if defined (__INTERWORKING__)
|
||||||
pop { r1, r2 }
|
pop { r1, r2 }
|
||||||
bx r2
|
bx r2
|
||||||
|
@ -349,7 +353,7 @@ SYM (\name):
|
||||||
#define THUMB_FUNC .thumb_func
|
#define THUMB_FUNC .thumb_func
|
||||||
#define THUMB_CODE .force_thumb
|
#define THUMB_CODE .force_thumb
|
||||||
# if defined(__thumb2__)
|
# if defined(__thumb2__)
|
||||||
#define THUMB_SYNTAX .syntax divided
|
#define THUMB_SYNTAX
|
||||||
# else
|
# else
|
||||||
#define THUMB_SYNTAX
|
#define THUMB_SYNTAX
|
||||||
# endif
|
# endif
|
||||||
|
@ -725,8 +729,8 @@ pc .req r15
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
.macro THUMB_DIV_MOD_BODY modulo
|
.macro THUMB_DIV_MOD_BODY modulo
|
||||||
@ Load the constant 0x10000000 into our work register.
|
@ Load the constant 0x10000000 into our work register.
|
||||||
mov work, #1
|
movs work, #1
|
||||||
lsl work, #28
|
lsls work, #28
|
||||||
LSYM(Loop1):
|
LSYM(Loop1):
|
||||||
@ Unless the divisor is very big, shift it up in multiples of
|
@ Unless the divisor is very big, shift it up in multiples of
|
||||||
@ four bits, since this is the amount of unwinding in the main
|
@ four bits, since this is the amount of unwinding in the main
|
||||||
|
@ -736,12 +740,12 @@ LSYM(Loop1):
|
||||||
bhs LSYM(Lbignum)
|
bhs LSYM(Lbignum)
|
||||||
cmp divisor, dividend
|
cmp divisor, dividend
|
||||||
bhs LSYM(Lbignum)
|
bhs LSYM(Lbignum)
|
||||||
lsl divisor, #4
|
lsls divisor, #4
|
||||||
lsl curbit, #4
|
lsls curbit, #4
|
||||||
b LSYM(Loop1)
|
b LSYM(Loop1)
|
||||||
LSYM(Lbignum):
|
LSYM(Lbignum):
|
||||||
@ Set work to 0x80000000
|
@ Set work to 0x80000000
|
||||||
lsl work, #3
|
lsls work, #3
|
||||||
LSYM(Loop2):
|
LSYM(Loop2):
|
||||||
@ For very big divisors, we must shift it a bit at a time, or
|
@ For very big divisors, we must shift it a bit at a time, or
|
||||||
@ we will be in danger of overflowing.
|
@ we will be in danger of overflowing.
|
||||||
|
@ -749,8 +753,8 @@ LSYM(Loop2):
|
||||||
bhs LSYM(Loop3)
|
bhs LSYM(Loop3)
|
||||||
cmp divisor, dividend
|
cmp divisor, dividend
|
||||||
bhs LSYM(Loop3)
|
bhs LSYM(Loop3)
|
||||||
lsl divisor, #1
|
lsls divisor, #1
|
||||||
lsl curbit, #1
|
lsls curbit, #1
|
||||||
b LSYM(Loop2)
|
b LSYM(Loop2)
|
||||||
LSYM(Loop3):
|
LSYM(Loop3):
|
||||||
@ Test for possible subtractions ...
|
@ Test for possible subtractions ...
|
||||||
|
@ -758,39 +762,39 @@ LSYM(Loop3):
|
||||||
@ ... On the final pass, this may subtract too much from the dividend,
|
@ ... On the final pass, this may subtract too much from the dividend,
|
||||||
@ so keep track of which subtractions are done, we can fix them up
|
@ so keep track of which subtractions are done, we can fix them up
|
||||||
@ afterwards.
|
@ afterwards.
|
||||||
mov overdone, #0
|
movs overdone, #0
|
||||||
cmp dividend, divisor
|
cmp dividend, divisor
|
||||||
blo LSYM(Lover1)
|
blo LSYM(Lover1)
|
||||||
sub dividend, dividend, divisor
|
subs dividend, dividend, divisor
|
||||||
LSYM(Lover1):
|
LSYM(Lover1):
|
||||||
lsr work, divisor, #1
|
lsrs work, divisor, #1
|
||||||
cmp dividend, work
|
cmp dividend, work
|
||||||
blo LSYM(Lover2)
|
blo LSYM(Lover2)
|
||||||
sub dividend, dividend, work
|
subs dividend, dividend, work
|
||||||
mov ip, curbit
|
mov ip, curbit
|
||||||
mov work, #1
|
movs work, #1
|
||||||
ror curbit, work
|
rors curbit, work
|
||||||
orr overdone, curbit
|
orrs overdone, curbit
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
LSYM(Lover2):
|
LSYM(Lover2):
|
||||||
lsr work, divisor, #2
|
lsrs work, divisor, #2
|
||||||
cmp dividend, work
|
cmp dividend, work
|
||||||
blo LSYM(Lover3)
|
blo LSYM(Lover3)
|
||||||
sub dividend, dividend, work
|
subs dividend, dividend, work
|
||||||
mov ip, curbit
|
mov ip, curbit
|
||||||
mov work, #2
|
movs work, #2
|
||||||
ror curbit, work
|
rors curbit, work
|
||||||
orr overdone, curbit
|
orrs overdone, curbit
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
LSYM(Lover3):
|
LSYM(Lover3):
|
||||||
lsr work, divisor, #3
|
lsrs work, divisor, #3
|
||||||
cmp dividend, work
|
cmp dividend, work
|
||||||
blo LSYM(Lover4)
|
blo LSYM(Lover4)
|
||||||
sub dividend, dividend, work
|
subs dividend, dividend, work
|
||||||
mov ip, curbit
|
mov ip, curbit
|
||||||
mov work, #3
|
movs work, #3
|
||||||
ror curbit, work
|
rors curbit, work
|
||||||
orr overdone, curbit
|
orrs overdone, curbit
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
LSYM(Lover4):
|
LSYM(Lover4):
|
||||||
mov ip, curbit
|
mov ip, curbit
|
||||||
|
@ -800,46 +804,46 @@ LSYM(Lover4):
|
||||||
@ since the "bit" will have been shifted out at the bottom.
|
@ since the "bit" will have been shifted out at the bottom.
|
||||||
cmp dividend, divisor
|
cmp dividend, divisor
|
||||||
blo LSYM(Lover1)
|
blo LSYM(Lover1)
|
||||||
sub dividend, dividend, divisor
|
subs dividend, dividend, divisor
|
||||||
orr result, result, curbit
|
orrs result, result, curbit
|
||||||
LSYM(Lover1):
|
LSYM(Lover1):
|
||||||
lsr work, divisor, #1
|
lsrs work, divisor, #1
|
||||||
cmp dividend, work
|
cmp dividend, work
|
||||||
blo LSYM(Lover2)
|
blo LSYM(Lover2)
|
||||||
sub dividend, dividend, work
|
subs dividend, dividend, work
|
||||||
lsr work, curbit, #1
|
lsrs work, curbit, #1
|
||||||
orr result, work
|
orrs result, work
|
||||||
LSYM(Lover2):
|
LSYM(Lover2):
|
||||||
lsr work, divisor, #2
|
lsrs work, divisor, #2
|
||||||
cmp dividend, work
|
cmp dividend, work
|
||||||
blo LSYM(Lover3)
|
blo LSYM(Lover3)
|
||||||
sub dividend, dividend, work
|
subs dividend, dividend, work
|
||||||
lsr work, curbit, #2
|
lsrs work, curbit, #2
|
||||||
orr result, work
|
orrs result, work
|
||||||
LSYM(Lover3):
|
LSYM(Lover3):
|
||||||
lsr work, divisor, #3
|
lsrs work, divisor, #3
|
||||||
cmp dividend, work
|
cmp dividend, work
|
||||||
blo LSYM(Lover4)
|
blo LSYM(Lover4)
|
||||||
sub dividend, dividend, work
|
subs dividend, dividend, work
|
||||||
lsr work, curbit, #3
|
lsrs work, curbit, #3
|
||||||
orr result, work
|
orrs result, work
|
||||||
LSYM(Lover4):
|
LSYM(Lover4):
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
cmp dividend, #0 @ Early termination?
|
cmp dividend, #0 @ Early termination?
|
||||||
beq LSYM(Lover5)
|
beq LSYM(Lover5)
|
||||||
lsr curbit, #4 @ No, any more bits to do?
|
lsrs curbit, #4 @ No, any more bits to do?
|
||||||
beq LSYM(Lover5)
|
beq LSYM(Lover5)
|
||||||
lsr divisor, #4
|
lsrs divisor, #4
|
||||||
b LSYM(Loop3)
|
b LSYM(Loop3)
|
||||||
LSYM(Lover5):
|
LSYM(Lover5):
|
||||||
.if \modulo
|
.if \modulo
|
||||||
@ Any subtractions that we should not have done will be recorded in
|
@ Any subtractions that we should not have done will be recorded in
|
||||||
@ the top three bits of "overdone". Exactly which were not needed
|
@ the top three bits of "overdone". Exactly which were not needed
|
||||||
@ are governed by the position of the bit, stored in ip.
|
@ are governed by the position of the bit, stored in ip.
|
||||||
mov work, #0xe
|
movs work, #0xe
|
||||||
lsl work, #28
|
lsls work, #28
|
||||||
and overdone, work
|
ands overdone, work
|
||||||
beq LSYM(Lgot_result)
|
beq LSYM(Lgot_result)
|
||||||
|
|
||||||
@ If we terminated early, because dividend became zero, then the
|
@ If we terminated early, because dividend became zero, then the
|
||||||
|
@ -849,33 +853,33 @@ LSYM(Lover5):
|
||||||
@ the bit in ip could be in the top two bits which might then match
|
@ the bit in ip could be in the top two bits which might then match
|
||||||
@ with one of the smaller RORs.
|
@ with one of the smaller RORs.
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
mov work, #0x7
|
movs work, #0x7
|
||||||
tst curbit, work
|
tst curbit, work
|
||||||
beq LSYM(Lgot_result)
|
beq LSYM(Lgot_result)
|
||||||
|
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
mov work, #3
|
movs work, #3
|
||||||
ror curbit, work
|
rors curbit, work
|
||||||
tst overdone, curbit
|
tst overdone, curbit
|
||||||
beq LSYM(Lover6)
|
beq LSYM(Lover6)
|
||||||
lsr work, divisor, #3
|
lsrs work, divisor, #3
|
||||||
add dividend, work
|
adds dividend, work
|
||||||
LSYM(Lover6):
|
LSYM(Lover6):
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
mov work, #2
|
movs work, #2
|
||||||
ror curbit, work
|
rors curbit, work
|
||||||
tst overdone, curbit
|
tst overdone, curbit
|
||||||
beq LSYM(Lover7)
|
beq LSYM(Lover7)
|
||||||
lsr work, divisor, #2
|
lsrs work, divisor, #2
|
||||||
add dividend, work
|
adds dividend, work
|
||||||
LSYM(Lover7):
|
LSYM(Lover7):
|
||||||
mov curbit, ip
|
mov curbit, ip
|
||||||
mov work, #1
|
movs work, #1
|
||||||
ror curbit, work
|
rors curbit, work
|
||||||
tst overdone, curbit
|
tst overdone, curbit
|
||||||
beq LSYM(Lgot_result)
|
beq LSYM(Lgot_result)
|
||||||
lsr work, divisor, #1
|
lsrs work, divisor, #1
|
||||||
add dividend, work
|
adds dividend, work
|
||||||
.endif
|
.endif
|
||||||
LSYM(Lgot_result):
|
LSYM(Lgot_result):
|
||||||
.endm
|
.endm
|
||||||
|
@ -885,7 +889,7 @@ LSYM(Lgot_result):
|
||||||
|
|
||||||
/* Branch to div(n), and jump to label if curbit is lo than divisior. */
|
/* Branch to div(n), and jump to label if curbit is lo than divisior. */
|
||||||
.macro BranchToDiv n, label
|
.macro BranchToDiv n, label
|
||||||
lsr curbit, dividend, \n
|
lsrs curbit, dividend, \n
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
blo \label
|
blo \label
|
||||||
.endm
|
.endm
|
||||||
|
@ -893,13 +897,13 @@ LSYM(Lgot_result):
|
||||||
/* Body of div(n). Shift the divisor in n bits and compare the divisor
|
/* Body of div(n). Shift the divisor in n bits and compare the divisor
|
||||||
and dividend. Update the dividend as the substruction result. */
|
and dividend. Update the dividend as the substruction result. */
|
||||||
.macro DoDiv n
|
.macro DoDiv n
|
||||||
lsr curbit, dividend, \n
|
lsrs curbit, dividend, \n
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
bcc 1f
|
bcc 1f
|
||||||
lsl curbit, divisor, \n
|
lsls curbit, divisor, \n
|
||||||
sub dividend, dividend, curbit
|
subs dividend, dividend, curbit
|
||||||
|
|
||||||
1: adc result, result
|
1: adcs result, result
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/* The body of division with positive divisor. Unless the divisor is very
|
/* The body of division with positive divisor. Unless the divisor is very
|
||||||
|
@ -907,29 +911,29 @@ LSYM(Lgot_result):
|
||||||
unwinding in the main division loop. Continue shifting until the divisor
|
unwinding in the main division loop. Continue shifting until the divisor
|
||||||
is larger than the dividend. */
|
is larger than the dividend. */
|
||||||
.macro THUMB1_Div_Positive
|
.macro THUMB1_Div_Positive
|
||||||
mov result, #0
|
movs result, #0
|
||||||
BranchToDiv #1, LSYM(Lthumb1_div1)
|
BranchToDiv #1, LSYM(Lthumb1_div1)
|
||||||
BranchToDiv #4, LSYM(Lthumb1_div4)
|
BranchToDiv #4, LSYM(Lthumb1_div4)
|
||||||
BranchToDiv #8, LSYM(Lthumb1_div8)
|
BranchToDiv #8, LSYM(Lthumb1_div8)
|
||||||
BranchToDiv #12, LSYM(Lthumb1_div12)
|
BranchToDiv #12, LSYM(Lthumb1_div12)
|
||||||
BranchToDiv #16, LSYM(Lthumb1_div16)
|
BranchToDiv #16, LSYM(Lthumb1_div16)
|
||||||
LSYM(Lthumb1_div_large_positive):
|
LSYM(Lthumb1_div_large_positive):
|
||||||
mov result, #0xff
|
movs result, #0xff
|
||||||
lsl divisor, divisor, #8
|
lsls divisor, divisor, #8
|
||||||
rev result, result
|
rev result, result
|
||||||
lsr curbit, dividend, #16
|
lsrs curbit, dividend, #16
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
blo 1f
|
blo 1f
|
||||||
asr result, #8
|
asrs result, #8
|
||||||
lsl divisor, divisor, #8
|
lsls divisor, divisor, #8
|
||||||
beq LSYM(Ldivbyzero_waypoint)
|
beq LSYM(Ldivbyzero_waypoint)
|
||||||
|
|
||||||
1: lsr curbit, dividend, #12
|
1: lsrs curbit, dividend, #12
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
blo LSYM(Lthumb1_div12)
|
blo LSYM(Lthumb1_div12)
|
||||||
b LSYM(Lthumb1_div16)
|
b LSYM(Lthumb1_div16)
|
||||||
LSYM(Lthumb1_div_loop):
|
LSYM(Lthumb1_div_loop):
|
||||||
lsr divisor, divisor, #8
|
lsrs divisor, divisor, #8
|
||||||
LSYM(Lthumb1_div16):
|
LSYM(Lthumb1_div16):
|
||||||
Dodiv #15
|
Dodiv #15
|
||||||
Dodiv #14
|
Dodiv #14
|
||||||
|
@ -954,11 +958,11 @@ LSYM(Lthumb1_div3):
|
||||||
LSYM(Lthumb1_div2):
|
LSYM(Lthumb1_div2):
|
||||||
Dodiv #1
|
Dodiv #1
|
||||||
LSYM(Lthumb1_div1):
|
LSYM(Lthumb1_div1):
|
||||||
sub divisor, dividend, divisor
|
subs divisor, dividend, divisor
|
||||||
bcs 1f
|
bcs 1f
|
||||||
cpy divisor, dividend
|
cpy divisor, dividend
|
||||||
|
|
||||||
1: adc result, result
|
1: adcs result, result
|
||||||
cpy dividend, result
|
cpy dividend, result
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
@ -970,43 +974,43 @@ LSYM(Ldivbyzero_waypoint):
|
||||||
THUMB1_Div_Positive except that the shift steps are in multiples
|
THUMB1_Div_Positive except that the shift steps are in multiples
|
||||||
of six bits. */
|
of six bits. */
|
||||||
.macro THUMB1_Div_Negative
|
.macro THUMB1_Div_Negative
|
||||||
lsr result, divisor, #31
|
lsrs result, divisor, #31
|
||||||
beq 1f
|
beq 1f
|
||||||
neg divisor, divisor
|
negs divisor, divisor
|
||||||
|
|
||||||
1: asr curbit, dividend, #32
|
1: asrs curbit, dividend, #32
|
||||||
bcc 2f
|
bcc 2f
|
||||||
neg dividend, dividend
|
negs dividend, dividend
|
||||||
|
|
||||||
2: eor curbit, result
|
2: eors curbit, result
|
||||||
mov result, #0
|
movs result, #0
|
||||||
cpy ip, curbit
|
cpy ip, curbit
|
||||||
BranchToDiv #4, LSYM(Lthumb1_div_negative4)
|
BranchToDiv #4, LSYM(Lthumb1_div_negative4)
|
||||||
BranchToDiv #8, LSYM(Lthumb1_div_negative8)
|
BranchToDiv #8, LSYM(Lthumb1_div_negative8)
|
||||||
LSYM(Lthumb1_div_large):
|
LSYM(Lthumb1_div_large):
|
||||||
mov result, #0xfc
|
movs result, #0xfc
|
||||||
lsl divisor, divisor, #6
|
lsls divisor, divisor, #6
|
||||||
rev result, result
|
rev result, result
|
||||||
lsr curbit, dividend, #8
|
lsrs curbit, dividend, #8
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
blo LSYM(Lthumb1_div_negative8)
|
blo LSYM(Lthumb1_div_negative8)
|
||||||
|
|
||||||
lsl divisor, divisor, #6
|
lsls divisor, divisor, #6
|
||||||
asr result, result, #6
|
asrs result, result, #6
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
blo LSYM(Lthumb1_div_negative8)
|
blo LSYM(Lthumb1_div_negative8)
|
||||||
|
|
||||||
lsl divisor, divisor, #6
|
lsls divisor, divisor, #6
|
||||||
asr result, result, #6
|
asrs result, result, #6
|
||||||
cmp curbit, divisor
|
cmp curbit, divisor
|
||||||
blo LSYM(Lthumb1_div_negative8)
|
blo LSYM(Lthumb1_div_negative8)
|
||||||
|
|
||||||
lsl divisor, divisor, #6
|
lsls divisor, divisor, #6
|
||||||
beq LSYM(Ldivbyzero_negative)
|
beq LSYM(Ldivbyzero_negative)
|
||||||
asr result, result, #6
|
asrs result, result, #6
|
||||||
b LSYM(Lthumb1_div_negative8)
|
b LSYM(Lthumb1_div_negative8)
|
||||||
LSYM(Lthumb1_div_negative_loop):
|
LSYM(Lthumb1_div_negative_loop):
|
||||||
lsr divisor, divisor, #6
|
lsrs divisor, divisor, #6
|
||||||
LSYM(Lthumb1_div_negative8):
|
LSYM(Lthumb1_div_negative8):
|
||||||
DoDiv #7
|
DoDiv #7
|
||||||
DoDiv #6
|
DoDiv #6
|
||||||
|
@ -1017,28 +1021,28 @@ LSYM(Lthumb1_div_negative4):
|
||||||
DoDiv #2
|
DoDiv #2
|
||||||
bcs LSYM(Lthumb1_div_negative_loop)
|
bcs LSYM(Lthumb1_div_negative_loop)
|
||||||
DoDiv #1
|
DoDiv #1
|
||||||
sub divisor, dividend, divisor
|
subs divisor, dividend, divisor
|
||||||
bcs 1f
|
bcs 1f
|
||||||
cpy divisor, dividend
|
cpy divisor, dividend
|
||||||
|
|
||||||
1: cpy curbit, ip
|
1: cpy curbit, ip
|
||||||
adc result, result
|
adcs result, result
|
||||||
asr curbit, curbit, #1
|
asrs curbit, curbit, #1
|
||||||
cpy dividend, result
|
cpy dividend, result
|
||||||
bcc 2f
|
bcc 2f
|
||||||
neg dividend, dividend
|
negs dividend, dividend
|
||||||
cmp curbit, #0
|
cmp curbit, #0
|
||||||
|
|
||||||
2: bpl 3f
|
2: bpl 3f
|
||||||
neg divisor, divisor
|
negs divisor, divisor
|
||||||
|
|
||||||
3: RET
|
3: RET
|
||||||
|
|
||||||
LSYM(Ldivbyzero_negative):
|
LSYM(Ldivbyzero_negative):
|
||||||
cpy curbit, ip
|
cpy curbit, ip
|
||||||
asr curbit, curbit, #1
|
asrs curbit, curbit, #1
|
||||||
bcc LSYM(Ldiv0)
|
bcc LSYM(Ldiv0)
|
||||||
neg dividend, dividend
|
negs dividend, dividend
|
||||||
.endm
|
.endm
|
||||||
#endif /* ARM Thumb version. */
|
#endif /* ARM Thumb version. */
|
||||||
|
|
||||||
|
@ -1056,8 +1060,8 @@ LSYM(Ldivbyzero_negative):
|
||||||
cmp divisor, #0
|
cmp divisor, #0
|
||||||
beq LSYM(Ldiv0)
|
beq LSYM(Ldiv0)
|
||||||
LSYM(udivsi3_skip_div0_test):
|
LSYM(udivsi3_skip_div0_test):
|
||||||
mov curbit, #1
|
movs curbit, #1
|
||||||
mov result, #0
|
movs result, #0
|
||||||
|
|
||||||
push { work }
|
push { work }
|
||||||
cmp dividend, divisor
|
cmp dividend, divisor
|
||||||
|
@ -1065,7 +1069,7 @@ LSYM(udivsi3_skip_div0_test):
|
||||||
|
|
||||||
THUMB_DIV_MOD_BODY 0
|
THUMB_DIV_MOD_BODY 0
|
||||||
|
|
||||||
mov r0, result
|
movs r0, result
|
||||||
pop { work }
|
pop { work }
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
@ -1184,7 +1188,7 @@ ARM_FUNC_START aeabi_uidivmod
|
||||||
|
|
||||||
cmp divisor, #0
|
cmp divisor, #0
|
||||||
beq LSYM(Ldiv0)
|
beq LSYM(Ldiv0)
|
||||||
mov curbit, #1
|
movs curbit, #1
|
||||||
cmp dividend, divisor
|
cmp dividend, divisor
|
||||||
bhs LSYM(Lover10)
|
bhs LSYM(Lover10)
|
||||||
RET
|
RET
|
||||||
|
@ -1263,7 +1267,7 @@ LSYM(Lover12):
|
||||||
#else
|
#else
|
||||||
LSYM(divsi3_skip_div0_test):
|
LSYM(divsi3_skip_div0_test):
|
||||||
cpy curbit, dividend
|
cpy curbit, dividend
|
||||||
orr curbit, divisor
|
orrs curbit, divisor
|
||||||
bmi LSYM(Lthumb1_div_negative)
|
bmi LSYM(Lthumb1_div_negative)
|
||||||
|
|
||||||
LSYM(Lthumb1_div_positive):
|
LSYM(Lthumb1_div_positive):
|
||||||
|
@ -1395,11 +1399,11 @@ ARM_FUNC_START aeabi_idivmod
|
||||||
|
|
||||||
FUNC_START modsi3
|
FUNC_START modsi3
|
||||||
|
|
||||||
mov curbit, #1
|
movs curbit, #1
|
||||||
cmp divisor, #0
|
cmp divisor, #0
|
||||||
beq LSYM(Ldiv0)
|
beq LSYM(Ldiv0)
|
||||||
bpl LSYM(Lover10)
|
bpl LSYM(Lover10)
|
||||||
neg divisor, divisor @ Loops below use unsigned.
|
negs divisor, divisor @ Loops below use unsigned.
|
||||||
LSYM(Lover10):
|
LSYM(Lover10):
|
||||||
push { work }
|
push { work }
|
||||||
@ Need to save the sign of the dividend, unfortunately, we need
|
@ Need to save the sign of the dividend, unfortunately, we need
|
||||||
|
@ -1408,7 +1412,7 @@ LSYM(Lover10):
|
||||||
push { dividend }
|
push { dividend }
|
||||||
cmp dividend, #0
|
cmp dividend, #0
|
||||||
bpl LSYM(Lover11)
|
bpl LSYM(Lover11)
|
||||||
neg dividend, dividend
|
negs dividend, dividend
|
||||||
LSYM(Lover11):
|
LSYM(Lover11):
|
||||||
cmp dividend, divisor
|
cmp dividend, divisor
|
||||||
blo LSYM(Lgot_result)
|
blo LSYM(Lgot_result)
|
||||||
|
@ -1418,7 +1422,7 @@ LSYM(Lover11):
|
||||||
pop { work }
|
pop { work }
|
||||||
cmp work, #0
|
cmp work, #0
|
||||||
bpl LSYM(Lover12)
|
bpl LSYM(Lover12)
|
||||||
neg dividend, dividend
|
negs dividend, dividend
|
||||||
LSYM(Lover12):
|
LSYM(Lover12):
|
||||||
pop { work }
|
pop { work }
|
||||||
RET
|
RET
|
||||||
|
@ -1540,12 +1544,12 @@ LSYM(Lover12):
|
||||||
address, so just clear pc..pc+1. */
|
address, so just clear pc..pc+1. */
|
||||||
#if defined __thumb__ && !defined __thumb2__
|
#if defined __thumb__ && !defined __thumb2__
|
||||||
push {r7}
|
push {r7}
|
||||||
mov r7, #0xf
|
movs r7, #0xf
|
||||||
lsl r7, #16
|
lsls r7, #16
|
||||||
add r7, #2
|
adds r7, #2
|
||||||
adr r0, . + 4
|
adr r0, . + 4
|
||||||
add r1, r0, #1
|
adds r1, r0, #1
|
||||||
mov r2, #0
|
movs r2, #0
|
||||||
svc 0
|
svc 0
|
||||||
pop {r7}
|
pop {r7}
|
||||||
#else
|
#else
|
||||||
|
@ -1595,17 +1599,17 @@ LSYM(Lover12):
|
||||||
FUNC_ALIAS aeabi_llsr lshrdi3
|
FUNC_ALIAS aeabi_llsr lshrdi3
|
||||||
|
|
||||||
#ifdef __thumb__
|
#ifdef __thumb__
|
||||||
lsr al, r2
|
lsrs al, r2
|
||||||
mov r3, ah
|
movs r3, ah
|
||||||
lsr ah, r2
|
lsrs ah, r2
|
||||||
mov ip, r3
|
mov ip, r3
|
||||||
sub r2, #32
|
subs r2, #32
|
||||||
lsr r3, r2
|
lsrs r3, r2
|
||||||
orr al, r3
|
orrs al, r3
|
||||||
neg r2, r2
|
negs r2, r2
|
||||||
mov r3, ip
|
mov r3, ip
|
||||||
lsl r3, r2
|
lsls r3, r2
|
||||||
orr al, r3
|
orrs al, r3
|
||||||
RET
|
RET
|
||||||
#else
|
#else
|
||||||
subs r3, r2, #32
|
subs r3, r2, #32
|
||||||
|
@ -1627,21 +1631,21 @@ LSYM(Lover12):
|
||||||
FUNC_ALIAS aeabi_lasr ashrdi3
|
FUNC_ALIAS aeabi_lasr ashrdi3
|
||||||
|
|
||||||
#ifdef __thumb__
|
#ifdef __thumb__
|
||||||
lsr al, r2
|
lsrs al, r2
|
||||||
mov r3, ah
|
movs r3, ah
|
||||||
asr ah, r2
|
asrs ah, r2
|
||||||
sub r2, #32
|
subs r2, #32
|
||||||
@ If r2 is negative at this point the following step would OR
|
@ If r2 is negative at this point the following step would OR
|
||||||
@ the sign bit into all of AL. That's not what we want...
|
@ the sign bit into all of AL. That's not what we want...
|
||||||
bmi 1f
|
bmi 1f
|
||||||
mov ip, r3
|
mov ip, r3
|
||||||
asr r3, r2
|
asrs r3, r2
|
||||||
orr al, r3
|
orrs al, r3
|
||||||
mov r3, ip
|
mov r3, ip
|
||||||
1:
|
1:
|
||||||
neg r2, r2
|
negs r2, r2
|
||||||
lsl r3, r2
|
lsls r3, r2
|
||||||
orr al, r3
|
orrs al, r3
|
||||||
RET
|
RET
|
||||||
#else
|
#else
|
||||||
subs r3, r2, #32
|
subs r3, r2, #32
|
||||||
|
@ -1664,17 +1668,17 @@ LSYM(Lover12):
|
||||||
FUNC_ALIAS aeabi_llsl ashldi3
|
FUNC_ALIAS aeabi_llsl ashldi3
|
||||||
|
|
||||||
#ifdef __thumb__
|
#ifdef __thumb__
|
||||||
lsl ah, r2
|
lsls ah, r2
|
||||||
mov r3, al
|
movs r3, al
|
||||||
lsl al, r2
|
lsls al, r2
|
||||||
mov ip, r3
|
mov ip, r3
|
||||||
sub r2, #32
|
subs r2, #32
|
||||||
lsl r3, r2
|
lsls r3, r2
|
||||||
orr ah, r3
|
orrs ah, r3
|
||||||
neg r2, r2
|
negs r2, r2
|
||||||
mov r3, ip
|
mov r3, ip
|
||||||
lsr r3, r2
|
lsrs r3, r2
|
||||||
orr ah, r3
|
orrs ah, r3
|
||||||
RET
|
RET
|
||||||
#else
|
#else
|
||||||
subs r3, r2, #32
|
subs r3, r2, #32
|
||||||
|
@ -1695,26 +1699,26 @@ LSYM(Lover12):
|
||||||
#ifdef L_clzsi2
|
#ifdef L_clzsi2
|
||||||
#ifdef NOT_ISA_TARGET_32BIT
|
#ifdef NOT_ISA_TARGET_32BIT
|
||||||
FUNC_START clzsi2
|
FUNC_START clzsi2
|
||||||
mov r1, #28
|
movs r1, #28
|
||||||
mov r3, #1
|
movs r3, #1
|
||||||
lsl r3, r3, #16
|
lsls r3, r3, #16
|
||||||
cmp r0, r3 /* 0x10000 */
|
cmp r0, r3 /* 0x10000 */
|
||||||
bcc 2f
|
bcc 2f
|
||||||
lsr r0, r0, #16
|
lsrs r0, r0, #16
|
||||||
sub r1, r1, #16
|
subs r1, r1, #16
|
||||||
2: lsr r3, r3, #8
|
2: lsrs r3, r3, #8
|
||||||
cmp r0, r3 /* #0x100 */
|
cmp r0, r3 /* #0x100 */
|
||||||
bcc 2f
|
bcc 2f
|
||||||
lsr r0, r0, #8
|
lsrs r0, r0, #8
|
||||||
sub r1, r1, #8
|
subs r1, r1, #8
|
||||||
2: lsr r3, r3, #4
|
2: lsrs r3, r3, #4
|
||||||
cmp r0, r3 /* #0x10 */
|
cmp r0, r3 /* #0x10 */
|
||||||
bcc 2f
|
bcc 2f
|
||||||
lsr r0, r0, #4
|
lsrs r0, r0, #4
|
||||||
sub r1, r1, #4
|
subs r1, r1, #4
|
||||||
2: adr r2, 1f
|
2: adr r2, 1f
|
||||||
ldrb r0, [r2, r0]
|
ldrb r0, [r2, r0]
|
||||||
add r0, r0, r1
|
adds r0, r0, r1
|
||||||
bx lr
|
bx lr
|
||||||
.align 2
|
.align 2
|
||||||
1:
|
1:
|
||||||
|
@ -1757,34 +1761,49 @@ ARM_FUNC_START clzsi2
|
||||||
# ifdef NOT_ISA_TARGET_32BIT
|
# ifdef NOT_ISA_TARGET_32BIT
|
||||||
FUNC_START clzdi2
|
FUNC_START clzdi2
|
||||||
push {r4, lr}
|
push {r4, lr}
|
||||||
# else
|
|
||||||
ARM_FUNC_START clzdi2
|
|
||||||
do_push {r4, lr}
|
|
||||||
# endif
|
|
||||||
cmp xxh, #0
|
cmp xxh, #0
|
||||||
bne 1f
|
bne 1f
|
||||||
# ifdef __ARMEB__
|
# ifdef __ARMEB__
|
||||||
|
movs r0, xxl
|
||||||
|
bl __clzsi2
|
||||||
|
adds r0, r0, #32
|
||||||
|
b 2f
|
||||||
|
1:
|
||||||
|
bl __clzsi2
|
||||||
|
# else
|
||||||
|
bl __clzsi2
|
||||||
|
adds r0, r0, #32
|
||||||
|
b 2f
|
||||||
|
1:
|
||||||
|
movs r0, xxh
|
||||||
|
bl __clzsi2
|
||||||
|
# endif
|
||||||
|
2:
|
||||||
|
pop {r4, pc}
|
||||||
|
# else /* NOT_ISA_TARGET_32BIT */
|
||||||
|
ARM_FUNC_START clzdi2
|
||||||
|
do_push {r4, lr}
|
||||||
|
cmp xxh, #0
|
||||||
|
bne 1f
|
||||||
|
# ifdef __ARMEB__
|
||||||
mov r0, xxl
|
mov r0, xxl
|
||||||
bl __clzsi2
|
bl __clzsi2
|
||||||
add r0, r0, #32
|
add r0, r0, #32
|
||||||
b 2f
|
b 2f
|
||||||
1:
|
1:
|
||||||
bl __clzsi2
|
bl __clzsi2
|
||||||
# else
|
# else
|
||||||
bl __clzsi2
|
bl __clzsi2
|
||||||
add r0, r0, #32
|
add r0, r0, #32
|
||||||
b 2f
|
b 2f
|
||||||
1:
|
1:
|
||||||
mov r0, xxh
|
mov r0, xxh
|
||||||
bl __clzsi2
|
bl __clzsi2
|
||||||
# endif
|
# endif
|
||||||
2:
|
2:
|
||||||
# ifdef NOT_ISA_TARGET_32BIT
|
|
||||||
pop {r4, pc}
|
|
||||||
# else
|
|
||||||
RETLDM r4
|
RETLDM r4
|
||||||
# endif
|
|
||||||
FUNC_END clzdi2
|
FUNC_END clzdi2
|
||||||
|
# endif /* NOT_ISA_TARGET_32BIT */
|
||||||
|
|
||||||
#else /* defined (__ARM_FEATURE_CLZ) */
|
#else /* defined (__ARM_FEATURE_CLZ) */
|
||||||
|
|
||||||
|
@ -1803,28 +1822,28 @@ ARM_FUNC_START clzdi2
|
||||||
#ifdef L_ctzsi2
|
#ifdef L_ctzsi2
|
||||||
#ifdef NOT_ISA_TARGET_32BIT
|
#ifdef NOT_ISA_TARGET_32BIT
|
||||||
FUNC_START ctzsi2
|
FUNC_START ctzsi2
|
||||||
neg r1, r0
|
negs r1, r0
|
||||||
and r0, r0, r1
|
ands r0, r0, r1
|
||||||
mov r1, #28
|
movs r1, #28
|
||||||
mov r3, #1
|
movs r3, #1
|
||||||
lsl r3, r3, #16
|
lsls r3, r3, #16
|
||||||
cmp r0, r3 /* 0x10000 */
|
cmp r0, r3 /* 0x10000 */
|
||||||
bcc 2f
|
bcc 2f
|
||||||
lsr r0, r0, #16
|
lsrs r0, r0, #16
|
||||||
sub r1, r1, #16
|
subs r1, r1, #16
|
||||||
2: lsr r3, r3, #8
|
2: lsrs r3, r3, #8
|
||||||
cmp r0, r3 /* #0x100 */
|
cmp r0, r3 /* #0x100 */
|
||||||
bcc 2f
|
bcc 2f
|
||||||
lsr r0, r0, #8
|
lsrs r0, r0, #8
|
||||||
sub r1, r1, #8
|
subs r1, r1, #8
|
||||||
2: lsr r3, r3, #4
|
2: lsrs r3, r3, #4
|
||||||
cmp r0, r3 /* #0x10 */
|
cmp r0, r3 /* #0x10 */
|
||||||
bcc 2f
|
bcc 2f
|
||||||
lsr r0, r0, #4
|
lsrs r0, r0, #4
|
||||||
sub r1, r1, #4
|
subs r1, r1, #4
|
||||||
2: adr r2, 1f
|
2: adr r2, 1f
|
||||||
ldrb r0, [r2, r0]
|
ldrb r0, [r2, r0]
|
||||||
sub r0, r0, r1
|
subs r0, r0, r1
|
||||||
bx lr
|
bx lr
|
||||||
.align 2
|
.align 2
|
||||||
1:
|
1:
|
||||||
|
|
|
@ -63,28 +63,28 @@
|
||||||
/* r0 points to a 16-word block. Upload these values to the actual core
|
/* r0 points to a 16-word block. Upload these values to the actual core
|
||||||
state. */
|
state. */
|
||||||
FUNC_START restore_core_regs
|
FUNC_START restore_core_regs
|
||||||
mov r1, r0
|
movs r1, r0
|
||||||
add r1, r1, #52
|
adds r1, r1, #52
|
||||||
ldmia r1!, {r3, r4, r5}
|
ldmia r1!, {r3, r4, r5}
|
||||||
sub r3, r3, #4
|
subs r3, r3, #4
|
||||||
mov ip, r3
|
mov ip, r3
|
||||||
str r5, [r3]
|
str r5, [r3]
|
||||||
mov lr, r4
|
mov lr, r4
|
||||||
/* Restore r8-r11. */
|
/* Restore r8-r11. */
|
||||||
mov r1, r0
|
movs r1, r0
|
||||||
add r1, r1, #32
|
adds r1, r1, #32
|
||||||
ldmia r1!, {r2, r3, r4, r5}
|
ldmia r1!, {r2, r3, r4, r5}
|
||||||
mov r8, r2
|
mov r8, r2
|
||||||
mov r9, r3
|
mov r9, r3
|
||||||
mov sl, r4
|
mov sl, r4
|
||||||
mov fp, r5
|
mov fp, r5
|
||||||
mov r1, r0
|
movs r1, r0
|
||||||
add r1, r1, #8
|
adds r1, r1, #8
|
||||||
ldmia r1!, {r2, r3, r4, r5, r6, r7}
|
ldmia r1!, {r2, r3, r4, r5, r6, r7}
|
||||||
ldr r1, [r0, #4]
|
ldr r1, [r0, #4]
|
||||||
ldr r0, [r0]
|
ldr r0, [r0]
|
||||||
mov sp, ip
|
mov sp, ip
|
||||||
pop {pc}
|
pop {pc}
|
||||||
FUNC_END restore_core_regs
|
FUNC_END restore_core_regs
|
||||||
UNPREFIX restore_core_regs
|
UNPREFIX restore_core_regs
|
||||||
|
|
||||||
|
@ -132,38 +132,38 @@ FUNC_START gnu_Unwind_Save_WMMXC
|
||||||
FUNC_START \name
|
FUNC_START \name
|
||||||
/* Create a phase2_vrs structure. */
|
/* Create a phase2_vrs structure. */
|
||||||
/* Save r0 in the PC slot so we can use it as a scratch register. */
|
/* Save r0 in the PC slot so we can use it as a scratch register. */
|
||||||
push {r0}
|
push {r0}
|
||||||
add r0, sp, #4
|
add r0, sp, #4
|
||||||
push {r0, lr} /* Push original SP and LR. */
|
push {r0, lr} /* Push original SP and LR. */
|
||||||
/* Make space for r8-r12. */
|
/* Make space for r8-r12. */
|
||||||
sub sp, sp, #20
|
sub sp, sp, #20
|
||||||
/* Save low registers. */
|
/* Save low registers. */
|
||||||
push {r0, r1, r2, r3, r4, r5, r6, r7}
|
push {r0, r1, r2, r3, r4, r5, r6, r7}
|
||||||
/* Save high registers. */
|
/* Save high registers. */
|
||||||
add r0, sp, #32
|
add r0, sp, #32
|
||||||
mov r1, r8
|
mov r1, r8
|
||||||
mov r2, r9
|
mov r2, r9
|
||||||
mov r3, sl
|
mov r3, sl
|
||||||
mov r4, fp
|
mov r4, fp
|
||||||
mov r5, ip
|
mov r5, ip
|
||||||
stmia r0!, {r1, r2, r3, r4, r5}
|
stmia r0!, {r1, r2, r3, r4, r5}
|
||||||
/* Restore original low register values. */
|
/* Restore original low register values. */
|
||||||
add r0, sp, #4
|
add r0, sp, #4
|
||||||
ldmia r0!, {r1, r2, r3, r4, r5}
|
ldmia r0!, {r1, r2, r3, r4, r5}
|
||||||
/* Restore orginial r0. */
|
/* Restore orginial r0. */
|
||||||
ldr r0, [sp, #60]
|
ldr r0, [sp, #60]
|
||||||
str r0, [sp]
|
str r0, [sp]
|
||||||
/* Demand-save flags, plus an extra word for alignment. */
|
/* Demand-save flags, plus an extra word for alignment. */
|
||||||
mov r3, #0
|
movs r3, #0
|
||||||
push {r2, r3}
|
push {r2, r3}
|
||||||
/* Point r1 at the block. Pass r[0..nargs) unchanged. */
|
/* Point r1 at the block. Pass r[0..nargs) unchanged. */
|
||||||
add r\nargs, sp, #4
|
add r\nargs, sp, #4
|
||||||
|
|
||||||
bl SYM (__gnu\name)
|
bl SYM (__gnu\name)
|
||||||
|
|
||||||
ldr r3, [sp, #64]
|
ldr r3, [sp, #64]
|
||||||
add sp, sp, #72
|
add sp, sp, #72
|
||||||
bx r3
|
bx r3
|
||||||
|
|
||||||
FUNC_END \name
|
FUNC_END \name
|
||||||
UNPREFIX \name
|
UNPREFIX \name
|
||||||
|
|
Loading…
Reference in New Issue