summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2011-04-19 18:14:19 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2011-04-19 18:14:19 +0000
commit94d371c3109adba654f854f8b69d9c4570a01f42 (patch)
tree741c580af3e8e7a0e46e6bace3d129b73eef9424
parent1c5f89b1dd741135a4007ab577723d422f421eec (diff)
downloadcompiler-rt-94d371c3109adba654f854f8b69d9c4570a01f42.tar.gz
Add missed files from my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@129777 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/abi.h23
-rw-r--r--lib/divmoddi4.c30
2 files changed, 53 insertions, 0 deletions
diff --git a/lib/abi.h b/lib/abi.h
new file mode 100644
index 000000000..2534317ac
--- /dev/null
+++ b/lib/abi.h
@@ -0,0 +1,23 @@
+/* ===------ abi.h - configuration header for compiler-rt -----------------===
+ *
+ * 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.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file is a configuration header for compiler-rt.
+ * This file is not part of the interface of this library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
+
+#if __ARM_EABI__
+# define ARM_EABI_FNALIAS(aeabi_name, name) \
+ void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
+# define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
+#else
+# define ARM_EABI_FNALIAS(aeabi_name, name)
+# define COMPILER_RT_ABI
+#endif
diff --git a/lib/divmoddi4.c b/lib/divmoddi4.c
new file mode 100644
index 000000000..d3ca745ac
--- /dev/null
+++ b/lib/divmoddi4.c
@@ -0,0 +1,30 @@
+/*===-- divmoddi4.c - Implement __divmoddi4 --------------------------------===
+ *
+ * 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.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __divmoddi4 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
+#include "abi.h"
+
+#include "int_lib.h"
+
+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
+__divmoddi4(di_int a, di_int b, di_int* rem)
+{
+ di_int d = __divdi3(a,b);
+ *rem = a - (d*b);
+ return d;
+}