[libc-commits] [PATCH] D146730: [libc][RISCV] Let RISCV64 targets test implementations with and without FMA.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Apr 6 06:24:19 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6edad0c8f04f: [libc][RISCV] Let RISCV64 targets test implementations with and without FMA. (authored by lntue).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146730/new/
https://reviews.llvm.org/D146730
Files:
libc/cmake/modules/LLVMLibCFlagRules.cmake
libc/cmake/modules/LLVMLibCObjectRules.cmake
libc/src/__support/macros/properties/cpu_features.h
Index: libc/src/__support/macros/properties/cpu_features.h
===================================================================
--- libc/src/__support/macros/properties/cpu_features.h
+++ libc/src/__support/macros/properties/cpu_features.h
@@ -37,7 +37,7 @@
#endif
#if defined(__ARM_FEATURE_FMA) || defined(__AVX2__) || defined(__FMA__) || \
- defined(__riscv)
+ defined(__LIBC_RISCV_USE_FMA)
#define LIBC_TARGET_CPU_HAS_FMA
#endif
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -5,7 +5,8 @@
if(${fma} LESS 0)
list(FIND flags "${FMA_OPT_FLAG}__ONLY" fma)
endif()
- if((${fma} GREATER -1) AND (LIBC_CPU_FEATURES MATCHES "FMA"))
+ if((${fma} GREATER -1) AND (LIBC_TARGET_ARCHITECTURE_IS_RISCV64 OR
+ (LIBC_CPU_FEATURES MATCHES "FMA")))
set(ADD_FMA_FLAG TRUE)
endif()
@@ -39,8 +40,12 @@
list(APPEND compile_options "-Wthread-safety")
endif()
if(ADD_FMA_FLAG)
- list(APPEND compile_options "-mavx2")
- list(APPEND compile_options "-mfma")
+ if(LIBC_TARGET_ARCHITECTURE_IS_X86)
+ list(APPEND compile_options "-mavx2")
+ list(APPEND compile_options "-mfma")
+ elseif(LIBC_TARGET_ARCHITECTURE_IS_RISCV64)
+ list(APPEND compile_option "-D__LIBC_RISCV_USE_FMA")
+ endif()
endif()
if(ADD_SSE4_2_FLAG)
list(APPEND compile_options "-msse4.2")
Index: libc/cmake/modules/LLVMLibCFlagRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCFlagRules.cmake
+++ libc/cmake/modules/LLVMLibCFlagRules.cmake
@@ -134,7 +134,8 @@
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_TARGET_ARCHITECTURE_IS_X86 AND (LIBC_CPU_FEATURES MATCHES "FMA")) OR
+ LIBC_TARGET_ARCHITECTURE_IS_RISCV64))
set(SKIP_FLAG_EXPANSION_FMA_OPT TRUE)
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146730.511395.patch
Type: text/x-patch
Size: 2139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230406/6f381da9/attachment.bin>
More information about the libc-commits
mailing list