acl: add AVX2 classify method
[dpdk.git] / lib / librte_acl / Makefile
index 65e566d..6b74dc9 100644 (file)
@@ -48,6 +48,24 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
 
 CFLAGS_acl_run_sse.o += -msse4.1
 
+#
+# If the compiler supports AVX2 instructions,
+# then add support for AVX2 classify method.
+#
+
+CC_AVX2_SUPPORT=$(shell $(CC) -march=core-avx2 -dM -E - </dev/null 2>&1 | \
+grep -q AVX2 && echo 1)
+
+ifeq ($(CC_AVX2_SUPPORT), 1)
+       SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_avx2.c
+       CFLAGS_rte_acl.o += -DCC_AVX2_SUPPORT
+       ifeq ($(CC), icc)
+       CFLAGS_acl_run_avx2.o += -march=core-avx2
+       else
+       CFLAGS_acl_run_avx2.o += -mavx2
+       endif
+endif
+
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include := rte_acl_osdep.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += rte_acl.h