[libc-commits] [PATCH] D146253: [libc] Enabled more tests for targets other than x86_64

Mikhail Ramalho via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Mar 16 11:49:24 PDT 2023


mikhail.ramalho created this revision.
mikhail.ramalho added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett, pengfei, s.egerton, simoncook.
Herald added projects: libc-project, All.
mikhail.ramalho requested review of this revision.
Herald added a subscriber: pcwang-thead.

This patch makes two changes to enable several trigonometric tests that
required FMA_OPT and ROUND_OPT.

For ROUND_OPT, we only need to remove the SSE4.2 requirement, as the
libc implementation is able to build the test even if this set of
instruction are not available.

For FMA_OPT, we need to set cmake to check if the target has the FMA
instruction available and disable the skip if the target is not x86_64.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146253

Files:
  libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
  libc/cmake/modules/LLVMLibCFlagRules.cmake
  libc/cmake/modules/LLVMLibCObjectRules.cmake


Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -38,7 +38,7 @@
       list(APPEND compile_options "-Wstrict-prototypes")
       list(APPEND compile_options "-Wthread-safety")
     endif()
-    if(ADD_FMA_FLAG)
+    if(ADD_FMA_FLAG AND LIBC_TARGET_ARCHITECTURE_IS_X86)
       list(APPEND compile_options "-mavx2")
       list(APPEND compile_options "-mfma")
     endif()
@@ -48,7 +48,7 @@
   elseif(MSVC)
     list(APPEND compile_options "/EHs-c-")
     list(APPEND compile_options "/GR-")
-    if(ADD_FMA_FLAG)
+    if(ADD_FMA_FLAG AND LIBC_TARGET_ARCHITECTURE_IS_X86)
       list(APPEND compile_options "/arch:AVX2")
     endif()
   endif()
Index: libc/cmake/modules/LLVMLibCFlagRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCFlagRules.cmake
+++ libc/cmake/modules/LLVMLibCFlagRules.cmake
@@ -134,11 +134,6 @@
 set(ROUND_OPT_FLAG "ROUND_OPT")
 
 # Skip FMA_OPT flag for targets that don't support fma.
-if(NOT(LIBC_TARGET_ARCHITECTURE_IS_X86 AND (LIBC_CPU_FEATURES MATCHES "FMA")))
+if(NOT LIBC_CPU_FEATURES MATCHES "FMA")
   set(SKIP_FLAG_EXPANSION_FMA_OPT TRUE)
 endif()
-
-# Skip ROUND_OPT flag for targets that don't support SSE 4.2.
-if(NOT(LIBC_TARGET_ARCHITECTURE_IS_X86 AND (LIBC_CPU_FEATURES MATCHES "SSE4_2")))
-  set(SKIP_FLAG_EXPANSION_ROUND_OPT TRUE)
-endif()
Index: libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
+++ libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
@@ -14,6 +14,8 @@
   set(LIBC_COMPILE_OPTIONS_NATIVE -march=native)
 elseif(${LIBC_TARGET_ARCHITECTURE_IS_AARCH64})
   set(LIBC_COMPILE_OPTIONS_NATIVE -mcpu=native)
+elseif(${LIBC_TARGET_ARCHITECTURE_IS_RISCV64})
+  set(ALL_CPU_FEATURES FMA)
 endif()
 
 # Making sure ALL_CPU_FEATURES is sorted.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146253.505894.patch
Type: text/x-patch
Size: 2040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230316/b75e018a/attachment.bin>


More information about the libc-commits mailing list