[dpdk-dev] [PATCH 5/7] efd: add new avx2 standalone file to build

Bruce Richardson bruce.richardson at intel.com
Tue Oct 17 12:41:11 CEST 2017


Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/librte_efd/meson.build | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/librte_efd/meson.build b/lib/librte_efd/meson.build
index 73c004e70..01e7a22db 100644
--- a/lib/librte_efd/meson.build
+++ b/lib/librte_efd/meson.build
@@ -32,3 +32,22 @@
 sources = files('rte_efd.c')
 headers = files('rte_efd.h')
 deps += ['ring', 'hash']
+
+if arch_subdir == 'x86'
+	# compile AVX2 version if either:
+	# a. we have AVX supported in minimum instruction set baseline
+	# b. it's not minimum instruction set, but supported by compiler
+	#
+	# in former case, just add avx2 C file to files list
+	# in latter case, compile c file to static lib, using correct compiler
+	# flags, and then have the .o file from static lib linked into main lib.
+	if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2')
+		sources += files('rte_efd_x86.c')
+	elif cc.has_argument('-mavx2')
+		avx2_tmplib = static_library('avx2_efd_tmp',
+				'rte_efd_x86.c',
+				dependencies: rte_eal,
+				c_args: '-mavx2')
+		objs += avx2_tmplib.extract_objects('rte_efd_x86.c')
+	endif
+endif
-- 
2.13.6



More information about the dev mailing list