Skip to content

Commit

Permalink
CMakeLists.txt: Properly handle cpu flags
Browse files Browse the repository at this point in the history
gentoo/sci#1143

Signed-off-by: Andrew Ammerlaan <[email protected]>
  • Loading branch information
Nowa-Ammerlaan committed Feb 15, 2022
1 parent ce7bf53 commit 30829d7
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,36 @@ 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)
elif (HAVE_POWER8)
set(MMSEQS_ARCH "${MMSEQS_ARCH} -mcpu=power8 -mvsx")
set(PPC64 1)
elseif (HAVE_ARM8)
elif (HAVE_ARM8)
set(MMSEQS_ARCH "${MMSEQS_ARCH} -march=armv8-a+simd")
set(ARM 1)
elseif (HAVE_S390X)
elif (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 ""))
Expand Down

0 comments on commit 30829d7

Please sign in to comment.