summaryrefslogtreecommitdiff
path: root/mk/rte.cpuflags.mk
diff options
context:
space:
mode:
authorXiaoyun Li <xiaoyun.li@intel.com>2017-10-13 17:01:47 +0800
committerThomas Monjalon <thomas@monjalon.net>2017-10-13 15:20:50 +0200
commit84cc318424d49372dd2a5fbf3cf84426bf95acce (patch)
tree9204d3e7d3db31da72237a8d55015a4c7b24f17f /mk/rte.cpuflags.mk
parentea39ca97d2528d235f9cfe1c0338a39e79a8a891 (diff)
downloaddpdk-84cc318424d49372dd2a5fbf3cf84426bf95acce.zip
dpdk-84cc318424d49372dd2a5fbf3cf84426bf95acce.tar.gz
dpdk-84cc318424d49372dd2a5fbf3cf84426bf95acce.tar.xz
eal/x86: select optimized memcpy at run-time
This patch dynamically selects functions of memcpy at run-time based on CPU flags that current machine supports. This patch uses function pointers which are bind to the relative functions at constrctor time. In addition, AVX512 instructions set would be compiled only if users config it enabled and the compiler supports it. Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Diffstat (limited to 'mk/rte.cpuflags.mk')
-rw-r--r--mk/rte.cpuflags.mk14
1 files changed, 14 insertions, 0 deletions
diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk
index a813c91..8a7a1e7 100644
--- a/mk/rte.cpuflags.mk
+++ b/mk/rte.cpuflags.mk
@@ -134,6 +134,20 @@ endif
MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS))
+# Check if the compiler suppoerts AVX512
+CC_SUPPORT_AVX512F := $(shell $(CC) -mavx512f -dM -E - < /dev/null 2>&1 | grep -q AVX512 && echo 1)
+ifeq ($(CC_SUPPORT_AVX512F),1)
+ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
+MACHINE_CFLAGS += -DCC_SUPPORT_AVX512F
+endif
+endif
+
+# Check if the compiler supports AVX2
+CC_SUPPORT_AVX2 := $(shell $(CC) -mavx2 -dM -E - < /dev/null 2>&1 | grep -q AVX2 && echo 1)
+ifeq ($(CC_SUPPORT_AVX2),1)
+MACHINE_CFLAGS += -DCC_SUPPORT_AVX2
+endif
+
# To strip whitespace
comma:= ,
empty:=