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),__FSGSBASE__),)
58 ifneq ($(filter $(AUTO_CPUFLAGS),__F16C__),)
62 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX2__),)
63 ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
68 ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),)
69 ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
75 ifneq ($(filter $(AUTO_CPUFLAGS),__PPC64__),)
79 ifneq ($(filter $(AUTO_CPUFLAGS),__PPC32__),)
83 ifneq ($(filter $(AUTO_CPUFLAGS),__vector),)
87 ifneq ($(filter $(AUTO_CPUFLAGS),__builtin_vsx_xvnmaddadp),)
92 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_NEON),)
96 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRC32),)
100 ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRYPTO),)
107 MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS))
109 # To strip whitespace
112 space:= $(empty) $(empty)
113 CPUFLAGSTMP1 := $(addprefix RTE_CPUFLAG_,$(CPUFLAGS))
114 CPUFLAGSTMP2 := $(subst $(space),$(comma),$(CPUFLAGSTMP1))
115 CPUFLAGS_LIST := -DRTE_COMPILE_TIME_CPUFLAGS=$(CPUFLAGSTMP2)