test mbuf attach
[dpdk.git] / mk / rte.cpuflags.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
3
4 # this makefile is called from the generic rte.vars.mk and is
5 # used to set the RTE_CPUFLAG_* environment variables giving details
6 # of what instruction sets the target cpu supports.
7
8 AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
9
10 # adding flags to CPUFLAGS
11
12 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE__),)
13 CPUFLAGS += SSE
14 endif
15
16 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE2__),)
17 CPUFLAGS += SSE2
18 endif
19
20 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE3__),)
21 CPUFLAGS += SSE3
22 endif
23
24 ifneq ($(filter $(AUTO_CPUFLAGS),__SSSE3__),)
25 CPUFLAGS += SSSE3
26 endif
27
28 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_1__),)
29 CPUFLAGS += SSE4_1
30 endif
31
32 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_2__),)
33 CPUFLAGS += SSE4_2
34 endif
35
36 ifneq ($(filter $(AUTO_CPUFLAGS),__AES__),)
37 CPUFLAGS += AES
38 endif
39
40 ifneq ($(filter $(AUTO_CPUFLAGS),__PCLMUL__),)
41 CPUFLAGS += PCLMULQDQ
42 endif
43
44 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX__),)
45 ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
46 CPUFLAGS += AVX
47 endif
48 endif
49
50 ifneq ($(filter $(AUTO_CPUFLAGS),__RDRND__),)
51 CPUFLAGS += RDRAND
52 endif
53
54 ifneq ($(filter $(AUTO_CPUFLAGS),__RDSEED__),)
55 CPUFLAGS += RDSEED
56 endif
57
58 ifneq ($(filter $(AUTO_CPUFLAGS),__FSGSBASE__),)
59 CPUFLAGS += FSGSBASE
60 endif
61
62 ifneq ($(filter $(AUTO_CPUFLAGS),__F16C__),)
63 CPUFLAGS += F16C
64 endif
65
66 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX2__),)
67 ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
68 CPUFLAGS += AVX2
69 endif
70 endif
71
72 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),)
73 ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
74 CPUFLAGS += AVX512F
75 else
76 # disable AVX512F support for GCC & binutils 2.30 as a workaround for Bug 97
77 ifeq ($(FORCE_DISABLE_AVX512),y)
78 MACHINE_CFLAGS += -mno-avx512f
79 endif
80 endif
81 endif
82
83 # IBM Power CPU flags
84 ifneq ($(filter $(AUTO_CPUFLAGS),__PPC64__),)
85 CPUFLAGS += PPC64
86 endif
87
88 ifneq ($(filter $(AUTO_CPUFLAGS),__PPC32__),)
89 CPUFLAGS += PPC32
90 endif
91
92 ifneq ($(filter $(AUTO_CPUFLAGS),__vector),)
93 CPUFLAGS += ALTIVEC
94 endif
95
96 ifneq ($(filter $(AUTO_CPUFLAGS),__builtin_vsx_xvnmaddadp),)
97 CPUFLAGS += VSX
98 endif
99
100 # ARM flags
101 ifneq ($(filter __ARM_NEON __aarch64__,$(AUTO_CPUFLAGS)),)
102 CPUFLAGS += NEON
103 endif
104
105 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRC32),)
106 CPUFLAGS += CRC32
107 endif
108
109 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRYPTO),)
110 CPUFLAGS += AES
111 CPUFLAGS += PMULL
112 CPUFLAGS += SHA1
113 CPUFLAGS += SHA2
114 endif
115
116 MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS))
117
118 # To strip whitespace
119 comma:= ,
120 empty:=
121 space:= $(empty) $(empty)
122 CPUFLAGSTMP1 := $(addprefix RTE_CPUFLAG_,$(CPUFLAGS))
123 CPUFLAGSTMP2 := $(subst $(space),$(comma),$(CPUFLAGSTMP1))
124 CPUFLAGS_LIST := -DRTE_COMPILE_TIME_CPUFLAGS=$(CPUFLAGSTMP2)