[PATCH] D60809: [builtins] __gnu_[u]ldivmod_helper for libgcc compatibility

Yi Kong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 09:40:32 PDT 2019


kongyi updated this revision to Diff 195587.
kongyi retitled this revision from "[builtins] __gnu_{ldivmod,uldivmod}_helper for libgcc compatibility" to "[builtins] __gnu_[u]ldivmod_helper for libgcc compatibility".
kongyi edited the summary of this revision.
Herald added a subscriber: krytarowski.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60809/new/

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(__ANDROID__) && 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
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(__ANDROID__) && 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60809.195587.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190417/829db038/attachment.bin>


More information about the llvm-commits mailing list