diff options
author | Renato Golin <renato.golin@linaro.org> | 2014-08-19 23:30:32 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2014-08-19 23:30:32 +0000 |
commit | 271e25e5b9e9e4f4fd12526b0055928eeaeb9fbf (patch) | |
tree | 543b5d8f013f65d38a76b9e689242748b176cf98 | |
parent | 9bf0d633639145432da2e5dd249d1bade4eff3a2 (diff) | |
download | compiler-rt-release_35.tar.gz |
Merging r215295:release_35
------------------------------------------------------------------------
r215295 | compnerd | 2014-08-09 21:17:37 +0100 (Sat, 09 Aug 2014) | 10 lines
builtins: correct __umodsi3, __udivsi3 on ARM
When building the builtins for a modern CPU (idiv support), __umodsi3 was
completely incorrect as it would behave as __udivmosi3, which takes a tertiary
parameter which is a pointer.
__udivsi3 was also incorrect, returning the remainder in r1. Although this
would not result in any crash or invalid behaviour as r1 is a caller saved
register in AAPCS, this is unnecessary. Simply perform the division ignoring
the remainder.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_35@216035 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/builtins/arm/udivsi3.S | 4 | ||||
-rw-r--r-- | lib/builtins/arm/umodsi3.S | 6 |
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/builtins/arm/udivsi3.S b/lib/builtins/arm/udivsi3.S index 19fea56a2..a3939f50f 100644 --- a/lib/builtins/arm/udivsi3.S +++ b/lib/builtins/arm/udivsi3.S @@ -35,9 +35,7 @@ DEFINE_COMPILERRT_FUNCTION(__udivsi3) #if __ARM_ARCH_EXT_IDIV__ tst r1, r1 beq LOCAL_LABEL(divby0) - mov r3, r0 - udiv r0, r3, r1 - mls r1, r0, r1, r3 + udiv r0, r0, r1 bx lr #else cmp r1, #1 diff --git a/lib/builtins/arm/umodsi3.S b/lib/builtins/arm/umodsi3.S index e81af0c14..993ac8bad 100644 --- a/lib/builtins/arm/umodsi3.S +++ b/lib/builtins/arm/umodsi3.S @@ -33,10 +33,8 @@ DEFINE_COMPILERRT_FUNCTION(__umodsi3) #if __ARM_ARCH_EXT_IDIV__ tst r1, r1 beq LOCAL_LABEL(divby0) - mov r3, r0 - udiv r0, r3, r1 - mls r1, r0, r1, r3 - str r1, [r2] + udiv r2, r0, r1 + mls r0, r2, r1, r0 bx lr #else cmp r1, #1 |