From 30f23be0f94c7041b7e3bb53a4a0236355cdabad Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Thu, 22 Jul 2021 12:00:03 +0200 Subject: [PATCH] Rework setting of -mfma to only apply it where necessary --- cmake/cc.cmake | 6 +++--- cmake/system.cmake | 10 +++++----- cmake/utils.cmake | 10 +++++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cmake/cc.cmake b/cmake/cc.cmake index 7695215..ac5e455 100644 --- a/cmake/cc.cmake +++ b/cmake/cc.cmake @@ -124,9 +124,9 @@ if (NOT DYNAMIC_ARCH) if (HAVE_AVX) set (CCOMMON_OPT "${CCOMMON_OPT} -mavx") endif () - if (HAVE_FMA3) - set (CCOMMON_OPT "${CCOMMON_OPT} -mfma") - endif () + # if (HAVE_FMA3) + #set (CCOMMON_OPT "${CCOMMON_OPT} -mfma") + #endif () if (HAVE_SSE) set (CCOMMON_OPT "${CCOMMON_OPT} -msse") endif () diff --git a/cmake/system.cmake b/cmake/system.cmake index 3487482..f8bd667 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -186,11 +186,11 @@ if (DEFINED TARGET) set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mavx2") endif() endif() - if (DEFINED HAVE_FMA3) - if (NOT NO_AVX2) - set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mfma") - endif() - endif() + # if (DEFINED HAVE_FMA3) + # if (NOT NO_AVX2) + # set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mfma") + # endif() + # endif() if (DEFINED HAVE_SSE) set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -msse") endif() diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 794d73d..2c1a1c7 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -311,7 +311,15 @@ function(GenerateNamedObjects sources_in) configure_file(${new_source_file}.tmp ${new_source_file} COPYONLY) file(REMOVE ${new_source_file}.tmp) list(APPEND SRC_LIST_OUT ${new_source_file}) - + message (STATUS ${new_source_file}) + if (DEFINED HAVE_FMA3) + if ( ${new_source_file} MATCHES "(s|d?)rot_k.c") + set_source_files_properties(${new_source_file} PROPERTIES COMPILE_OPTIONS "-mfma") + endif () + if ( ${new_source_file} MATCHES "dgemv_t_k.c") + set_source_files_properties(${new_source_file} PROPERTIES COMPILE_OPTIONS "-mfma") + endif () + endif () endforeach () endforeach () -- 2.7.4