diff options
| author | Weiming Zhao <weimingz@codeaurora.org> | 2017-03-24 17:06:00 +0000 |
|---|---|---|
| committer | Weiming Zhao <weimingz@codeaurora.org> | 2017-03-24 17:06:00 +0000 |
| commit | 19bf8bfa158b1b63cee2285d3f99fd98199a32b9 (patch) | |
| tree | 5ac2112e529c061a4c3fe825a9b5bc465e5f87a0 /compiler-rt/lib/builtins/arm/aeabi_idivmod.S | |
| parent | dfbf049e7ffaf8cfcd5287e1a806bb085d5c2f90 (diff) | |
| download | bcm5719-llvm-19bf8bfa158b1b63cee2285d3f99fd98199a32b9.tar.gz bcm5719-llvm-19bf8bfa158b1b63cee2285d3f99fd98199a32b9.zip | |
builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
- use __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB
- use '.thumb' directive consistently in all affected files
- decorate all thumb functions using
DEFINE_COMPILERRT_THUMB_FUNCTION()
---------
Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !
Reviewers: weimingz, rengolin, compnerd
Subscribers: aemerson, dim
Differential Revision: https://reviews.llvm.org/D30938
llvm-svn: 298713
Diffstat (limited to 'compiler-rt/lib/builtins/arm/aeabi_idivmod.S')
| -rw-r--r-- | compiler-rt/lib/builtins/arm/aeabi_idivmod.S | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler-rt/lib/builtins/arm/aeabi_idivmod.S b/compiler-rt/lib/builtins/arm/aeabi_idivmod.S index 0164b15dca1..4419929f62a 100644 --- a/compiler-rt/lib/builtins/arm/aeabi_idivmod.S +++ b/compiler-rt/lib/builtins/arm/aeabi_idivmod.S @@ -20,16 +20,25 @@ #endif .syntax unified + .syntax unified + .text +#if defined(USE_THUMB_PROLOGUE) + .thumb +#endif .p2align 2 +#if defined(USE_THUMB_PROLOGUE) +DEFINE_COMPILERRT_THUMB_FUNCTION(__aeabi_idivmod) +#else DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod) -#if __ARM_ARCH_ISA_THUMB == 1 +#endif +#if defined(USE_THUMB_1) push {r0, r1, lr} bl SYMBOL_NAME(__divsi3) pop {r1, r2, r3} // now r0 = quot, r1 = num, r2 = denom muls r2, r0, r2 // r2 = quot * denom subs r1, r1, r2 JMP (r3) -#else +#else // defined(USE_THUMB_1) push { lr } sub sp, sp, #4 mov r2, sp @@ -42,7 +51,7 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod) ldr r1, [sp] add sp, sp, #4 pop { pc } -#endif // __ARM_ARCH_ISA_THUMB == 1 +#endif // defined(USE_THUMB_1) END_COMPILERRT_FUNCTION(__aeabi_idivmod) NO_EXEC_STACK_DIRECTIVE |

