summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnstein Ressem <aressem@yahoo-inc.com>2016-10-14 12:47:43 +0000
committerArnstein Ressem <aressem@yahoo-inc.com>2016-10-14 12:47:43 +0000
commite89edf777283a0309561acadf3d4bebe174c82a1 (patch)
treecaa70fc2d2629c085926107e9d995acecc9228fb
parent4fd21e20966853f00d5a73ec83bb6927f88df2a0 (diff)
Add function to only add -mtune=skylake-avx512 for gcc >= 5.3
-rw-r--r--functions.cmake9
-rw-r--r--staging_vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt2
2 files changed, 10 insertions, 1 deletions
diff --git a/functions.cmake b/functions.cmake
index 7db3d2edaf1..4e679509735 100644
--- a/functions.cmake
+++ b/functions.cmake
@@ -431,6 +431,15 @@ function(vespa_workaround_gcc_bug_67055 SOURCE_FILE)
endif()
endfunction()
+function(vespa_workaround_set_gcc_march_skylake_avx512_if_supported SOURCE_FILE)
+ if(CMAKE_COMPILER_IS_GNUCC)
+ execute_process(COMMAND ${CMAKE_CPP_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+ if (GCC_VERSION VERSION_GREATER "5.2")
+ set_source_files_properties(${SOURCE_FILE} PROPERTIES COMPILE_FLAGS -march=skylake-avx512)
+ endif()
+ endif()
+endfunction()
+
macro(__initialize_module)
# Set a couple of useful variables for this module
set(MODULE_ROOT ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/staging_vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt b/staging_vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt
index 032528482e6..6362cdf6f87 100644
--- a/staging_vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt
+++ b/staging_vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt
@@ -11,4 +11,4 @@ vespa_add_library(staging_vespalib_vespalib_hwaccelrated OBJECT
)
set_source_files_properties(avx.cpp PROPERTIES COMPILE_FLAGS -march=sandybridge)
set_source_files_properties(avx2.cpp PROPERTIES COMPILE_FLAGS -march=haswell)
-set_source_files_properties(avx512.cpp PROPERTIES COMPILE_FLAGS -march=skylake-avx512)
+vespa_workaround_set_gcc_march_skylake_avx512_if_supported(avx512.cpp)