diff options
author | Cian Ferriter <cian.ferriter@intel.com> | 2022-05-17 10:08:18 +0000 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-05-30 23:12:51 +0200 |
commit | cb1c64007734cbaa4b23d3e569a550c0beaa4afd (patch) | |
tree | 1108e7f98439495e14598627e9292087b8bf0dd0 /acinclude.m4 | |
parent | fb85ae4340a51bea26b9a4099448a982834afeff (diff) | |
download | openvswitch-cb1c64007734cbaa4b23d3e569a550c0beaa4afd.tar.gz |
acinclude: Add seperate checks for AVX512 ISA.
Checking for each of the required AVX512 ISA separately will allow the
compiler to generate some AVX512 code where there is some support in the
compiler rather than only generating all AVX512 code when all of it is
supported or no AVX512 code at all.
For example, in GCC 4.9 where there is just support for AVX512F, this
patch will allow building the AVX512 DPIF.
Another example, in GCC 5 and 6, most AVX512 code can be generated, just
without AVX512VPOPCNTDQ support.
Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 61e88105f..7b2889a40 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -73,16 +73,13 @@ AC_DEFUN([OVS_CHECK_DPIF_AVX512_DEFAULT], [ dnl OVS_CHECK_AVX512 dnl -dnl Checks if compiler and binutils supports AVX512. +dnl Checks if compiler and binutils supports various AVX512 ISA. AC_DEFUN([OVS_CHECK_AVX512], [ OVS_CHECK_BINUTILS_AVX512 - OVS_CHECK_CC_OPTION( - [-mavx512f -mavx512vpopcntdq], [ovs_have_cc_mavx512f=yes], [ovs_have_cc_mavx512f=no]) - AM_CONDITIONAL([HAVE_AVX512F], [test $ovs_have_cc_mavx512f = yes]) - if test "$ovs_have_cc_mavx512f" = yes; then - AC_DEFINE([HAVE_AVX512F], [1], - [Define to 1 if compiler supports AVX512.]) - fi + OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512f], [HAVE_AVX512F]) + OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512bw], [HAVE_AVX512BW]) + OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vbmi], [HAVE_AVX512VBMI]) + OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vpopcntdq], [HAVE_AVX512VPOPCNTDQ]) ]) dnl OVS_ENABLE_WERROR @@ -1360,6 +1357,19 @@ AC_DEFUN([OVS_CONDITIONAL_CC_OPTION], AM_CONDITIONAL([$2], [test $ovs_have_cc_option = yes])]) dnl ---------------------------------------------------------------------- +dnl OVS_CONDITIONAL_CC_OPTION_DEFINE([OPTION], [CONDITIONAL]) +dnl Check whether the given C compiler OPTION is accepted. +dnl If so, enable the given Automake CONDITIONAL and define it. +dnl Example: OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512f], [HAVE_AVX512F]) +AC_DEFUN([OVS_CONDITIONAL_CC_OPTION_DEFINE], + [OVS_CHECK_CC_OPTION( + [$1], [ovs_have_cc_option=yes], [ovs_have_cc_option=no]) + AM_CONDITIONAL([$2], [test $ovs_have_cc_option = yes]) + if test "$ovs_have_cc_option" = yes; then + AC_DEFINE([$2], [1], + [Define to 1 if compiler supports the '$1' option.]) + fi]) + dnl Check for too-old XenServer. AC_DEFUN([OVS_CHECK_XENSERVER_VERSION], [AC_CACHE_CHECK([XenServer release], [ovs_cv_xsversion], |