diff options
| author | Weiming Zhao <weimingz@codeaurora.org> | 2017-04-06 06:13:39 +0000 |
|---|---|---|
| committer | Weiming Zhao <weimingz@codeaurora.org> | 2017-04-06 06:13:39 +0000 |
| commit | fbe67da29b08e7e52e0074989f15b2fa4c3cad98 (patch) | |
| tree | c0dde42666c985da4a90878b49d87c8d2b28b4a4 | |
| parent | f7298b0ef034feea0a69e0a9b975913d9e2a39d7 (diff) | |
| download | bcm5719-llvm-fbe67da29b08e7e52e0074989f15b2fa4c3cad98.tar.gz bcm5719-llvm-fbe67da29b08e7e52e0074989f15b2fa4c3cad98.zip | |
[Builtins] Fix div0 error in udivsi3
Summary: Need to save `lr` before bl to aeabi_div0
Reviewers: rengolin, compnerd
Reviewed By: compnerd
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D31716
llvm-svn: 299628
| -rw-r--r-- | compiler-rt/lib/builtins/arm/udivsi3.S | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/compiler-rt/lib/builtins/arm/udivsi3.S b/compiler-rt/lib/builtins/arm/udivsi3.S index fcc472b4f3d..b97b3080bff 100644 --- a/compiler-rt/lib/builtins/arm/udivsi3.S +++ b/compiler-rt/lib/builtins/arm/udivsi3.S @@ -37,7 +37,16 @@ DEFINE_COMPILERRT_FUNCTION(__udivsi3) beq LOCAL_LABEL(divby0) udiv r0, r0, r1 bx lr -#else + +LOCAL_LABEL(divby0): + mov r0, #0 +# ifdef __ARM_EABI__ + b __aeabi_idiv0 +# else + JMP(lr) +# endif + +#else /* ! __ARM_ARCH_EXT_IDIV__ */ cmp r1, #1 bcc LOCAL_LABEL(divby0) #if __ARM_ARCH_ISA_THUMB == 1 @@ -186,9 +195,12 @@ LOCAL_LABEL(skip_1): LOCAL_LABEL(divby0): movs r0, #0 # if defined(__ARM_EABI__) + push {r7, lr} bl __aeabi_idiv0 // due to relocation limit, can't use b. -# endif + pop {r7, pc} +# else JMP(lr) +# endif #if __ARM_ARCH_ISA_THUMB == 1 @@ -252,16 +264,6 @@ LOCAL_LABEL(div0block): JMP(lr) #endif /* __ARM_ARCH_EXT_IDIV__ */ -#if __ARM_ARCH_EXT_IDIV__ -LOCAL_LABEL(divby0): - mov r0, #0 -# ifdef __ARM_EABI__ - b __aeabi_idiv0 -# else - JMP(lr) -# endif -#endif - END_COMPILERRT_FUNCTION(__udivsi3) NO_EXEC_STACK_DIRECTIVE |

