mk/spdk.common.mk: check availability of avx512f with clang llc

`--target-help` option is not available with CC set to clang
causing `clang: error: no input files`.

redirect `--target-help` stderr to `/dev/null`

This patch fix issue: #2820

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: I2c90e0122e162dc08537d94bbf0adad58f2eee2c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15967
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Sebastian Brzezinka 2022-12-15 15:43:27 +01:00 committed by Tomasz Zawadzki
parent 110d8411ec
commit 48f3f38384

View File

@ -72,13 +72,21 @@ COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE)
endif
ifeq ($(TARGET_MACHINE),x86_64)
ifneq (,$(shell $(CC) --target-help | grep -e -mavx512f >/dev/null && echo 1))
ifeq ($(CC_TYPE),gcc)
ifneq (,$(shell $(CC) --target-help 2>/dev/null | grep -e -mavx512f >/dev/null && echo 1))
# Don't use AVX-512 instructions in SPDK code - it breaks Valgrind for
# some cases where compiler decides to hyper-optimize a relatively
# simple operation (like int-to-float conversion) using AVX-512
COMMON_CFLAGS += -mno-avx512f
endif
endif
ifeq ($(CC_TYPE),clang)
LLC=llc$(shell echo $(CC) | grep -o -E "\-[0-9]{2}")
ifneq (,$(shell $(LLC) -march=x86-64 -mattr=help 2>&1 | grep -e avx512f >/dev/null && echo 1))
COMMON_CFLAGS += -mno-avx512f
endif
endif
endif
ifeq ($(CONFIG_WERROR), y)
COMMON_CFLAGS += -Werror