From patchwork Fri Mar 15 10:53:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10854491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCFE41390 for ; Fri, 15 Mar 2019 10:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4D6E2A864 for ; Fri, 15 Mar 2019 10:55:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9815D2A874; Fri, 15 Mar 2019 10:55:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23FC92A864 for ; Fri, 15 Mar 2019 10:55:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h4kTB-0006lx-Bp; Fri, 15 Mar 2019 10:53:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h4kTA-0006lm-Ew for xen-devel@lists.xenproject.org; Fri, 15 Mar 2019 10:53:44 +0000 X-Inumbo-ID: 9773a936-4710-11e9-81e2-471df63f5f69 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9773a936-4710-11e9-81e2-471df63f5f69; Fri, 15 Mar 2019 10:53:40 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Fri, 15 Mar 2019 04:53:39 -0600 Message-Id: <5C8B8431020000780021F20E@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Fri, 15 Mar 2019 04:53:37 -0600 From: "Jan Beulich" To: "xen-devel" References: <5B6BF83602000078001DC548@prv1-mh.provo.novell.com> <5C8B7EC0020000780021F10B@prv1-mh.provo.novell.com> In-Reply-To: <5C8B7EC0020000780021F10B@prv1-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH v8 23/50] x86emul: support AVX512{F, DQ} uint-to-FP conversion insns X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: George Dunlap , Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some "manual" overrides of disp8scale are needed here again. In particular code ends up simpler when using d8s_dq64 in the twobyte_table[] entry. Test harness additions will be done once the reverse conversions are also available. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- v7: Re-base. v4: New. --- a/tools/tests/x86_emulator/evex-disp8.c +++ b/tools/tests/x86_emulator/evex-disp8.c @@ -127,6 +127,10 @@ static const struct test avx512f_all[] = INSN(cvttps2dq, f3, 0f, 5b, vl, d, vl), INSN(cvttsd2si, f2, 0f, 2c, el, q, el), INSN(cvttss2si, f3, 0f, 2c, el, d, el), + INSN(cvtudq2pd, f3, 0f, 7a, vl_2, d, vl), + INSN(cvtudq2ps, f2, 0f, 7a, vl, d, vl), + INSN(cvtusi2sd, f2, 0f, 7b, el, dq64, el), + INSN(cvtusi2ss, f3, 0f, 7b, el, dq64, el), INSN_FP(div, 0f, 5e), INSN(fmadd132, 66, 0f38, 98, vl, sd, vl), INSN(fmadd132, 66, 0f38, 99, el, sd, el), @@ -416,6 +420,8 @@ static const struct test avx512dq_all[] INSN(cvtqq2ps, , 0f, 5b, vl, q, vl), INSN(cvttpd2qq, 66, 0f, 7a, vl, q, vl), INSN(cvttps2qq, 66, 0f, 7a, vl_2, d, vl), + INSN(cvtuqq2pd, f3, 0f, 7a, vl, q, vl), + INSN(cvtuqq2ps, f2, 0f, 7a, vl, q, vl), INSN_PFP(or, 0f, 56), // pmovd2m, f3, 0f38, 39, d // pmovm2, f3, 0f38, 38, dq --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -326,7 +326,7 @@ static const struct twobyte_table { [0x78] = { ImplicitOps|ModRM }, [0x79] = { DstReg|SrcMem|ModRM, simd_packed_int }, [0x7a] = { DstImplicit|SrcMem|ModRM|Mov, simd_packed_fp, d8s_vl }, - [0x7b] = { DstImplicit|SrcMem|ModRM|Mov, simd_other, d8s_vl }, + [0x7b] = { DstImplicit|SrcMem|ModRM|Mov, simd_other, d8s_dq64 }, [0x7c ... 0x7d] = { DstImplicit|SrcMem|ModRM, simd_other }, [0x7e] = { DstMem|SrcImplicit|ModRM|Mov, simd_none, d8s_dq64 }, [0x7f] = { DstMem|SrcImplicit|ModRM|Mov, simd_packed_int, d8s_vl }, @@ -3085,12 +3085,16 @@ x86_decode( --disp8scale; break; - case 0x7a: /* vcvttps2qq needs special casing */ - case 0x7b: /* vcvtps2qq needs special casing */ - if ( disp8scale && evex.pfx == vex_66 && !evex.w && !evex.brs ) + case 0x7a: /* vcvttps2qq and vcvtudq2pd need special casing */ + if ( disp8scale && evex.pfx != vex_f2 && !evex.w && !evex.brs ) --disp8scale; break; + case 0x7b: /* vcvtp{s,d}2qq need special casing */ + if ( disp8scale && evex.pfx == vex_66 ) + disp8scale = (evex.brs ? 2 : 3 + evex.lr) + evex.w; + break; + case 0x7e: /* vmovq xmm/m64,xmm needs special casing */ if ( disp8scale == 2 && evex.pfx == vex_f3 ) disp8scale = 3; @@ -6214,6 +6218,7 @@ x86_emulate( goto simd_0f_rm; CASE_SIMD_SCALAR_FP(_EVEX, 0x0f, 0x2a): /* vcvtsi2s{s,d} r/m,xmm,xmm */ + CASE_SIMD_SCALAR_FP(_EVEX, 0x0f, 0x7b): /* vcvtusi2s{s,d} r/m,xmm,xmm */ generate_exception_if(evex.opmsk || (ea.type != OP_REG && evex.brs), EXC_UD); host_and_vcpu_must_have(avx512f); @@ -6680,6 +6685,8 @@ x86_emulate( /* fall through */ case X86EMUL_OPC_EVEX(0x0f, 0x5b): /* vcvtdq2ps [xyz]mm/mem,[xyz]mm{k} */ /* vcvtqq2ps [xyz]mm/mem,{x,y}mm{k} */ + case X86EMUL_OPC_EVEX_F2(0x0f, 0x7a): /* vcvtudq2ps [xyz]mm/mem,[xyz]mm{k} */ + /* vcvtuqq2ps [xyz]mm/mem,{x,y}mm{k} */ if ( evex.w ) host_and_vcpu_must_have(avx512dq); else @@ -7358,6 +7365,8 @@ x86_emulate( case X86EMUL_OPC_EVEX_F2(0x0f, 0xe6): /* vcvtpd2dq [xyz]mm/mem,{x,y}mm{k} */ generate_exception_if(!evex.w, EXC_UD); /* fall through */ + case X86EMUL_OPC_EVEX_F3(0x0f, 0x7a): /* vcvtudq2pd {x,y}mm/mem,[xyz]mm{k} */ + /* vcvtuqq2pd [xyz]mm/mem,[xyz]mm{k} */ case X86EMUL_OPC_EVEX_F3(0x0f, 0xe6): /* vcvtdq2pd {x,y}mm/mem,[xyz]mm{k} */ /* vcvtqq2pd [xyz]mm/mem,[xyz]mm{k} */ if ( evex.pfx != vex_f3 )