summaryrefslogtreecommitdiffstats
path: root/src/configure.ac
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-11-10 21:55:45 +0100
committerDave Barach <openvpp@barachs.net>2017-11-13 16:14:50 +0000
commit04f3db3847d242857b9d9d858bcdca538a1be7d7 (patch)
treee0304ad2a3986698d62e9a164f5a0a28565cef01 /src/configure.ac
parent2d8bf304230102a6d9b312b98315418617798175 (diff)
dpdk: introduce AVX512 variants of node functions
Change-Id: If581feca0d51d0420c971801aecdf9250c671b36 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/configure.ac')
-rw-r--r--src/configure.ac36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/configure.ac b/src/configure.ac
index ee4985b5471..b5546a7c2e8 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -119,6 +119,22 @@ AC_DEFUN([DETECT_DPDK_IS_1702_OR_1705],
AM_CONDITIONAL(DPDK_IS_1702_OR_1705, test "$dpdk_is_1702_or_1705" = "yes")
])
+# Check if compiler supports specific flag
+AC_DEFUN([CC_CHECK_FLAG],
+[
+ AC_MSG_CHECKING([if $CC supports $1])
+ AC_LANG_PUSH([C])
+ ac_saved_cflags="$CFLAGS"
+ CFLAGS="-Werror $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [c_flag_check=yes],
+ [c_flag_check=no]
+)
+ AC_MSG_RESULT([$c_flag_check])
+ CFLAGS="$ac_saved_cflags"
+ AC_LANG_POP([C])
+])
+
###############################################################################
# configure arguments
###############################################################################
@@ -164,6 +180,20 @@ AC_ARG_WITH(pre-data,
# Target CPU flags
###############################################################################
+# Check if compiler supports march=core-avx2
+CC_CHECK_FLAG("-march=core-avx2")
+AS_IF([test "$cc_flag_check" = yes],
+ [march_core_avx2=yes],
+ [march_core_avx2=no])
+AM_CONDITIONAL([CC_SUPPORTS_AVX2], [test "$march_core_avx2" = "yes"])
+
+# Check if compiler supports march=skylake-avx512
+CC_CHECK_FLAG("-march=skylake-avx512")
+AS_IF([test "$cc_flag_check" = yes],
+ [march_skylake_avx512=yes],
+ [march_skylake_avx512=no])
+AM_CONDITIONAL([CC_SUPPORTS_AVX512], [test "$march_skylake_avx512" = "yes"])
+
AS_CASE([$build_cpu],
[x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"],
[aarch64], [CPU_FLAGS="-march=armv8-a+crc"],
@@ -171,6 +201,12 @@ AS_CASE([$build_cpu],
)
AC_SUBST([CPU_FLAGS])
+AC_SUBST([CPU_AVX2_FLAGS],"-march=core-avx2 -mtune=core-avx2")
+AC_SUBST([CPU_AVX512_FLAGS],"-march=skylake-avx512 -mtune=skylake-avx512")
+
+AM_CONDITIONAL([CPU_X86_64], [test "$build_cpu" = "x86_64"])
+AM_CONDITIONAL([CPU_AARCH64], [test "$build_cpu" = "aarch64"])
+
###############################################################################
# Substitutions and defines
###############################################################################