2017-12-19 15:49:04 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2010-2014 Intel Corporation
|
2014-02-17 12:46:06 +00:00
|
|
|
|
|
|
|
# this makefile is called from the generic rte.vars.mk and is
|
|
|
|
# used to set the RTE_CPUFLAG_* environment variables giving details
|
|
|
|
# of what instruction sets the target cpu supports.
|
|
|
|
|
2015-12-07 12:56:43 +00:00
|
|
|
AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null)
|
2014-02-17 12:46:06 +00:00
|
|
|
|
|
|
|
# adding flags to CPUFLAGS
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__SSE__),)
|
|
|
|
CPUFLAGS += SSE
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__SSE2__),)
|
|
|
|
CPUFLAGS += SSE2
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__SSE3__),)
|
|
|
|
CPUFLAGS += SSE3
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__SSSE3__),)
|
|
|
|
CPUFLAGS += SSSE3
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_1__),)
|
|
|
|
CPUFLAGS += SSE4_1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_2__),)
|
|
|
|
CPUFLAGS += SSE4_2
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__AES__),)
|
|
|
|
CPUFLAGS += AES
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__PCLMUL__),)
|
|
|
|
CPUFLAGS += PCLMULQDQ
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__AVX__),)
|
2017-04-27 23:00:14 +00:00
|
|
|
ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
|
2014-02-17 12:46:06 +00:00
|
|
|
CPUFLAGS += AVX
|
|
|
|
endif
|
2017-04-27 23:00:14 +00:00
|
|
|
endif
|
2014-02-17 12:46:06 +00:00
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__RDRND__),)
|
|
|
|
CPUFLAGS += RDRAND
|
|
|
|
endif
|
|
|
|
|
2019-05-14 13:37:02 +00:00
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__RDSEED__),)
|
|
|
|
CPUFLAGS += RDSEED
|
|
|
|
endif
|
|
|
|
|
2014-02-17 12:46:06 +00:00
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__FSGSBASE__),)
|
|
|
|
CPUFLAGS += FSGSBASE
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__F16C__),)
|
|
|
|
CPUFLAGS += F16C
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__AVX2__),)
|
2017-04-27 23:00:14 +00:00
|
|
|
ifeq ($(CONFIG_RTE_ENABLE_AVX),y)
|
2014-02-17 12:46:06 +00:00
|
|
|
CPUFLAGS += AVX2
|
|
|
|
endif
|
2017-04-27 23:00:14 +00:00
|
|
|
endif
|
2014-02-17 12:46:06 +00:00
|
|
|
|
2016-01-18 03:05:11 +00:00
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),)
|
2017-04-27 23:00:14 +00:00
|
|
|
ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
|
2016-01-18 03:05:11 +00:00
|
|
|
CPUFLAGS += AVX512F
|
2018-11-03 01:06:32 +00:00
|
|
|
else
|
2019-01-14 15:49:35 +00:00
|
|
|
# disable AVX512F support for GCC & binutils 2.30 as a workaround for Bug 97
|
|
|
|
ifeq ($(FORCE_DISABLE_AVX512),y)
|
2018-11-03 01:06:32 +00:00
|
|
|
MACHINE_CFLAGS += -mno-avx512f
|
|
|
|
endif
|
2016-01-18 03:05:11 +00:00
|
|
|
endif
|
2017-04-27 23:00:14 +00:00
|
|
|
endif
|
2016-01-18 03:05:11 +00:00
|
|
|
|
2014-11-25 22:17:11 +00:00
|
|
|
# IBM Power CPU flags
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__PPC64__),)
|
|
|
|
CPUFLAGS += PPC64
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__PPC32__),)
|
|
|
|
CPUFLAGS += PPC32
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__vector),)
|
|
|
|
CPUFLAGS += ALTIVEC
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__builtin_vsx_xvnmaddadp),)
|
|
|
|
CPUFLAGS += VSX
|
|
|
|
endif
|
|
|
|
|
2015-11-02 23:47:22 +00:00
|
|
|
# ARM flags
|
2018-09-02 18:35:28 +00:00
|
|
|
ifneq ($(filter __ARM_NEON __aarch64__,$(AUTO_CPUFLAGS)),)
|
2015-11-02 23:47:22 +00:00
|
|
|
CPUFLAGS += NEON
|
|
|
|
endif
|
|
|
|
|
2015-11-23 18:45:36 +00:00
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRC32),)
|
|
|
|
CPUFLAGS += CRC32
|
|
|
|
endif
|
|
|
|
|
2017-07-04 09:24:05 +00:00
|
|
|
ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRYPTO),)
|
|
|
|
CPUFLAGS += AES
|
|
|
|
CPUFLAGS += PMULL
|
|
|
|
CPUFLAGS += SHA1
|
|
|
|
CPUFLAGS += SHA2
|
|
|
|
endif
|
2015-11-02 23:47:22 +00:00
|
|
|
|
2014-02-17 12:46:06 +00:00
|
|
|
MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS))
|
|
|
|
|
|
|
|
# To strip whitespace
|
|
|
|
comma:= ,
|
|
|
|
empty:=
|
|
|
|
space:= $(empty) $(empty)
|
|
|
|
CPUFLAGSTMP1 := $(addprefix RTE_CPUFLAG_,$(CPUFLAGS))
|
|
|
|
CPUFLAGSTMP2 := $(subst $(space),$(comma),$(CPUFLAGSTMP1))
|
2016-03-21 20:12:55 +00:00
|
|
|
CPUFLAGS_LIST := -DRTE_COMPILE_TIME_CPUFLAGS=$(CPUFLAGSTMP2)
|