1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2018 Vladimir Medvedkin <[email protected]> 3# Copyright(c) 2019 Intel Corporation 4 5if is_windows 6 build = false 7 reason = 'not supported on Windows' 8 subdir_done() 9endif 10 11sources = files('rte_fib.c', 'rte_fib6.c', 'dir24_8.c', 'trie.c') 12headers = files('rte_fib.h', 'rte_fib6.h') 13deps += ['rib'] 14 15# compile AVX512 version if: 16# we are building 64-bit binary AND binutils can generate proper code 17if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok 18 # compile AVX512 version if either: 19 # a. we have AVX512F supported in minimum instruction set baseline 20 # b. it's not minimum instruction set, but supported by compiler 21 # 22 # in former case, just add avx512 C file to files list 23 # in latter case, compile c file to static lib, using correct 24 # compiler flags, and then have the .o file from static lib 25 # linked into main lib. 26 27 # check if all required flags already enabled (variant a). 28 acl_avx512_flags = ['__AVX512F__','__AVX512DQ__'] 29 acl_avx512_on = true 30 foreach f:acl_avx512_flags 31 if cc.get_define(f, args: machine_args) == '' 32 acl_avx512_on = false 33 endif 34 endforeach 35 36 if acl_avx512_on == true 37 cflags += ['-DCC_DIR24_8_AVX512_SUPPORT'] 38 sources += files('dir24_8_avx512.c') 39 # TRIE AVX512 implementation uses avx512bw intrinsics along with 40 # avx512f and avx512dq 41 if cc.get_define('__AVX512BW__', args: machine_args) != '' 42 cflags += ['-DCC_TRIE_AVX512_SUPPORT'] 43 sources += files('trie_avx512.c') 44 endif 45 elif cc.has_multi_arguments('-mavx512f', '-mavx512dq') 46 dir24_8_avx512_tmp = static_library('dir24_8_avx512_tmp', 47 'dir24_8_avx512.c', 48 dependencies: static_rte_eal, 49 c_args: cflags + ['-mavx512f', '-mavx512dq']) 50 objs += dir24_8_avx512_tmp.extract_objects('dir24_8_avx512.c') 51 cflags += ['-DCC_DIR24_8_AVX512_SUPPORT'] 52 # TRIE AVX512 implementation uses avx512bw intrinsics along with 53 # avx512f and avx512dq 54 if cc.has_argument('-mavx512bw') 55 trie_avx512_tmp = static_library('trie_avx512_tmp', 56 'trie_avx512.c', 57 dependencies: static_rte_eal, 58 c_args: cflags + ['-mavx512f', \ 59 '-mavx512dq', '-mavx512bw']) 60 objs += trie_avx512_tmp.extract_objects('trie_avx512.c') 61 cflags += ['-DCC_TRIE_AVX512_SUPPORT'] 62 endif 63 endif 64endif 65