From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v3 03/16] x86emul/test: use simd_check_avx512*() in main()
Date: Wed, 11 Dec 2024 11:12:21 +0100 [thread overview]
Message-ID: <ab8aac20-ac79-4049-b7fb-3337b324fbf8@suse.com> (raw)
In-Reply-To: <516b7f9a-048e-409d-8a4e-89aeb8ffacc4@suse.com>
In preparation for having these also cover AVX10, use the helper
functions in preference of open-coded cpu_has_avx512* for those features
that AVX10 includes. Introduce a couple further helper functions where
they weren't previously needed.
Note that this way simd_check_avx512f_sha_vl() gains an AVX512F check
(which is likely benign) and simd_check_avx512bw_gf_vl() gains an
AVX512BW check (which was clearly missing).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Re-base over dropping of Xeon Phi support.
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -167,6 +167,11 @@ static bool simd_check_avx512vbmi_vl(voi
return cpu_has_avx512_vbmi && cpu_has_avx512vl;
}
+static bool simd_check_avx512vbmi2(void)
+{
+ return cpu_has_avx512_vbmi2;
+}
+
static bool simd_check_sse4_sha(void)
{
return cpu_has_sha && cpu_has_sse4_2;
@@ -179,7 +184,7 @@ static bool simd_check_avx_sha(void)
static bool simd_check_avx512f_sha_vl(void)
{
- return cpu_has_sha && cpu_has_avx512vl;
+ return cpu_has_sha && simd_check_avx512f_vl();
}
static bool simd_check_avx2_vaes(void)
@@ -189,13 +194,13 @@ static bool simd_check_avx2_vaes(void)
static bool simd_check_avx512bw_vaes(void)
{
- return cpu_has_aesni && cpu_has_vaes && cpu_has_avx512bw;
+ return cpu_has_aesni && cpu_has_vaes && simd_check_avx512bw();
}
static bool simd_check_avx512bw_vaes_vl(void)
{
return cpu_has_aesni && cpu_has_vaes &&
- cpu_has_avx512bw && cpu_has_avx512vl;
+ simd_check_avx512bw_vl();
}
static bool simd_check_avx2_vpclmulqdq(void)
@@ -205,22 +210,22 @@ static bool simd_check_avx2_vpclmulqdq(v
static bool simd_check_avx512bw_vpclmulqdq(void)
{
- return cpu_has_vpclmulqdq && cpu_has_avx512bw;
+ return cpu_has_vpclmulqdq && simd_check_avx512bw();
}
static bool simd_check_avx512bw_vpclmulqdq_vl(void)
{
- return cpu_has_vpclmulqdq && cpu_has_avx512bw && cpu_has_avx512vl;
+ return cpu_has_vpclmulqdq && simd_check_avx512bw_vl();
}
static bool simd_check_avx512vbmi2_vpclmulqdq(void)
{
- return cpu_has_avx512_vbmi2 && simd_check_avx512bw_vpclmulqdq();
+ return simd_check_avx512vbmi2() && simd_check_avx512bw_vpclmulqdq();
}
static bool simd_check_avx512vbmi2_vpclmulqdq_vl(void)
{
- return cpu_has_avx512_vbmi2 && simd_check_avx512bw_vpclmulqdq_vl();
+ return simd_check_avx512vbmi2() && simd_check_avx512bw_vpclmulqdq_vl();
}
static bool simd_check_sse2_gf(void)
@@ -235,12 +240,17 @@ static bool simd_check_avx2_gf(void)
static bool simd_check_avx512bw_gf(void)
{
- return cpu_has_gfni && cpu_has_avx512bw;
+ return cpu_has_gfni && simd_check_avx512bw();
}
static bool simd_check_avx512bw_gf_vl(void)
{
- return cpu_has_gfni && cpu_has_avx512vl;
+ return cpu_has_gfni && simd_check_avx512bw_vl();
+}
+
+static bool simd_check_avx512vnni(void)
+{
+ return cpu_has_avx512_vnni;
}
static bool simd_check_avx512fp16(void)
@@ -3195,7 +3205,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovq %xmm1,32(%edx)...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovq_to_mem);
@@ -3219,7 +3229,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovq 32(%edx),%xmm0...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovq_from_mem);
@@ -3342,7 +3352,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovdqu32 %zmm2,(%ecx){%k1}...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(vmovdqu32_to_mem);
@@ -3372,7 +3382,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovdqu32 64(%edx),%zmm2{%k2}...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(vmovdqu32_from_mem);
@@ -3397,7 +3407,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovdqu16 %zmm3,(%ecx){%k1}...");
- if ( stack_exec && cpu_has_avx512bw )
+ if ( stack_exec && simd_check_avx512bw() )
{
decl_insn(vmovdqu16_to_mem);
@@ -3429,7 +3439,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovdqu16 64(%edx),%zmm3{%k2}...");
- if ( stack_exec && cpu_has_avx512bw )
+ if ( stack_exec && simd_check_avx512bw() )
{
decl_insn(vmovdqu16_from_mem);
@@ -3557,7 +3567,7 @@ int main(int argc, char **argv)
printf("%-40s", "Testing vmovsd %xmm5,16(%ecx){%k3}...");
memset(res, 0x88, 128);
memset(res + 20, 0x77, 8);
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(vmovsd_masked_to_mem);
@@ -3592,7 +3602,7 @@ int main(int argc, char **argv)
}
printf("%-40s", "Testing vmovaps (%edx),%zmm7{%k3}{z}...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(vmovaps_masked_from_mem);
@@ -3775,7 +3785,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovd %xmm3,32(%ecx)...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovd_to_mem);
@@ -3800,7 +3810,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovd 32(%ecx),%xmm4...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovd_from_mem);
@@ -3990,7 +4000,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovd %xmm2,%ebx...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovd_to_reg);
@@ -4016,7 +4026,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovd %ebx,%xmm1...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovd_from_reg);
@@ -4118,7 +4128,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing {evex} vmovq %xmm11,32(%ecx)...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovq_to_mem2);
@@ -4208,7 +4218,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovq %xmm22,%rbx...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovq_to_reg);
@@ -4401,7 +4411,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovntdqa 64(%ecx),%zmm4...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vmovntdqa);
@@ -4997,7 +5007,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vcvtph2ps 32(%ecx),%zmm7{%k4}...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(evex_vcvtph2ps);
decl_insn(evex_vcvtps2ph);
@@ -5040,7 +5050,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vfixupimmpd $0,8(%edx){1to8},%zmm3,%zmm4...");
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(vfixupimmpd);
static const struct {
@@ -5079,7 +5089,7 @@ int main(int argc, char **argv)
printf("%-40s", "Testing vfpclasspsz $0x46,64(%edx),%k2...");
- if ( stack_exec && cpu_has_avx512dq )
+ if ( stack_exec && simd_check_avx512dq() )
{
decl_insn(vfpclassps);
@@ -5111,7 +5121,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vfpclassphz $0x46,128(%ecx),%k3...");
- if ( stack_exec && cpu_has_avx512_fp16 )
+ if ( stack_exec && simd_check_avx512fp16() )
{
decl_insn(vfpclassph);
@@ -5154,7 +5164,7 @@ int main(int argc, char **argv)
* on the mapping boundaries) that elements controlled by clear mask
* bits don't get accessed.
*/
- if ( stack_exec && cpu_has_avx512f )
+ if ( stack_exec && simd_check_avx512f() )
{
decl_insn(vpcompressd);
decl_insn(vpcompressq);
@@ -5256,7 +5266,7 @@ int main(int argc, char **argv)
}
#if __GNUC__ > 7 /* can't check for __AVX512VBMI2__ here */
- if ( stack_exec && cpu_has_avx512_vbmi2 )
+ if ( stack_exec && simd_check_avx512vbmi2() )
{
decl_insn(vpcompressb);
decl_insn(vpcompressw);
@@ -5444,7 +5454,7 @@ int main(int argc, char **argv)
}
printf("%-40s", "Testing vpdpwssd (%ecx),%{y,z}mmA,%{y,z}mmB...");
- if ( stack_exec && cpu_has_avx512_vnni && cpu_has_avx_vnni )
+ if ( stack_exec && simd_check_avx512vnni() && cpu_has_avx_vnni )
{
/* Do the same operation two ways and compare the results. */
decl_insn(vpdpwssd_vex1);
@@ -5499,7 +5509,7 @@ int main(int argc, char **argv)
printf("skipped\n");
printf("%-40s", "Testing vmovsh 8(%ecx),%xmm5...");
- if ( stack_exec && cpu_has_avx512_fp16 )
+ if ( stack_exec && simd_check_avx512fp16() )
{
decl_insn(vmovsh_from_mem);
decl_insn(vmovw_to_gpr);
next prev parent reply other threads:[~2024-12-11 10:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 10:09 [PATCH v3 00/16] x86: support AVX10 Jan Beulich
2024-12-11 10:11 ` [PATCH v3 01/16] x86/CPUID: enable AVX10 leaf Jan Beulich
2024-12-11 10:11 ` [PATCH v3 02/16] x86emul: support AVX10.1 Jan Beulich
2024-12-11 10:12 ` Jan Beulich [this message]
2024-12-11 10:12 ` [PATCH v3 04/16] x86emul/test: drop cpu_has_avx512vl Jan Beulich
2024-12-11 10:13 ` [PATCH v3 05/16] x86emul: AVX10.1 testing Jan Beulich
2024-12-11 10:13 ` [PATCH v3 06/16] x86emul/test: engage AVX512VL via command line option Jan Beulich
2024-12-11 10:14 ` [PATCH v3 07/16] x86emul: support AVX10.2 256-bit embedded rounding / SAE Jan Beulich
2024-12-11 10:17 ` [PATCH v3 08/16] x86emul: support AVX10.2 scalar compare insns Jan Beulich
2024-12-11 10:18 ` [PATCH v3 09/16] x86emul: support AVX10.2 partial copy insns Jan Beulich
2024-12-11 10:18 ` [PATCH v3 10/16] x86emul: support AVX10.2 media insns Jan Beulich
2024-12-11 10:19 ` [PATCH v3 11/16] x86emul: support AVX10.2 minmax insns Jan Beulich
2024-12-11 10:19 ` [PATCH v3 12/16] x86emul: support AVX10.2 BFloat16 insns Jan Beulich
2024-12-11 10:20 ` [PATCH v3 13/16] x86emul: support AVX10.2 saturating convert insns Jan Beulich
2024-12-11 10:20 ` [PATCH v3 14/16] x86emul: support other AVX10.2 " Jan Beulich
2024-12-11 10:21 ` [PATCH v3 15/16] x86emul: support SIMD MOVRS Jan Beulich
2024-12-11 10:22 ` [PATCH v3 16/16] x86emul: support AVX10.2 forms of SM4 insns Jan Beulich
2024-12-11 10:29 ` [PATCH v3 00/16] x86: support AVX10 Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab8aac20-ac79-4049-b7fb-3337b324fbf8@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.