+##############################################################################
+# Gnu Assembler AVX-512 bug detection
+# - see: https://sourceware.org/bugzilla/show_bug.cgi?id=23465
+##############################################################################
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ set(pfx ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gas_avx512_bug_test)
+ file(WRITE ${pfx}.s "vmovaps 0x40(,%rax), %zmm0\n")
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -c ${pfx}.s -o ${pfx}.o)
+ execute_process(COMMAND objdump -s ${pfx}.o OUTPUT_VARIABLE _output)
+ if (NOT _output MATCHES "62f17c48 28040540 000000")
+ set(GNU_ASSEMBLER_AVX512_BUG 1)
+ endif()
+ endif()
+endif()
+