[PATCH] D36675: [ARM][Compiler-rt] Fix AEABI builtins to correctly pass arguments to non-AEABI functions on HF targets

Oleg Ranevskyy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 06:26:52 PDT 2017


iid_iunknown created this revision.
Herald added subscribers: kristof.beyls, javed.absar, dberris, aemerson.

This is a patch for PR34167.

On HF targets functions like `__{eq,lt,le,ge,gt}df2` and `__{eq,lt,le,ge,gt}sf2` expect their arguments to be passed in d/s registers, while some of the AEABI builtins pass them in r registers.


Repository:
  rL LLVM

https://reviews.llvm.org/D36675

Files:
  lib/builtins/arm/aeabi_dcmp.S
  lib/builtins/arm/aeabi_fcmp.S


Index: lib/builtins/arm/aeabi_fcmp.S
===================================================================
--- lib/builtins/arm/aeabi_fcmp.S
+++ lib/builtins/arm/aeabi_fcmp.S
@@ -18,11 +18,20 @@
 //   }
 // }
 
+#if defined(COMPILER_RT_ARMHF_TARGET)
+#  define AEABI_ARGS_TO_VFP_ARGS                           \
+        vmov      s0, r0                         SEPARATOR \
+        vmov      s1, r1
+#else
+#  define AEABI_ARGS_TO_VFP_ARGS
+#endif
+
 #define DEFINE_AEABI_FCMP(cond)                            \
         .syntax unified                          SEPARATOR \
         .p2align 2                               SEPARATOR \
 DEFINE_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond)           \
         push      { r4, lr }                     SEPARATOR \
+        AEABI_ARGS_TO_VFP_ARGS                   SEPARATOR \
         bl        SYMBOL_NAME(__ ## cond ## sf2) SEPARATOR \
         cmp       r0, #0                         SEPARATOR \
         b ## cond 1f                             SEPARATOR \
Index: lib/builtins/arm/aeabi_dcmp.S
===================================================================
--- lib/builtins/arm/aeabi_dcmp.S
+++ lib/builtins/arm/aeabi_dcmp.S
@@ -18,11 +18,20 @@
 //   }
 // }
 
+#if defined(COMPILER_RT_ARMHF_TARGET)
+#  define AEABI_ARGS_TO_VFP_ARGS                           \
+        vmov      d0, r0, r1                     SEPARATOR \
+        vmov      d1, r2, r3
+#else
+#  define AEABI_ARGS_TO_VFP_ARGS
+#endif
+
 #define DEFINE_AEABI_DCMP(cond)                            \
         .syntax unified                          SEPARATOR \
         .p2align 2                               SEPARATOR \
 DEFINE_COMPILERRT_FUNCTION(__aeabi_dcmp ## cond)           \
         push      { r4, lr }                     SEPARATOR \
+        AEABI_ARGS_TO_VFP_ARGS                   SEPARATOR \
         bl        SYMBOL_NAME(__ ## cond ## df2) SEPARATOR \
         cmp       r0, #0                         SEPARATOR \
         b ## cond 1f                             SEPARATOR \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36675.110950.patch
Type: text/x-patch
Size: 2058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170814/28f3907e/attachment.bin>


More information about the llvm-commits mailing list