summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m42
-rw-r--r--m4/openvswitch.m429
2 files changed, 30 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index d9a33f583..30b82aae2 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -101,7 +101,7 @@ AC_DEFUN([OVS_CHECK_AVX512], [
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512bw], [HAVE_AVX512BW])
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vl], [HAVE_AVX512VL])
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vbmi], [HAVE_AVX512VBMI])
- OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vpopcntdq], [HAVE_AVX512VPOPCNTDQ])
+ OVS_CHECK_AVX512VPOPCNTDQ
])
dnl OVS_ENABLE_WERROR
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 6eef1fb35..b5be5842e 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -450,6 +450,35 @@ AC_DEFUN([OVS_CHECK_GCC_AVX512VL], [
AM_CONDITIONAL([HAVE_GCC_AVX512VL_GOOD],
[test "$ovs_cv_gcc_avx512vl_good" = yes])])
+dnl Checks whether the build system implements the vpopcntdq instruction. The
+dnl compiler and assembler each separately need to support vpopcntdq. In order
+dnl to test the assembler with the below code snippet, set the optimization
+dnl level of the function to "O0" so it won't be optimized away by the
+dnl compiler.
+AC_DEFUN([OVS_CHECK_AVX512VPOPCNTDQ], [
+ AC_MSG_CHECKING([whether compiler correctly emits AVX512-VPOPCNTDQ])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([#include <immintrin.h>
+ void
+ __attribute__((__target__("avx512vpopcntdq")))
+ __attribute__((optimize("O0")))
+ check_vpopcntdq(void)
+ {
+ __m512i v_test;
+ v_test = _mm512_popcnt_epi64(v_test);
+ }],[])],
+ [AC_MSG_RESULT([yes])
+ ovs_cv_avx512vpopcntdq_good=yes],
+ [AC_MSG_RESULT([no])
+ ovs_cv_avx512vpopcntdq_good=no])
+ if test "$ovs_cv_avx512vpopcntdq_good" = yes; then
+ AC_DEFINE([HAVE_AVX512VPOPCNTDQ], [1],
+ [Define to 1 if the build system implements the vpopcntdq
+ instruction.])
+ fi
+ AM_CONDITIONAL([HAVE_AVX512VPOPCNTDQ],
+ [test "$ovs_cv_avx512vpopcntdq_good" = yes])])
+
dnl Checks for binutils/assembler known issue with AVX512.
dnl Due to backports, we probe assembling a reproducer instead of checking
dnl binutils version string. More details, including ASM dumps and debug here: