[Support/BLAKE3] CMake: Check for `IS_X64` or `CMAKE_OSX_ARCHITECTURES` before adding the assembly files

This should fix `clang-ppc64-aix` builder (https://lab.llvm.org/buildbot/#/builders/214)
This commit is contained in:
Argyrios Kyrtzidis 2022-06-21 09:46:06 -07:00
parent 8771023543
commit acd64d8e85
1 changed files with 7 additions and 13 deletions

View File

@ -53,12 +53,8 @@ if (CAN_USE_ASSEMBLER)
disable_blake3_x86_simd()
endif()
else()
check_symbol_exists(__i386__ "" IS_X32)
if (IS_X32)
# blake3 C code autoenables SIMD for i386, but those implementations are
# only available via the intrinsics sources which we don't enable here.
disable_blake3_x86_simd()
else()
check_symbol_exists(__x86_64__ "" IS_X64)
if (IS_X64 OR CMAKE_OSX_ARCHITECTURES)
# In a macOS Universal build (setting CMAKE_OSX_ARCHITECTURES to multiple
# values), compilation of the source files will target multiple architectures
# (each source file is internally compiled once for each architecture).
@ -70,13 +66,11 @@ if (CAN_USE_ASSEMBLER)
blake3_avx2_x86-64_unix.S
blake3_avx512_x86-64_unix.S
)
check_c_compiler_flag("-mavx512vl" SUPPORTS_avx512vl)
if (SUPPORTS_avx512vl)
# Clang-6 needs this flag. We also suppress '-Wunused-command-line-argument'
# in case the file is included with arm architecture.
set_source_files_properties(blake3_avx512_x86-64_unix.S
PROPERTIES COMPILE_OPTIONS "-mavx512vl;-Wno-unused-command-line-argument")
endif()
# Clang-6 needs this flag.
set_source_files_properties(blake3_avx512_x86-64_windows_gnu.S
PROPERTIES COMPILE_OPTIONS "-mavx512vl")
else()
disable_blake3_x86_simd()
endif()
endif()
else()