build: Set assembler feature level in std make

Also fix multibinary to try each available arch

Change-Id: Icd8496d169665bded478a33a02e739d1f8349b6f
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
Greg Tucker 2019-08-29 21:17:32 -07:00
parent 198b026a55
commit ae3c91ab85
2 changed files with 20 additions and 6 deletions

View File

@ -392,7 +392,7 @@
%endmacro
%else
%macro mbin_dispatch_init7 7
mbin_dispatch_init5 %1, %2, %3, %4, %5
mbin_dispatch_init6 %1, %2, %3, %4, %5, %6
%endmacro
%endif

View File

@ -164,12 +164,26 @@ $(all_llvm_fuzz_tests): CXXFLAGS += -fsanitize-coverage=trace-pc-guard -fsanitiz
$(all_llvm_fuzz_tests): % : %.o $(lib_name)
$(CXX) $(CXXFLAGS) $^ $(LDLIBS) $(FUZZLINK) -o $@
# Check for modern as
tmpfile := $(shell mktemp)
have_as_w_avx512 ?= $(shell printf "vinserti32x8 zmm0, ymm1, 1;" > ${tmpfile} && $(AS) $(ASFLAGS) ${tmpfile} -o /dev/null 2> /dev/null && echo y; rm ${tmpfile})
D_HAVE_AS_KNOWS_AVX512_$(have_as_w_avx512) := -DHAVE_AS_KNOWS_AVX512
CFLAGS += $(D_HAVE_AS_KNOWS_AVX512_y)
ASFLAGS += $(D_HAVE_AS_KNOWS_AVX512_y)
test-as = $(shell hash printf && printf $(3) > $(2) && $(AS) $(ASFLAGS) ${tmpf} -o /dev/null 2> /dev/null && echo $(1) || echo $(4))
as_4 := "pblendvb xmm2, xmm1;"
as_6 := "vinserti32x8 zmm0, ymm1, 1;"
as_10 := "vpcompressb zmm0 {k1}, zmm1;"
tmpf := $(shell mktemp)
as_feature_level := $(call test-as, 4, $(tmpf), $(as_4), $(as_feature_level))
as_feature_level := $(call test-as, 6, $(tmpf), $(as_6), $(as_feature_level))
as_feature_level := $(call test-as, 10, $(tmpf), $(as_10), $(as_feature_level))
tmpf := $(shell rm ${tmpf})
ifneq ($(findstring $(as_feature_level),6 10),)
D_HAVE_AS_KNOWS_AVX512_y := -DHAVE_AS_KNOWS_AVX512
endif
CFLAGS += -DAS_FEATURE_LEVEL=$(as_feature_level) $(D_HAVE_AS_KNOWS_AVX512_y)
ASFLAGS += -DAS_FEATURE_LEVEL=$(as_feature_level) $(D_HAVE_AS_KNOWS_AVX512_y)
# Check for pthreads
have_threads ?= $(shell printf "\#include <pthread.h>\nint main(void){return 0;}\n" | $(CC) -x c - -o /dev/null -lpthread && echo y )