All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Roger Pau Monné" <roger@xenproject.org>
Subject: [PATCH v5 17/19] x86emul: support AVX10.2-aux misc insns
Date: Wed, 11 Nov 2026 14:48:49 +0100	[thread overview]
Message-ID: <f029f34b-df9e-4600-aeeb-e1117e27c477@suse.com> (raw)
In-Reply-To: <1be43887-4494-4ff5-a801-0c6bab90c80d@suse.com>

VPMOVSSDB is a counterpart to VPMOVSDB, so handle it the same.

VUNPACKB otoh is regular (without fault suppression or broadcast) as to
its memory operand, and hence straightforward to handle.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
SDE: ???
---
v5: New.

--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -821,6 +821,11 @@ static const struct test avx10_2_128[] =
     INSN(movw, f3, map5, 7e, el, fp16, el),
 };
 
+static const struct test avx10_2_aux_all[] = {
+    INSN(pmovssdb,       f3, 0f38, 41, vl_4,    b, vl),
+    INSN(unpackb,          , 0f3a, 3d,   vl,    b, vl),
+};
+
 static const struct test movrs_all[] = {
     INSN(movrsb, f2, map5, 6f, vl,    b, vl),
     INSN(movrsd, f3, map5, 6f, vl, d_nb, vl),
@@ -1258,4 +1263,6 @@ void evex_disp8_test(void *instr, struct
 
     run(cpu_has_avx10_2, avx10_2, all);
     run(cpu_has_avx10_2, avx10_2, 128);
+
+    run(cpu_has_avx10_2_aux, avx10_2_aux, all);
 }
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1917,6 +1917,7 @@ static const struct evex {
     { { 0x3e }, 2, T, R, pfx_66, WIG, Ln }, /* vpmaxuw */
     { { 0x3f }, 2, T, R, pfx_66, Wn, Ln }, /* vpmaxu{d,q} */
     { { 0x40 }, 2, T, R, pfx_66, Wn, Ln }, /* vpmull{d,q} */
+    { { 0x41 }, 2, T, W, pfx_f3, W0, Ln }, /* vpmovssdb */
     { { 0x42 }, 2, T, R, pfx_66, Wn, Ln }, /* vgetexpp{s,d} */
     { { 0x43 }, 2, T, R, pfx_66, Wn, LIG }, /* vgetexps{s,d} */
     { { 0x44 }, 2, T, R, pfx_66, Wn, Ln }, /* vlzcnt{d,q} */
@@ -2091,6 +2092,7 @@ static const struct evex {
     { { 0x39 }, 3, T, W, pfx_66, Wn, L1|L2 }, /* vextracti{32x4,64x2} */
     { { 0x3a }, 3, T, R, pfx_66, Wn, L2 }, /* vinserti{32x8,64x4} */
     { { 0x3b }, 3, T, W, pfx_66, Wn, L2 }, /* vextracti{32x8,64x4} */
+    { { 0x3d }, 3, T, R, pfx_no, W0, Ln }, /* vunpackb */
     { { 0x3e }, 3, T, R, pfx_66, Wn, Ln }, /* vpcmpu{b,w} */
     { { 0x3f }, 3, T, R, pfx_66, Wn, Ln }, /* vpcmp{b,w} */
     { { 0x42 }, 3, T, R, pfx_66, W0, Ln }, /* vdbpsadbw */
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -219,6 +219,8 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx10               (cpu_policy.feat.avx10 && xcr0_mask(0xe6))
 #define cpu_has_avx10_2             (cpu_policy.avx10.version >= 2 && \
                                      xcr0_mask(0xe6))
+#define cpu_has_avx10_2_aux         (cpu_policy.avx10.avx10_v2_aux && \
+                                     xcr0_mask(0xe6))
 
 #define cpu_has_xgetbv1             (cpu_has_xsave && cpu_policy.xstate.xgetbv1)
 
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -492,6 +492,7 @@ static const struct ext0f3a_table {
     [0x3a] = { .simd_size = simd_256, .d8s = d8s_vl_by_2 },
     [0x39] = { .simd_size = simd_128, .to_mem = 1, .two_op = 1, .d8s = 4 },
     [0x3b] = { .simd_size = simd_256, .to_mem = 1, .two_op = 1, .d8s = d8s_vl_by_2 },
+    [0x3d] = { .simd_size = simd_packed_int, .two_op = 1, .d8s = d8s_vl },
     [0x3e ... 0x3f] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x40 ... 0x41] = { .simd_size = simd_packed_fp },
     [0x42 ... 0x43] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
@@ -1456,14 +1457,20 @@ int x86emul_decode(struct x86_emulate_st
                  * insns with the same base opcodes. Rather than adding new
                  * columns to the table, handle this here for now.
                  */
-                if ( s->evex.pfx != vex_f3 || (b & 0xf8) != 0x10 )
-                    disp8scale = decode_disp8scale(ext0f38_table[b].d8s, s);
-                else
+                if ( s->evex.pfx == vex_f3 && (b & 0xf8) == 0x10 )
                 {
                     disp8scale = decode_disp8scale(ext0f38_table[b ^ 0x30].d8s,
                                                    s);
                     s->simd_size = simd_other;
                 }
+                /* Same for VPMOVSSDB vs VPMOVSDB. */
+                else if ( s->evex.pfx == vex_f3 && b == 0x41 )
+                {
+                    disp8scale = decode_disp8scale(ext0f38_table[0x21].d8s, s);
+                    s->simd_size = simd_other;
+                }
+                else
+                    disp8scale = decode_disp8scale(ext0f38_table[b].d8s, s);
             }
             break;
 
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -610,6 +610,7 @@ amd_like(const struct x86_emulate_ctxt *
 #define vcpu_has_user_msr()    (ctxt->cpuid->feat.user_msr)
 
 #define vcpu_has_avx10(minor)  (ctxt->cpuid->avx10.version >= (minor))
+#define vcpu_has_avx10_2_aux() (ctxt->cpuid->avx10.avx10_v2_aux)
 
 #define vcpu_must_have(feat, ...) \
     generate_exception_if(!vcpu_has_##feat(__VA_ARGS__), X86_EXC_UD)
--- a/xen/arch/x86/x86_emulate/util.c
+++ b/xen/arch/x86/x86_emulate/util.c
@@ -150,6 +150,7 @@ bool cf_check x86_insn_is_mem_write(cons
              X86EMUL_OPC_EVEX_F3(0x0f38, 0x25): /* VPMOVS* */
         case X86EMUL_OPC_EVEX_F3(0x0f38, 0x30) ...
              X86EMUL_OPC_EVEX_F3(0x0f38, 0x35): /* VPMOV{D,Q,W}* */
+        case X86EMUL_OPC_EVEX_F3(0x0f38, 0x41): /* VPMOVSSDB */
             return s->modrm_mod != 3;
         }
 
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5840,6 +5840,9 @@ x86_emulate(
         elem_bytes = 2;
         goto avx512f_no_sae;
 
+    case X86EMUL_OPC_EVEX_F3(0x0f38, 0x41): /* vpmovssdb [xyz]mm,xmm/mem{k} */
+        vcpu_must_have(avx10_2_aux);
+        fallthrough;
     case X86EMUL_OPC_EVEX_F3(0x0f38, 0x10): /* vpmovuswb [xyz]mm,{x,y}mm/mem{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x20): /* vpmovsxbw {x,y}mm/mem,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_F3(0x0f38, 0x20): /* vpmovswb [xyz]mm,{x,y}mm/mem{k} */
@@ -7747,6 +7750,13 @@ x86_emulate(
         visa_check(bw);
         goto opmask_shift_imm;
 
+    case X86EMUL_OPC_EVEX(0x0f3a, 0x3d): /* vunpackb $imm8,[xyz]mm/mem,[xyz]mm{k} */
+        generate_exception_if(evex.w || evex.brs, X86_EXC_UD);
+        vcpu_must_have(avx10_2_aux);
+        avx512_vlen_check(false);
+        fault_suppression = false;
+        goto simd_imm8_zmm;
+
     case X86EMUL_OPC_EVEX_F3(0x0f3a, 0x42): /* vmpsadbw $imm8,[xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
         generate_exception_if(evex.w || evex.brs, X86_EXC_UD);
         vcpu_must_have(avx10, 2);



  parent reply	other threads:[~2026-11-11 13:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 13:40 [PATCH v5 00/19] x86: support AVX10 Jan Beulich
2026-11-11 13:41 ` [PATCH v5 01/19] x86/CPUID: enable AVX10 leaf Jan Beulich
2026-11-11 13:42 ` [PATCH v5 02/19] x86emul: support SIMD MOVRS Jan Beulich
2026-11-11 13:42 ` [PATCH v5 03/19] x86emul: support AVX10 forms of SM4 insns Jan Beulich
2026-11-11 13:42 ` [PATCH v5 04/19] x86emul: support AVX10.1 Jan Beulich
2026-11-11 13:43 ` [PATCH v5 05/19] x86emul/test: use simd_check_avx512*() in main() Jan Beulich
2026-11-11 13:44 ` [PATCH v5 06/19] x86emul/test: drop cpu_has_avx512vl Jan Beulich
2026-11-11 13:44 ` [PATCH v5 07/19] x86emul: AVX10.1 testing Jan Beulich
2026-11-11 13:45 ` [PATCH v5 08/19] x86emul/test: engage AVX512VL via command line option Jan Beulich
2026-11-11 13:45 ` [PATCH v5 09/19] x86/CPUID: enable AVX10.2 sub-leaf Jan Beulich
2026-11-11 13:46 ` [PATCH v5 10/19] x86emul: support AVX10.2 scalar compare insns Jan Beulich
2026-11-11 13:46 ` [PATCH v5 11/19] x86emul: support AVX10.2 partial copy insns Jan Beulich
2026-11-11 13:47 ` [PATCH v5 12/19] x86emul: support AVX10.2 media insns Jan Beulich
2026-11-11 13:47 ` [PATCH v5 13/19] x86emul: support AVX10.2 minmax insns Jan Beulich
2026-11-11 13:47 ` [PATCH v5 14/19] x86emul: support AVX10.2 BFloat16 insns Jan Beulich
2026-11-11 13:48 ` [PATCH v5 15/19] x86emul: support AVX10.2 saturating convert insns Jan Beulich
2026-11-11 13:48 ` [PATCH v5 16/19] x86emul: support other AVX10.2 " Jan Beulich
2026-11-11 13:48 ` Jan Beulich [this message]
2026-11-11 13:49 ` [PATCH v5 18/19] x86emul: support AVX10.2-aux {B,H}F{4,6} <-> {B,H}F8 converts Jan Beulich
2026-11-11 13:49 ` [PATCH v5 19/19] x86emul: support AVX10.2-aux PS <-> {B,H}F8{,S} converts 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=f029f34b-df9e-4600-aeeb-e1117e27c477@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --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.