[llvm-branch-commits] [compiler-rt-branch] r216035 - Merging r215295:

Renato Golin renato.golin at linaro.org
Tue Aug 19 16:30:32 PDT 2014


Author: rengolin
Date: Tue Aug 19 18:30:32 2014
New Revision: 216035

URL: http://llvm.org/viewvc/llvm-project?rev=216035&view=rev
Log:
Merging r215295:
------------------------------------------------------------------------
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.
------------------------------------------------------------------------

Modified:
    compiler-rt/branches/release_35/lib/builtins/arm/udivsi3.S
    compiler-rt/branches/release_35/lib/builtins/arm/umodsi3.S

Modified: compiler-rt/branches/release_35/lib/builtins/arm/udivsi3.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_35/lib/builtins/arm/udivsi3.S?rev=216035&r1=216034&r2=216035&view=diff
==============================================================================
--- compiler-rt/branches/release_35/lib/builtins/arm/udivsi3.S (original)
+++ compiler-rt/branches/release_35/lib/builtins/arm/udivsi3.S Tue Aug 19 18:30:32 2014
@@ -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

Modified: compiler-rt/branches/release_35/lib/builtins/arm/umodsi3.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_35/lib/builtins/arm/umodsi3.S?rev=216035&r1=216034&r2=216035&view=diff
==============================================================================
--- compiler-rt/branches/release_35/lib/builtins/arm/umodsi3.S (original)
+++ compiler-rt/branches/release_35/lib/builtins/arm/umodsi3.S Tue Aug 19 18:30:32 2014
@@ -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





More information about the llvm-branch-commits mailing list