1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
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.
8 AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
10 # adding flags to CPUFLAGS
12 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE__),)
16 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE2__),)
20 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE3__),)
24 ifneq ($(filter $(AUTO_CPUFLAGS),__SSSE3__),)
28 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_1__),)
32 ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_2__),)
36 ifneq ($(filter $(AUTO_CPUFLAGS),__AES__),)
40 ifneq ($(filter $(AUTO_CPUFLAGS),__PCLMUL__),)
44 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX__),)
45 ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
50 ifneq ($(filter $(AUTO_CPUFLAGS),__RDRND__),)
54 ifneq ($(filter $(AUTO_CPUFLAGS),__RDSEED__),)
58 ifneq ($(filter $(AUTO_CPUFLAGS),__FSGSBASE__),)
62 ifneq ($(filter $(AUTO_CPUFLAGS),__F16C__),)
66 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX2__),)
67 ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
72 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),)
73 ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
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
84 ifneq ($(filter $(AUTO_CPUFLAGS),__PPC64__),)
88 ifneq ($(filter $(AUTO_CPUFLAGS),__PPC32__),)
92 ifneq ($(filter $(AUTO_CPUFLAGS),__vector),)
96 ifneq ($(filter $(AUTO_CPUFLAGS),__builtin_vsx_xvnmaddadp),)
101 ifneq ($(filter __ARM_NEON __aarch64__,$(AUTO_CPUFLAGS)),)
105 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRC32),)
109 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRYPTO),)
116 MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS))
118 # To strip whitespace
121 space:= $(empty) $(empty)
122 CPUFLAGSTMP1 := $(addprefix RTE_CPUFLAG_,$(CPUFLAGS))
123 CPUFLAGSTMP2 := $(subst $(space),$(comma),$(CPUFLAGSTMP1))
124 CPUFLAGS_LIST := -DRTE_COMPILE_TIME_CPUFLAGS=$(CPUFLAGSTMP2)