1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 Intel Corporation 3 4sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c', 5 'rte_acl.c', 'tb_mem.c') 6headers = files('rte_acl.h', 'rte_acl_osdep.h') 7 8if dpdk_conf.has('RTE_ARCH_X86') 9 sources += files('acl_run_sse.c') 10 11 # compile AVX2 version if either: 12 # a. we have AVX supported in minimum instruction set baseline 13 # b. it's not minimum instruction set, but supported by compiler 14 # 15 # in former case, just add avx2 C file to files list 16 # in latter case, compile c file to static lib, using correct compiler 17 # flags, and then have the .o file from static lib linked into main lib. 18 if cc.get_define('__AVX2__', args: machine_args) != '' 19 sources += files('acl_run_avx2.c') 20 cflags += '-DCC_AVX2_SUPPORT' 21 elif cc.has_argument('-mavx2') 22 avx2_tmplib = static_library('avx2_tmp', 23 'acl_run_avx2.c', 24 dependencies: static_rte_eal, 25 c_args: cflags + ['-mavx2']) 26 objs += avx2_tmplib.extract_objects('acl_run_avx2.c') 27 cflags += '-DCC_AVX2_SUPPORT' 28 endif 29 30 # compile AVX512 version if: 31 # we are building 64-bit binary AND binutils can generate proper code 32 33 if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok.returncode() == 0 34 35 # compile AVX512 version if either: 36 # a. we have AVX512 supported in minimum instruction set 37 # baseline 38 # b. it's not minimum instruction set, but supported by 39 # compiler 40 # 41 # in former case, just add avx512 C file to files list 42 # in latter case, compile c file to static lib, using correct 43 # compiler flags, and then have the .o file from static lib 44 # linked into main lib. 45 46 # check if all required flags already enabled (variant a). 47 acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', 48 '__AVX512CD__', '__AVX512BW__'] 49 50 acl_avx512_on = true 51 foreach f:acl_avx512_flags 52 53 if cc.get_define(f, args: machine_args) == '' 54 acl_avx512_on = false 55 endif 56 endforeach 57 58 if acl_avx512_on == true 59 60 sources += files('acl_run_avx512.c') 61 cflags += '-DCC_AVX512_SUPPORT' 62 63 elif cc.has_multi_arguments('-mavx512f', '-mavx512vl', 64 '-mavx512cd', '-mavx512bw') 65 66 avx512_tmplib = static_library('avx512_tmp', 67 'acl_run_avx512.c', 68 dependencies: static_rte_eal, 69 c_args: cflags + 70 ['-mavx512f', '-mavx512vl', 71 '-mavx512cd', '-mavx512bw']) 72 objs += avx512_tmplib.extract_objects( 73 'acl_run_avx512.c') 74 cflags += '-DCC_AVX512_SUPPORT' 75 endif 76 endif 77 78elif dpdk_conf.has('RTE_ARCH_ARM') 79 cflags += '-flax-vector-conversions' 80 sources += files('acl_run_neon.c') 81elif dpdk_conf.has('RTE_ARCH_PPC_64') 82 sources += files('acl_run_altivec.c') 83endif 84