arm: unified syntax for libgcc when built with -Os [PR94220]

The recent patch to convert all thumb1 code in libgcc to unified syntax
ommitted the conditional code that is used only when building the library
for minimal size.  This patch fixes this case.

I've also fixed the COND macro so that a single definition is always used
that is for unified syntax.  This eliminates a warning that is now being
seen from the assembler when compiling the ieee fp support code.

	PR target/94220
	* config/arm/lib1funcs.asm (COND): Use a single definition for
	unified syntax.
	(aeabi_uidivmod): Unified syntax when optimizing Thumb for size.
	(aeabi_idivmod): Likewise.
	(divsi3_skip_div0_test): Likewise.
This commit is contained in:
Richard Earnshaw 2020-03-24 14:45:50 +00:00
parent 40cdcddf27
commit e519d64499
2 changed files with 26 additions and 16 deletions

View File

@ -1,3 +1,12 @@
2020-03-26 Richard Earnshaw <rearnsha@arm.com>
PR target/94220
* config/arm/lib1funcs.asm (COND): Use a single definition for
unified syntax.
(aeabi_uidivmod): Unified syntax when optimizing Thumb for size.
(aeabi_idivmod): Likewise.
(divsi3_skip_div0_test): Likewise.
2020-03-26 Jakub Jelinek <jakub@redhat.com> 2020-03-26 Jakub Jelinek <jakub@redhat.com>
PR debug/94323 PR debug/94323

View File

@ -226,7 +226,6 @@ LSYM(Lend_fde):
.endm .endm
#define do_push push #define do_push push
#define do_pop pop #define do_pop pop
#define COND(op1, op2, cond) op1 ## op2 ## cond
/* Perform an arithmetic operation with a variable shift operand. This /* Perform an arithmetic operation with a variable shift operand. This
requires two instructions and a scratch register on Thumb-2. */ requires two instructions and a scratch register on Thumb-2. */
.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp .macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
@ -241,12 +240,13 @@ LSYM(Lend_fde):
.endm .endm
#define do_push stmfd sp!, #define do_push stmfd sp!,
#define do_pop ldmfd sp!, #define do_pop ldmfd sp!,
#define COND(op1, op2, cond) op1 ## cond ## op2
.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp .macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
\name \dest, \src1, \src2, \shiftop \shiftreg \name \dest, \src1, \src2, \shiftop \shiftreg
.endm .endm
#endif #endif
#define COND(op1, op2, cond) op1 ## op2 ## cond
#ifdef __ARM_EABI__ #ifdef __ARM_EABI__
.macro ARM_LDIV0 name signed .macro ARM_LDIV0 name signed
cmp r0, #0 cmp r0, #0
@ -494,7 +494,8 @@ pc .req r15
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* Bodies of the division and modulo routines. */ /* Bodies of the division and modulo routines. */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
.macro ARM_DIV_BODY dividend, divisor, result, curbit .macro ARM_DIV_BODY dividend, divisor, result, curbit
#if defined (__ARM_FEATURE_CLZ) && ! defined (__OPTIMIZE_SIZE__) #if defined (__ARM_FEATURE_CLZ) && ! defined (__OPTIMIZE_SIZE__)
@ -1136,8 +1137,8 @@ FUNC_START aeabi_uidivmod
push {r0, r1, lr} push {r0, r1, lr}
bl LSYM(udivsi3_skip_div0_test) bl LSYM(udivsi3_skip_div0_test)
POP {r1, r2, r3} POP {r1, r2, r3}
mul r2, r0 muls r2, r0
sub r1, r1, r2 subs r1, r1, r2
bx r3 bx r3
# else # else
/* Both the quotient and remainder are calculated simultaneously /* Both the quotient and remainder are calculated simultaneously
@ -1151,7 +1152,7 @@ FUNC_START aeabi_uidivmod
ARM_FUNC_START aeabi_uidivmod ARM_FUNC_START aeabi_uidivmod
cmp r1, #0 cmp r1, #0
beq LSYM(Ldiv0) beq LSYM(Ldiv0)
mov r2, r0 mov r2, r0
udiv r0, r0, r1 udiv r0, r0, r1
mls r1, r0, r1, r2 mls r1, r0, r1, r2
RET RET
@ -1235,29 +1236,29 @@ LSYM(Lover10):
beq LSYM(Ldiv0) beq LSYM(Ldiv0)
LSYM(divsi3_skip_div0_test): LSYM(divsi3_skip_div0_test):
push { work } push { work }
mov work, dividend movs work, dividend
eor work, divisor @ Save the sign of the result. eors work, divisor @ Save the sign of the result.
mov ip, work mov ip, work
mov curbit, #1 movs curbit, #1
mov result, #0 movs result, #0
cmp divisor, #0 cmp divisor, #0
bpl LSYM(Lover10) bpl LSYM(Lover10)
neg divisor, divisor @ Loops below use unsigned. negs divisor, divisor @ Loops below use unsigned.
LSYM(Lover10): LSYM(Lover10):
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)
THUMB_DIV_MOD_BODY 0 THUMB_DIV_MOD_BODY 0
mov r0, result movs r0, result
mov work, ip mov work, ip
cmp work, #0 cmp work, #0
bpl LSYM(Lover12) bpl LSYM(Lover12)
neg r0, r0 negs r0, r0
LSYM(Lover12): LSYM(Lover12):
pop { work } pop { work }
RET RET
@ -1348,8 +1349,8 @@ FUNC_START aeabi_idivmod
push {r0, r1, lr} push {r0, r1, lr}
bl LSYM(divsi3_skip_div0_test) bl LSYM(divsi3_skip_div0_test)
POP {r1, r2, r3} POP {r1, r2, r3}
mul r2, r0 muls r2, r0
sub r1, r1, r2 subs r1, r1, r2
bx r3 bx r3
# else # else
/* Both the quotient and remainder are calculated simultaneously /* Both the quotient and remainder are calculated simultaneously