The bug being checked for by OVS_CHECK_BINUTILS_AVX512 is only present when the compiler is GCC. Add a check for GCC before the other checks. Also only create the directory and variables for the assembler check if gcc and x86_64 are present.
Signed-off-by: Cian Ferriter <cian.ferri...@intel.com> --- m4/openvswitch.m4 | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 4c3bace6e..06f8396d0 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -433,24 +433,29 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512], [binutils avx512 assembler checks passing], [ovs_cv_binutils_avx512_good], [dnl Assemble a short snippet to test for issue in "build-aux" dir: - mkdir -p build-aux - OBJFILE=build-aux/binutils_avx512_check.o - GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}' - echo "vpgatherqq $GATHER_PARAMS" | as --64 -o $OBJFILE - - if ($CC -dumpmachine | grep x86_64) >/dev/null 2>&1; then - if (objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS) >/dev/null 2>&1; then - ovs_cv_binutils_avx512_good=yes + if ($CC --version | grep gcc) >/dev/null 2>&1; then + if ($CC -dumpmachine | grep x86_64) >/dev/null 2>&1; then + mkdir -p build-aux + OBJFILE=build-aux/binutils_avx512_check.o + GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}' + echo "vpgatherqq $GATHER_PARAMS" | as --64 -o $OBJFILE - + if (objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS) >/dev/null 2>&1; then + ovs_cv_binutils_avx512_good=yes + else + ovs_cv_binutils_avx512_good="buggy binutils" + dnl Explicitly disallow avx512f to stop compiler auto-vectorizing + dnl and causing zmm usage with buggy binutils versions. + CFLAGS="$CFLAGS -mno-avx512f" + fi + rm $OBJFILE else - ovs_cv_binutils_avx512_good=no - dnl Explicitly disallow avx512f to stop compiler auto-vectorizing - dnl and causing zmm usage with buggy binutils versions. - CFLAGS="$CFLAGS -mno-avx512f" + dnl non x86_64 architectures don't have avx512, so not affected. + ovs_cv_binutils_avx512_good="non x86_64" fi else - dnl non x86_64 architectures don't have avx512, so not affected - ovs_cv_binutils_avx512_good=no + dnl $CC is not gcc, allow avx512 build. + ovs_cv_binutils_avx512_good=yes fi]) - rm $OBJFILE if test "$ovs_cv_binutils_avx512_good" = yes; then AC_DEFINE([HAVE_LD_AVX512_GOOD], [1], [Define to 1 if binutils correctly supports AVX512.]) -- 2.25.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev