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