[PATCH] D60809: [builtins] __gnu_{ldivmod, uldivmod}_helper for libgcc compatibility
Yi Kong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 21:10:15 PDT 2019
kongyi created this revision.
kongyi added reviewers: peter.smith, kristof.beyls, rengolin.
Herald added projects: LLVM, Sanitizers.
Herald added subscribers: llvm-commits, Sanitizers.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D60809
Files:
compiler-rt/lib/builtins/divdi3.c
compiler-rt/lib/builtins/udivdi3.c
Index: compiler-rt/lib/builtins/udivdi3.c
===================================================================
--- compiler-rt/lib/builtins/udivdi3.c
+++ compiler-rt/lib/builtins/udivdi3.c
@@ -20,3 +20,13 @@
{
return __udivmoddi4(a, b, 0);
}
+
+#if defined(__ARM_EABI__)
+// For libgcc compatibility
+COMPILER_RT_ABI du_int
+__gnu_uldivmod_helper(du_int a, du_int b, du_int *remainder) {
+ di_int quotient = __udivdi3 (a, b);
+ *remainder = a - b * quotient;
+ return quotient;
+}
+#endif
\ No newline at end of file
Index: compiler-rt/lib/builtins/divdi3.c
===================================================================
--- compiler-rt/lib/builtins/divdi3.c
+++ compiler-rt/lib/builtins/divdi3.c
@@ -26,3 +26,13 @@
s_a ^= s_b; /*sign of quotient */
return (__udivmoddi4(a, b, (du_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */
}
+
+#if defined(__ARM_EABI__)
+// For libgcc compatibility
+COMPILER_RT_ABI di_int
+__gnu_ldivmod_helper(di_int a, di_int b, di_int *remainder) {
+ di_int quotient = __divdi3 (a, b);
+ *remainder = a - b * quotient;
+ return quotient;
+}
+#endif
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60809.195508.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190417/33638cc0/attachment.bin>
More information about the llvm-commits
mailing list