[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86emul: handle AVX512-FP16 conversion to/from (packed) int16 insns
commit 59c2c9c2a003d61a2c5f2e7f88342db765c283c3 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Jun 5 15:00:15 2023 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Jun 5 15:00:15 2023 +0200 x86emul: handle AVX512-FP16 conversion to/from (packed) int16 insns These are easiest in that they have same-size source and destination vectors, yet they're different from other conversion insns in that they use opcodes which have different meaning in the 0F encoding space ({,V}H{ADD,SUB}P{S,D}), hence requiring a little bit of overriding. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- tools/tests/x86_emulator/evex-disp8.c | 6 ++++++ tools/tests/x86_emulator/predicates.c | 6 ++++++ xen/arch/x86/x86_emulate/decode.c | 8 +++++++- xen/arch/x86/x86_emulate/x86_emulate.c | 8 ++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c index b5329fcfc3..381cb488fe 100644 --- a/tools/tests/x86_emulator/evex-disp8.c +++ b/tools/tests/x86_emulator/evex-disp8.c @@ -612,6 +612,12 @@ static const struct test avx512_fp16_all[] = { INSN(cmpph, , 0f3a, c2, vl, fp16, vl), INSN(cmpsh, f3, 0f3a, c2, el, fp16, el), INSN(comish, , map5, 2f, el, fp16, el), + INSN(cvtph2uw, , map5, 7d, vl, fp16, vl), + INSN(cvtph2w, 66, map5, 7d, vl, fp16, vl), + INSN(cvttph2uw, , map5, 7c, vl, fp16, vl), + INSN(cvttph2w, 66, map5, 7c, vl, fp16, vl), + INSN(cvtuw2ph, f2, map5, 7d, vl, fp16, vl), + INSN(cvtw2ph, f3, map5, 7d, vl, fp16, vl), INSN(divph, , map5, 5e, vl, fp16, vl), INSN(divsh, f3, map5, 5e, el, fp16, el), INSNX(fcmaddcph, f2, map6, 56, 1, vl, d, vl), diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c index acbd32a5be..614432a42d 100644 --- a/tools/tests/x86_emulator/predicates.c +++ b/tools/tests/x86_emulator/predicates.c @@ -2064,6 +2064,12 @@ static const struct evex { { { 0x5f }, 2, T, R, pfx_no, W0, Ln }, /* vmaxph */ { { 0x5f }, 2, T, R, pfx_f3, W0, LIG }, /* vmaxsh */ { { 0x6e }, 2, T, R, pfx_66, WIG, L0 }, /* vmovw */ + { { 0x7c }, 2, T, R, pfx_no, W0, Ln }, /* vcvttph2uw */ + { { 0x7c }, 2, T, R, pfx_66, W0, Ln }, /* vcvttph2w */ + { { 0x7d }, 2, T, R, pfx_no, W0, Ln }, /* vcvtph2uw */ + { { 0x7d }, 2, T, R, pfx_66, W0, Ln }, /* vcvtph2w */ + { { 0x7d }, 2, T, R, pfx_f3, W0, Ln }, /* vcvtw2ph */ + { { 0x7d }, 2, T, R, pfx_f2, W0, Ln }, /* vcvtuwph */ { { 0x7e }, 2, T, W, pfx_66, WIG, L0 }, /* vmovw */ }, evex_map6[] = { { { 0x2c }, 2, T, R, pfx_66, W0, Ln }, /* vscalefph */ diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c index aef64d9854..a5baa3ed62 100644 --- a/xen/arch/x86/x86_emulate/decode.c +++ b/xen/arch/x86/x86_emulate/decode.c @@ -247,7 +247,7 @@ static const struct twobyte_table { [0x78 ... 0x79] = { DstImplicit|SrcMem|ModRM|Mov, simd_other, d8s_vl }, [0x7a] = { DstImplicit|SrcMem|ModRM|Mov, simd_packed_fp, d8s_vl }, [0x7b] = { DstImplicit|SrcMem|ModRM|Mov, simd_other, d8s_dq64 }, - [0x7c ... 0x7d] = { DstImplicit|SrcMem|ModRM, simd_other }, + [0x7c ... 0x7d] = { DstImplicit|SrcMem|ModRM, simd_other, d8s_vl }, [0x7e] = { DstMem|SrcImplicit|ModRM|Mov, simd_none, d8s_dq64 }, [0x7f] = { DstMem|SrcImplicit|ModRM|Mov, simd_packed_int, d8s_vl }, [0x80 ... 0x8f] = { DstImplicit|SrcImm }, @@ -1485,6 +1485,12 @@ int x86emul_decode(struct x86_emulate_state *s, s->fp16 = true; s->simd_size = simd_none; break; + + case 0x7c: /* vcvttph2{,u}w */ + case 0x7d: /* vcvtph2{,u}w / vcvt{,u}w2ph */ + d = DstReg | SrcMem | TwoOp; + s->fp16 = true; + break; } /* Like above re-use twobyte_table[] here. */ diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 5c1ec668de..eb40938b0f 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -7781,6 +7781,14 @@ x86_emulate( generate_exception_if(evex.w, X86_EXC_UD); goto avx512f_all_fp; + case X86EMUL_OPC_EVEX (5, 0x7c): /* vcvttph2uw [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX_66(5, 0x7c): /* vcvttph2w [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX (5, 0x7d): /* vcvtph2uw [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX_66(5, 0x7d): /* vcvtph2w [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX_F3(5, 0x7d): /* vcvtw2ph [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX_F2(5, 0x7d): /* vcvtuw2ph [xyz]mm/mem,[xyz]mm{k} */ + op_bytes = 16 << evex.lr; + /* fall through */ case X86EMUL_OPC_EVEX_66(6, 0x2c): /* vscalefph [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */ case X86EMUL_OPC_EVEX_66(6, 0x42): /* vgetexpph [xyz]mm/mem,[xyz]mm{k} */ case X86EMUL_OPC_EVEX_66(6, 0x96): /* vfmaddsub132ph [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */ -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |