[compiler-rt] 0c0eeb7 - [builtins] Add support for single-precision-only-FPU ARM targets.

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 07:12:30 PST 2020


Author: Zhuojia Shen
Date: 2020-11-12T15:10:48Z
New Revision: 0c0eeb78eb0d77bb31d695a14e9582f75d36a99f

URL: https://github.com/llvm/llvm-project/commit/0c0eeb78eb0d77bb31d695a14e9582f75d36a99f
DIFF: https://github.com/llvm/llvm-project/commit/0c0eeb78eb0d77bb31d695a14e9582f75d36a99f.diff

LOG: [builtins] Add support for single-precision-only-FPU ARM targets.

This patch enables building compiler-rt builtins for ARM targets that
only support single-precision floating point instructions (e.g., those
with -mfpu=fpv4-sp-d16).

This fixes PR42838

Differential Revision: https://reviews.llvm.org/D90698

Added: 
    

Modified: 
    compiler-rt/lib/builtins/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index b54e53417989..3c29bba612e1 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -426,40 +426,42 @@ set(arm_Thumb1_SjLj_EH_SOURCES
   arm/restore_vfp_d8_d15_regs.S
   arm/save_vfp_d8_d15_regs.S
 )
-set(arm_Thumb1_VFPv2_SOURCES
+set(arm_Thumb1_VFPv2_DP_SOURCES
   arm/adddf3vfp.S
-  arm/addsf3vfp.S
   arm/divdf3vfp.S
-  arm/divsf3vfp.S
   arm/eqdf2vfp.S
-  arm/eqsf2vfp.S
   arm/extendsfdf2vfp.S
   arm/fixdfsivfp.S
-  arm/fixsfsivfp.S
   arm/fixunsdfsivfp.S
-  arm/fixunssfsivfp.S
   arm/floatsidfvfp.S
-  arm/floatsisfvfp.S
   arm/floatunssidfvfp.S
-  arm/floatunssisfvfp.S
   arm/gedf2vfp.S
-  arm/gesf2vfp.S
   arm/gtdf2vfp.S
-  arm/gtsf2vfp.S
   arm/ledf2vfp.S
-  arm/lesf2vfp.S
   arm/ltdf2vfp.S
-  arm/ltsf2vfp.S
   arm/muldf3vfp.S
-  arm/mulsf3vfp.S
   arm/nedf2vfp.S
   arm/negdf2vfp.S
-  arm/negsf2vfp.S
-  arm/nesf2vfp.S
   arm/subdf3vfp.S
-  arm/subsf3vfp.S
   arm/truncdfsf2vfp.S
   arm/unorddf2vfp.S
+)
+set(arm_Thumb1_VFPv2_SP_SOURCES
+  arm/addsf3vfp.S
+  arm/divsf3vfp.S
+  arm/eqsf2vfp.S
+  arm/fixsfsivfp.S
+  arm/fixunssfsivfp.S
+  arm/floatsisfvfp.S
+  arm/floatunssisfvfp.S
+  arm/gesf2vfp.S
+  arm/gtsf2vfp.S
+  arm/lesf2vfp.S
+  arm/ltsf2vfp.S
+  arm/mulsf3vfp.S
+  arm/negsf2vfp.S
+  arm/nesf2vfp.S
+  arm/subsf3vfp.S
   arm/unordsf2vfp.S
 )
 set(arm_Thumb1_icache_SOURCES
@@ -468,7 +470,8 @@ set(arm_Thumb1_icache_SOURCES
 set(arm_Thumb1_SOURCES
   ${arm_Thumb1_JT_SOURCES}
   ${arm_Thumb1_SjLj_EH_SOURCES}
-  ${arm_Thumb1_VFPv2_SOURCES}
+  ${arm_Thumb1_VFPv2_DP_SOURCES}
+  ${arm_Thumb1_VFPv2_SP_SOURCES}
   ${arm_Thumb1_icache_SOURCES}
 )
 
@@ -655,7 +658,16 @@ else ()
         string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
         check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
         if(NOT COMPILER_RT_HAS_${arch}_VFP)
-          list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
+          list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES} ${arm_Thumb1_VFPv2_SP_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
+        else()
+          # Exclude any double-precision builtins if VFP is single-precision-only
+          check_c_source_compiles("#if !(__ARM_FP & 0x8)
+                                   #error No double-precision support!
+                                   #endif
+                                   int main() { return 0; }" COMPILER_RT_HAS_${arch}_VFP_DP)
+          if(NOT COMPILER_RT_HAS_${arch}_VFP_DP)
+            list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES})
+          endif()
         endif()
       endif()
 


        


More information about the llvm-commits mailing list