[PATCH] x86emul: rework compiler probing in the test harness

Jan Beulich posted 1 patch 1 year, 1 month ago
Failed in applying to current master (apply log)
[PATCH] x86emul: rework compiler probing in the test harness
Posted by Jan Beulich 1 year, 1 month ago
Checking for what $(SIMD) contains was initially right, but already the
addition of $(FMA) wasn't. Later categories (correctly) weren't added.
Instead what is of interest is anything the main harness source file
uses outside of suitable #if and without resorting to .byte, as that's
the one file (containing actual tests) which has to succeed in building.
The auxiliary binary blobs we utilize may fail to build; the resulting
empty blobs are recognized and reported as "n/a" when the harness is
run.

Note that strictly speaking we'd need to probe the assembler. We assume
that a compiler knowing of a certain ISA extension is backed by an
equally capable assembler.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
A little while ago this would probably have enabled osstest to actually
build the harness. Luckily meanwhile a new enough gcc is in use there
to be unaffected by the inappropriate checking.

--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -104,11 +104,13 @@ TARGET-y := $(TARGET)
 
 ifeq ($(filter run%,$(MAKECMDGOALS)),)
 
-define simd-check-cc
+define isa-check-cc
 TARGET-$(shell echo 'int i;' | $(CC) -x c -c -o /dev/null -m$(1) - || echo y) :=
 endef
 
-$(foreach flavor,$(SIMD) $(FMA),$(eval $(call simd-check-cc,$(flavor))))
+ISA := bmi bmi2 tbm sse4.1 sse4.2 sse4a avx avx2 f16c
+ISA += $(addprefix avx512,f bw dq 4fmaps)
+$(foreach isa,$(ISA),$(eval $(call isa-check-cc,$(isa))))
 
 # Also explicitly check for {evex} pseudo-prefix support, which got introduced
 # only after AVX512F and some of its extensions.
Re: [PATCH] x86emul: rework compiler probing in the test harness
Posted by Andrew Cooper 10 months, 4 weeks ago
On 02/03/2023 2:28 pm, Jan Beulich wrote:
> Checking for what $(SIMD) contains was initially right, but already the
> addition of $(FMA) wasn't. Later categories (correctly) weren't added.
> Instead what is of interest is anything the main harness source file
> uses outside of suitable #if and without resorting to .byte, as that's
> the one file (containing actual tests) which has to succeed in building.
> The auxiliary binary blobs we utilize may fail to build; the resulting
> empty blobs are recognized and reported as "n/a" when the harness is
> run.
>
> Note that strictly speaking we'd need to probe the assembler. We assume
> that a compiler knowing of a certain ISA extension is backed by an
> equally capable assembler.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>