[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 07/10] 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> --- 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), --- a/tools/tests/x86_emulator/predicates.c +++ b/tools/tests/x86_emulator/predicates.c @@ -2048,6 +2048,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 */ --- a/xen/arch/x86/x86_emulate/decode.c +++ b/xen/arch/x86/x86_emulate/decode.c @@ -259,7 +259,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 }, @@ -1496,6 +1496,12 @@ int x86emul_decode(struct x86_emulate_st 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. */ --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -7778,6 +7778,14 @@ x86_emulate( generate_exception_if(evex.w, 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} */
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |