Skip to content

Commit a4af886

Browse files
authored
Merge pull request #1597 from martin-frbg/cmake-avx512
Check build system support for AVX512 instructions
2 parents ce6317f + 7fb62ae commit a4af886

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/system_check.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,12 @@ else()
6666
set(BINARY32 1)
6767
endif()
6868

69+
if (X86_64 OR X86)
70+
file(WRITE ${PROJECT_BINARY_DIR}/avx512.tmp "void main(void){ __asm__ volatile(\"vaddps %zmm1, %zmm0, %zmm0\"); }")
71+
execute_process(COMMAND ${CMAKE_C_COMPILER} -v -o ${PROJECT_BINARY_DIR}/avx512.o -x c ${PROJECT_BINARY_DIR}/avx512.tmp RESULT_VARIABLE NO_AVX512)
72+
if (NO_AVX512 EQUAL 1)
73+
set (CCOMMON_OPT "${CCOMMON_OPT} -DNO_AVX512")
74+
endif()
75+
file(REMOVE "avx512.tmp" "avx512.o")
76+
endif()
77+

0 commit comments

Comments
 (0)