From patchwork Fri Mar 15 10:45:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10854477 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 7C37F15AC for ; Fri, 15 Mar 2019 10:46:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D172A934 for ; Fri, 15 Mar 2019 10:46:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58BF82A937; Fri, 15 Mar 2019 10:46:57 +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 DF84D2A934 for ; Fri, 15 Mar 2019 10:46:56 +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 1h4kL8-0005B6-P0; Fri, 15 Mar 2019 10:45:26 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h4kL6-0005A6-Oa for xen-devel@lists.xenproject.org; Fri, 15 Mar 2019 10:45:24 +0000 X-Inumbo-ID: 6f4167f9-470f-11e9-bc90-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 6f4167f9-470f-11e9-bc90-bc764e045a96; Fri, 15 Mar 2019 10:45:23 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Fri, 15 Mar 2019 04:45:22 -0600 Message-Id: <5C8B8241020000780021F1BE@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Fri, 15 Mar 2019 04:45:21 -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 16/50] x86emul: support AVX512F move duplicate 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 Judging from insn prefixes, these are scalar insns, but their (memory) operands are vector ones (with the exception of 128-bit VMOVDDUP). For this some adjustments to disp8scale calculation code are needed. No explicit test harness additions other than the overrides, as the compiler already makes use of the insns. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- v7: Re-base. v6: Fix Disp8 test for VMOVDDUP when AVX512VL is unavailable. v4: New. --- a/tools/tests/x86_emulator/evex-disp8.c +++ b/tools/tests/x86_emulator/evex-disp8.c @@ -146,6 +146,7 @@ static const struct test avx512f_all[] = INSN_SFP(mov, 0f, 11), INSN_PFP_NB(mova, 0f, 28), INSN_PFP_NB(mova, 0f, 29), + INSN(movddup, f2, 0f, 12, vl, q_nb, vl), INSN(movdqa32, 66, 0f, 6f, vl, d_nb, vl), INSN(movdqa32, 66, 0f, 7f, vl, d_nb, vl), INSN(movdqa64, 66, 0f, 6f, vl, q_nb, vl), @@ -157,6 +158,8 @@ static const struct test avx512f_all[] = INSN(movntdq, 66, 0f, e7, vl, d_nb, vl), INSN(movntdqa, 66, 0f38, 2a, vl, d_nb, vl), INSN_PFP_NB(movnt, 0f, 2b), + INSN(movshdup, f3, 0f, 16, vl, d_nb, vl), + INSN(movsldup, f3, 0f, 12, vl, d_nb, vl), INSN_PFP_NB(movu, 0f, 10), INSN_PFP_NB(movu, 0f, 11), INSN_FP(mul, 0f, 59), @@ -694,6 +697,19 @@ static void test_group(const struct test switch ( tests[i].esz ) { + case ESZ_q_nb: + /* The 128-bit form of VMOVDDUP needs special casing. */ + if ( vl[j] == VL_128 && tests[i].spc == SPC_0f && + tests[i].opc == 0x12 && tests[i].pfx == PFX_f2 ) + { + struct test test = tests[i]; + + test.vsz = VSZ_el; + test.scale = SC_el; + test_one(&test, vl[j], instr, ctxt); + continue; + } + /* fall through */ default: test_one(&tests[i], vl[j], instr, ctxt); break; --- a/tools/tests/x86_emulator/simd.h +++ b/tools/tests/x86_emulator/simd.h @@ -326,8 +326,11 @@ REN(pandn, , d); REN(por, , d); REN(pxor, , d); # endif +OVR(movddup); OVR(movntdq); OVR(movntdqa); +OVR(movshdup); +OVR(movsldup); OVR(pmovsxbd); OVR(pmovsxbq); OVR(pmovsxdq); --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -3048,6 +3048,15 @@ x86_decode( switch ( b ) { + case 0x12: /* vmovsldup / vmovddup */ + if ( evex.pfx == vex_f2 ) + disp8scale = evex.lr ? 4 + evex.lr : 3; + /* fall through */ + case 0x16: /* vmovshdup */ + if ( evex.pfx == vex_f3 ) + disp8scale = 4 + evex.lr; + break; + case 0x20: /* mov cr,reg */ case 0x21: /* mov dr,reg */ case 0x22: /* mov reg,cr */ @@ -6066,6 +6075,20 @@ x86_emulate( host_and_vcpu_must_have(sse3); goto simd_0f_xmm; + case X86EMUL_OPC_EVEX_F3(0x0f, 0x12): /* vmovsldup [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX_F2(0x0f, 0x12): /* vmovddup [xyz]mm/mem,[xyz]mm{k} */ + case X86EMUL_OPC_EVEX_F3(0x0f, 0x16): /* vmovshdup [xyz]mm/mem,[xyz]mm{k} */ + generate_exception_if((evex.brs || + evex.w != (evex.pfx & VEX_PREFIX_DOUBLE_MASK)), + EXC_UD); + host_and_vcpu_must_have(avx512f); + avx512_vlen_check(false); + d |= TwoOp; + op_bytes = !(evex.pfx & VEX_PREFIX_DOUBLE_MASK) || evex.lr + ? 16 << evex.lr : 8; + fault_suppression = false; + goto simd_zmm; + CASE_SIMD_PACKED_FP(_EVEX, 0x0f, 0x14): /* vunpcklp{s,d} [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */ CASE_SIMD_PACKED_FP(_EVEX, 0x0f, 0x15): /* vunpckhp{s,d} [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */ generate_exception_if(evex.w != (evex.pfx & VEX_PREFIX_DOUBLE_MASK),