From cde8f8778724fdab0c2ad71365ad004009d652d1 Mon Sep 17 00:00:00 2001 From: Andrew Ammerlaan Date: Sun, 13 Feb 2022 16:42:20 +0100 Subject: [PATCH] CMakeLists.txt: Properly handle cpu flags https://github.com/gentoo/sci/pull/1143 Signed-off-by: Andrew Ammerlaan --- CMakeLists.txt | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c3c0dd29..afd8ae94d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,21 +49,7 @@ set(MMSEQS_CXX_FLAGS "-fsigned-char") # SIMD instruction sets support set(MMSEQS_ARCH "") -if (HAVE_AVX2) - if (CMAKE_COMPILER_IS_CLANG) - set(MMSEQS_ARCH "${MMSEQS_ARCH} -mavx2 -mcx16") - else () - set(MMSEQS_ARCH "${MMSEQS_ARCH} -mavx2 -mcx16 -Wa,-q") - endif () - set(X64 1) -elseif (HAVE_SSE4_1) - set(MMSEQS_ARCH "${MMSEQS_ARCH} -msse4.1 -mcx16") - set(X64 1) -elseif (HAVE_SSE2) - set(MMSEQS_ARCH "${MMSEQS_ARCH} -msse2") - set(DISABLE_IPS4O 1) - set(X64 1) -elseif (HAVE_POWER9) +if (HAVE_POWER9) set(MMSEQS_ARCH "${MMSEQS_ARCH} -mcpu=power9 -mvsx") set(PPC64 1) elseif (HAVE_POWER8) @@ -75,6 +61,24 @@ elseif (HAVE_ARM8) elseif (HAVE_S390X) set(MMSEQS_ARCH "${MMSEQS_ARCH} -march=z14 -mzarch -mzvector") set(ZARCH 1) +else + if (HAVE_AVX2) + if (CMAKE_COMPILER_IS_CLANG) + set(MMSEQS_ARCH "${MMSEQS_ARCH} -mavx2 -mcx16") + else () + set(MMSEQS_ARCH "${MMSEQS_ARCH} -mavx2 -mcx16 -Wa,-q") + endif () + set(X64 1) + endif () + if (HAVE_SSE4_1) + set(MMSEQS_ARCH "${MMSEQS_ARCH} -msse4.1 -mcx16") + set(X64 1) + endif () + if (HAVE_SSE2) + set(MMSEQS_ARCH "${MMSEQS_ARCH} -msse2") + set(DISABLE_IPS4O 1) + set(X64 1) + endif () endif () if (NATIVE_ARCH AND (MMSEQS_ARCH STREQUAL ""))