[llvm-commits] [compiler-rt] r149242 - in /compiler-rt/trunk/lib: arm/aeabi_idivmod.S arm/aeabi_ldivmod.S arm/aeabi_uidivmod.S arm/aeabi_uldivmod.S divmoddi4.c udivmoddi4.c
Anton Korobeynikov
asl at math.spbu.ru
Mon Jan 30 02:21:51 PST 2012
Author: asl
Date: Mon Jan 30 04:21:51 2012
New Revision: 149242
URL: http://llvm.org/viewvc/llvm-project?rev=149242&view=rev
Log:
Proper divmod implementation
Added:
compiler-rt/trunk/lib/arm/aeabi_idivmod.S
compiler-rt/trunk/lib/arm/aeabi_ldivmod.S
compiler-rt/trunk/lib/arm/aeabi_uidivmod.S
compiler-rt/trunk/lib/arm/aeabi_uldivmod.S
Modified:
compiler-rt/trunk/lib/divmoddi4.c
compiler-rt/trunk/lib/udivmoddi4.c
Added: compiler-rt/trunk/lib/arm/aeabi_idivmod.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/aeabi_idivmod.S?rev=149242&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/aeabi_idivmod.S (added)
+++ compiler-rt/trunk/lib/arm/aeabi_idivmod.S Mon Jan 30 04:21:51 2012
@@ -0,0 +1,27 @@
+//===-- aeabi_idivmod.S - EABI idivmod implementation ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+// struct { int quot, int rem} __aeabi_idivmod(int numerator, int denominator) {
+// int rem, quot;
+// quot = __divmodsi4(numerator, denominator, &rem);
+// return {quot, rem};
+// }
+
+ .syntax unified
+ .align 2
+DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod)
+ push { lr }
+ sub sp, sp, #4
+ mov r2, sp
+ bl SYMBOL_NAME(__divmodsi4)
+ ldr r1, [sp]
+ add sp, sp, #4
+ pop { pc }
Added: compiler-rt/trunk/lib/arm/aeabi_ldivmod.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/aeabi_ldivmod.S?rev=149242&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/aeabi_ldivmod.S (added)
+++ compiler-rt/trunk/lib/arm/aeabi_ldivmod.S Mon Jan 30 04:21:51 2012
@@ -0,0 +1,30 @@
+//===-- aeabi_ldivmod.S - EABI ldivmod implementation ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+// struct { int64_t quot, int64_t rem}
+// __aeabi_ldivmod(int64_t numerator, int64_t denominator) {
+// int64_t rem, quot;
+// quot = __divmoddi4(numerator, denominator, &rem);
+// return {quot, rem};
+// }
+
+ .syntax unified
+ .align 2
+DEFINE_COMPILERRT_FUNCTION(__aeabi_ldivmod)
+ push {r11, lr}
+ sub sp, sp, #16
+ add r12, sp, #8
+ str r12, [sp]
+ bl SYMBOL_NAME(__divmoddi4)
+ ldr r2, [sp, #8]
+ ldr r3, [sp, #12]
+ add sp, sp, #16
+ pop {r11, pc}
Added: compiler-rt/trunk/lib/arm/aeabi_uidivmod.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/aeabi_uidivmod.S?rev=149242&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/aeabi_uidivmod.S (added)
+++ compiler-rt/trunk/lib/arm/aeabi_uidivmod.S Mon Jan 30 04:21:51 2012
@@ -0,0 +1,28 @@
+//===-- aeabi_uidivmod.S - EABI uidivmod implementation -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+// struct { unsigned quot, unsigned rem}
+// __aeabi_uidivmod(unsigned numerator, unsigned denominator) {
+// unsigned rem, quot;
+// quot = __udivmodsi4(numerator, denominator, &rem);
+// return {quot, rem};
+// }
+
+ .syntax unified
+ .align 2
+DEFINE_COMPILERRT_FUNCTION(__aeabi_uidivmod)
+ push { lr }
+ sub sp, sp, #4
+ mov r2, sp
+ bl SYMBOL_NAME(__udivmodsi4)
+ ldr r1, [sp]
+ add sp, sp, #4
+ pop { pc }
Added: compiler-rt/trunk/lib/arm/aeabi_uldivmod.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/arm/aeabi_uldivmod.S?rev=149242&view=auto
==============================================================================
--- compiler-rt/trunk/lib/arm/aeabi_uldivmod.S (added)
+++ compiler-rt/trunk/lib/arm/aeabi_uldivmod.S Mon Jan 30 04:21:51 2012
@@ -0,0 +1,30 @@
+//===-- aeabi_uldivmod.S - EABI uldivmod implementation -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../assembly.h"
+
+// struct { uint64_t quot, uint64_t rem}
+// __aeabi_uldivmod(uint64_t numerator, uint64_t denominator) {
+// uint64_t rem, quot;
+// quot = __udivmoddi4(numerator, denominator, &rem);
+// return {quot, rem};
+// }
+
+ .syntax unified
+ .align 2
+DEFINE_COMPILERRT_FUNCTION(__aeabi_uldivmod)
+ push {r11, lr}
+ sub sp, sp, #16
+ add r12, sp, #8
+ str r12, [sp]
+ bl SYMBOL_NAME(__udivmoddi4)
+ ldr r2, [sp, #8]
+ ldr r3, [sp, #12]
+ add sp, sp, #16
+ pop {r11, pc}
\ No newline at end of file
Modified: compiler-rt/trunk/lib/divmoddi4.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divmoddi4.c?rev=149242&r1=149241&r2=149242&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divmoddi4.c (original)
+++ compiler-rt/trunk/lib/divmoddi4.c Mon Jan 30 04:21:51 2012
@@ -16,8 +16,6 @@
extern COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b);
-ARM_EABI_FNALIAS(ldivmod, divmoddi4);
-
/* Returns: a / b, *rem = a % b */
COMPILER_RT_ABI di_int
Modified: compiler-rt/trunk/lib/udivmoddi4.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/udivmoddi4.c?rev=149242&r1=149241&r2=149242&view=diff
==============================================================================
--- compiler-rt/trunk/lib/udivmoddi4.c (original)
+++ compiler-rt/trunk/lib/udivmoddi4.c Mon Jan 30 04:21:51 2012
@@ -20,8 +20,6 @@
/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */
-ARM_EABI_FNALIAS(uldivmod, udivmoddi4);
-
COMPILER_RT_ABI du_int
__udivmoddi4(du_int a, du_int b, du_int* rem)
{
More information about the llvm-commits
mailing list