From nobody Mon Feb 9 23:18:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1661555691; cv=none; d=zohomail.com; s=zohoarc; b=TEIPr1jzNozUIpMyrPyY+wadCcbXa/I1H2ImyAXFa4MevmgFy6FfdHCk8Gni+Nzc4on32Lb0gllnzXiAqCm7viBtgoKh25zLD+q+9TQNxod73lgsmA/tc4UVQ+hfQx2xTKRgbfhxqF3DU8ghg/XnAoyfGIjLZEXfXcLmfhnb/lc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661555691; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ce+JjCIhuae2cOI1iW4snBFPD80zf3M3cjwIFHb65b0=; b=UQ9EaI4PIEovGeZmtmTNSLVr2QajdnaA33vTuqWaBi3cAsmexqpV/unQpEz9LMVOfspMOH21OXuhpGDn9dmwGOIoD21p4MizW2MC93BJXE/Zk24ETDqG/35oHRwpJbm9oE6Ep9NcCrOwn7aMvrm7pgShYJkXYcI91peLxxxF7Wo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661555691051895.9943658050064; Fri, 26 Aug 2022 16:14:51 -0700 (PDT) Received: from localhost ([::1]:51588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRiXI-0000qc-9R for importer@patchew.org; Fri, 26 Aug 2022 19:14:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRiUu-0006SZ-8n for qemu-devel@nongnu.org; Fri, 26 Aug 2022 19:12:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34270) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRiUr-0007ov-QF for qemu-devel@nongnu.org; Fri, 26 Aug 2022 19:12:19 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-93-tAESeklWPLS67rOFRY2hjQ-1; Fri, 26 Aug 2022 19:12:15 -0400 Received: by mail-ed1-f72.google.com with SMTP id q32-20020a05640224a000b004462f105fa9so1849054eda.4 for ; Fri, 26 Aug 2022 16:12:15 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id 3-20020a170906300300b0073100dfa7b0sm1412429ejz.8.2022.08.26.16.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 16:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661555537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ce+JjCIhuae2cOI1iW4snBFPD80zf3M3cjwIFHb65b0=; b=VKLRRknWnF/nsr0eUpeIS7QMX2ws1xuRxbDCMTG4ribYfU95eGIZ7RpXaIA0FF8eA2Gcf8 UNi6/guDWGlpfb3K79fIImqQxEy1YaoxhK+uml91O+Sj/ZFS7Bu2c4Mr0xJ5391/TuTXVo HaVJJFkPAg3SR7r0Ej+jBexo3MA/KEY= X-MC-Unique: tAESeklWPLS67rOFRY2hjQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ce+JjCIhuae2cOI1iW4snBFPD80zf3M3cjwIFHb65b0=; b=XfpP9S9HPHinp9wV/94EQmCXbMgFrVr9vzWyET/4/RQ4yui3NdRZPXk6lV/aHCRoNg F0jAhbR+iVLygeE0/PeEGXrpU2Z8LH1yFRgWXH9nk3TMVHp4aF3AClDS+D4Q4Mb3RrEd mD/sCurFVMjHjtPhcHRRmbU6fWZY8wogzBVN+qmhUXdV8LgXW68sJfi7WbHBe+682+Lo hEDDUDT3AOiZGBxzHZwp6Nrg65hnSQUDTtUzAysGVTSZEy12p4H6hWYjHcdnGYi1gPUs Vlu8saAvsFphJ2ZKvzAYJlHXybrq8dDcgsfGjnBFAqEvfQeXLFpxtwbhl7CYb0qQfrBt fJGw== X-Gm-Message-State: ACgBeo2LRanqCn0U1yW+WNMeDTv3mDHPhDzaxDEiMLMopGWvE0QcUe76 OklqUNbEYfAah3RSTyFhdFrXFjkzIJfbI3zNHxw2tXpWQeNUzotHin2ceDFSqlRQF2uMFPjR+n3 9nwtYRD6d9cBgm03aL3qaaJvbvLKihZKW5kegI8bJFS9BU4V8BYjvbQgjafmrz0kc1IY= X-Received: by 2002:a05:6402:4407:b0:447:1026:7537 with SMTP id y7-20020a056402440700b0044710267537mr8126216eda.312.1661555534291; Fri, 26 Aug 2022 16:12:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR6bU5pHE3AkcyghBAbC4xRMTTnTgUtoaQk59VjZg+SpXcUNgNorql4TSok5e+tEhPWIel/1MA== X-Received: by 2002:a05:6402:4407:b0:447:1026:7537 with SMTP id y7-20020a056402440700b0044710267537mr8126199eda.312.1661555533890; Fri, 26 Aug 2022 16:12:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, paul@nowt.org Subject: [PATCH 04/23] i386: Rework sse_op_table1 Date: Sat, 27 Aug 2022 01:11:45 +0200 Message-Id: <20220826231204.201395-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220826231204.201395-1-pbonzini@redhat.com> References: <20220826231204.201395-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1661555691595100001 Content-Type: text/plain; charset="utf-8" From: Paul Brook Add a flags field each row in sse_op_table1. Initially this is only used as a replacement for the magic SSE_SPECIAL and SSE_DUMMY pointers, the other flags are mostly relevant for the AVX implementation but can be applied to SSE as well. Signed-off-by: Paul Brook Message-Id: <20220424220204.2493824-5-paul@nowt.org> Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 311 +++++++++++++++++++++--------------- 1 file changed, 182 insertions(+), 129 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index cba862746b..7332bbcf44 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2790,146 +2790,193 @@ typedef void (*SSEFunc_0_ppi)(TCGv_ptr reg_a, TCG= v_ptr reg_b, TCGv_i32 val); typedef void (*SSEFunc_0_eppt)(TCGv_ptr env, TCGv_ptr reg_a, TCGv_ptr reg_= b, TCGv val); =20 -#define SSE_SPECIAL ((void *)1) -#define SSE_DUMMY ((void *)2) +#define SSE_OPF_CMP (1 << 1) /* does not write for first operand */ +#define SSE_OPF_SPECIAL (1 << 3) /* magic */ +#define SSE_OPF_3DNOW (1 << 4) /* 3DNow! instruction */ +#define SSE_OPF_MMX (1 << 5) /* MMX/integer/AVX2 instruction */ +#define SSE_OPF_SCALAR (1 << 6) /* Has SSE scalar variants */ +#define SSE_OPF_SHUF (1 << 9) /* pshufx/shufpx */ =20 -#define MMX_OP2(x) { gen_helper_ ## x ## _mmx, gen_helper_ ## x ## _xmm } -#define SSE_FOP(x) { gen_helper_ ## x ## ps, gen_helper_ ## x ## pd, \ - gen_helper_ ## x ## ss, gen_helper_ ## x ## sd, } +#define OP(op, flags, a, b, c, d) \ + {flags, {a, b, c, d} } =20 -static const SSEFunc_0_epp sse_op_table1[256][4] =3D { +#define MMX_OP(x) OP(op1, SSE_OPF_MMX, \ + gen_helper_ ## x ## _mmx, gen_helper_ ## x ## _xmm, NULL, NULL) + +#define SSE_FOP(name) OP(op1, SSE_OPF_SCALAR, \ + gen_helper_##name##ps, gen_helper_##name##pd, \ + gen_helper_##name##ss, gen_helper_##name##sd) +#define SSE_OP(sname, dname, op, flags) OP(op, flags, \ + gen_helper_##sname##_xmm, gen_helper_##dname##_xmm, NULL, NULL) + +struct SSEOpHelper_table1 { + int flags; + SSEFunc_0_epp op[4]; +}; + +#define SSE_3DNOW { SSE_OPF_3DNOW } +#define SSE_SPECIAL { SSE_OPF_SPECIAL } + +static const struct SSEOpHelper_table1 sse_op_table1[256] =3D { /* 3DNow! extensions */ - [0x0e] =3D { SSE_DUMMY }, /* femms */ - [0x0f] =3D { SSE_DUMMY }, /* pf... */ + [0x0e] =3D SSE_SPECIAL, /* femms */ + [0x0f] =3D SSE_3DNOW, /* pf... (sse_op_table5) */ /* pure SSE operations */ - [0x10] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = movups, movupd, movss, movsd */ - [0x11] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = movups, movupd, movss, movsd */ - [0x12] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = movlps, movlpd, movsldup, movddup */ - [0x13] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* movlps, movlpd */ - [0x14] =3D { gen_helper_punpckldq_xmm, gen_helper_punpcklqdq_xmm }, - [0x15] =3D { gen_helper_punpckhdq_xmm, gen_helper_punpckhqdq_xmm }, - [0x16] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movhps, movh= pd, movshdup */ - [0x17] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* movhps, movhpd */ + [0x10] =3D SSE_SPECIAL, /* movups, movupd, movss, movsd */ + [0x11] =3D SSE_SPECIAL, /* movups, movupd, movss, movsd */ + [0x12] =3D SSE_SPECIAL, /* movlps, movlpd, movsldup, movddup */ + [0x13] =3D SSE_SPECIAL, /* movlps, movlpd */ + [0x14] =3D SSE_OP(punpckldq, punpcklqdq, op1, 0), /* unpcklps, unpcklp= d */ + [0x15] =3D SSE_OP(punpckhdq, punpckhqdq, op1, 0), /* unpckhps, unpckhp= d */ + [0x16] =3D SSE_SPECIAL, /* movhps, movhpd, movshdup */ + [0x17] =3D SSE_SPECIAL, /* movhps, movhpd */ =20 - [0x28] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* movaps, movapd */ - [0x29] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* movaps, movapd */ - [0x2a] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = cvtpi2ps, cvtpi2pd, cvtsi2ss, cvtsi2sd */ - [0x2b] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = movntps, movntpd, movntss, movntsd */ - [0x2c] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = cvttps2pi, cvttpd2pi, cvttsd2si, cvttss2si */ - [0x2d] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* = cvtps2pi, cvtpd2pi, cvtsd2si, cvtss2si */ - [0x2e] =3D { gen_helper_ucomiss, gen_helper_ucomisd }, - [0x2f] =3D { gen_helper_comiss, gen_helper_comisd }, - [0x50] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* movmskps, movmskpd */ - [0x51] =3D SSE_FOP(sqrt), - [0x52] =3D { gen_helper_rsqrtps, NULL, gen_helper_rsqrtss, NULL }, - [0x53] =3D { gen_helper_rcpps, NULL, gen_helper_rcpss, NULL }, - [0x54] =3D { gen_helper_pand_xmm, gen_helper_pand_xmm }, /* andps, and= pd */ - [0x55] =3D { gen_helper_pandn_xmm, gen_helper_pandn_xmm }, /* andnps, = andnpd */ - [0x56] =3D { gen_helper_por_xmm, gen_helper_por_xmm }, /* orps, orpd */ - [0x57] =3D { gen_helper_pxor_xmm, gen_helper_pxor_xmm }, /* xorps, xor= pd */ + [0x28] =3D SSE_SPECIAL, /* movaps, movapd */ + [0x29] =3D SSE_SPECIAL, /* movaps, movapd */ + [0x2a] =3D SSE_SPECIAL, /* cvtpi2ps, cvtpi2pd, cvtsi2ss, cvtsi2sd */ + [0x2b] =3D SSE_SPECIAL, /* movntps, movntpd, movntss, movntsd */ + [0x2c] =3D SSE_SPECIAL, /* cvttps2pi, cvttpd2pi, cvttsd2si, cvttss2si = */ + [0x2d] =3D SSE_SPECIAL, /* cvtps2pi, cvtpd2pi, cvtsd2si, cvtss2si */ + [0x2e] =3D OP(op1, SSE_OPF_CMP | SSE_OPF_SCALAR, + gen_helper_ucomiss, gen_helper_ucomisd, NULL, NULL), + [0x2f] =3D OP(op1, SSE_OPF_CMP | SSE_OPF_SCALAR, + gen_helper_comiss, gen_helper_comisd, NULL, NULL), + [0x50] =3D SSE_SPECIAL, /* movmskps, movmskpd */ + [0x51] =3D OP(op1, SSE_OPF_SCALAR, + gen_helper_sqrtps, gen_helper_sqrtpd, + gen_helper_sqrtss, gen_helper_sqrtsd), + [0x52] =3D OP(op1, SSE_OPF_SCALAR, + gen_helper_rsqrtps, NULL, gen_helper_rsqrtss, NULL), + [0x53] =3D OP(op1, SSE_OPF_SCALAR, + gen_helper_rcpps, NULL, gen_helper_rcpss, NULL), + [0x54] =3D SSE_OP(pand, pand, op1, 0), /* andps, andpd */ + [0x55] =3D SSE_OP(pandn, pandn, op1, 0), /* andnps, andnpd */ + [0x56] =3D SSE_OP(por, por, op1, 0), /* orps, orpd */ + [0x57] =3D SSE_OP(pxor, pxor, op1, 0), /* xorps, xorpd */ [0x58] =3D SSE_FOP(add), [0x59] =3D SSE_FOP(mul), - [0x5a] =3D { gen_helper_cvtps2pd, gen_helper_cvtpd2ps, - gen_helper_cvtss2sd, gen_helper_cvtsd2ss }, - [0x5b] =3D { gen_helper_cvtdq2ps, gen_helper_cvtps2dq, gen_helper_cvtt= ps2dq }, + [0x5a] =3D OP(op1, SSE_OPF_SCALAR, + gen_helper_cvtps2pd, gen_helper_cvtpd2ps, + gen_helper_cvtss2sd, gen_helper_cvtsd2ss), + [0x5b] =3D OP(op1, 0, + gen_helper_cvtdq2ps, gen_helper_cvtps2dq, + gen_helper_cvttps2dq, NULL), [0x5c] =3D SSE_FOP(sub), [0x5d] =3D SSE_FOP(min), [0x5e] =3D SSE_FOP(div), [0x5f] =3D SSE_FOP(max), =20 - [0xc2] =3D SSE_FOP(cmpeq), - [0xc6] =3D { (SSEFunc_0_epp)gen_helper_shufps, - (SSEFunc_0_epp)gen_helper_shufpd }, /* XXX: casts */ + [0xc2] =3D SSE_FOP(cmpeq), /* sse_op_table4 */ + [0xc6] =3D OP(dummy, SSE_OPF_SHUF, (SSEFunc_0_epp)gen_helper_shufps, + (SSEFunc_0_epp)gen_helper_shufpd, NULL, NULL), =20 /* SSSE3, SSE4, MOVBE, CRC32, BMI1, BMI2, ADX. */ - [0x38] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, - [0x3a] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, + [0x38] =3D SSE_SPECIAL, + [0x3a] =3D SSE_SPECIAL, =20 /* MMX ops and their SSE extensions */ - [0x60] =3D MMX_OP2(punpcklbw), - [0x61] =3D MMX_OP2(punpcklwd), - [0x62] =3D MMX_OP2(punpckldq), - [0x63] =3D MMX_OP2(packsswb), - [0x64] =3D MMX_OP2(pcmpgtb), - [0x65] =3D MMX_OP2(pcmpgtw), - [0x66] =3D MMX_OP2(pcmpgtl), - [0x67] =3D MMX_OP2(packuswb), - [0x68] =3D MMX_OP2(punpckhbw), - [0x69] =3D MMX_OP2(punpckhwd), - [0x6a] =3D MMX_OP2(punpckhdq), - [0x6b] =3D MMX_OP2(packssdw), - [0x6c] =3D { NULL, gen_helper_punpcklqdq_xmm }, - [0x6d] =3D { NULL, gen_helper_punpckhqdq_xmm }, - [0x6e] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* movd mm, ea */ - [0x6f] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movq, movdqa,= , movqdu */ - [0x70] =3D { (SSEFunc_0_epp)gen_helper_pshufw_mmx, - (SSEFunc_0_epp)gen_helper_pshufd_xmm, - (SSEFunc_0_epp)gen_helper_pshufhw_xmm, - (SSEFunc_0_epp)gen_helper_pshuflw_xmm }, /* XXX: casts */ - [0x71] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* shiftw */ - [0x72] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* shiftd */ - [0x73] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* shiftq */ - [0x74] =3D MMX_OP2(pcmpeqb), - [0x75] =3D MMX_OP2(pcmpeqw), - [0x76] =3D MMX_OP2(pcmpeql), - [0x77] =3D { SSE_DUMMY }, /* emms */ - [0x78] =3D { NULL, SSE_SPECIAL, NULL, SSE_SPECIAL }, /* extrq_i, inser= tq_i */ - [0x79] =3D { NULL, gen_helper_extrq_r, NULL, gen_helper_insertq_r }, - [0x7c] =3D { NULL, gen_helper_haddpd, NULL, gen_helper_haddps }, - [0x7d] =3D { NULL, gen_helper_hsubpd, NULL, gen_helper_hsubps }, - [0x7e] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movd, movd, ,= movq */ - [0x7f] =3D { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movq, movdqa,= movdqu */ - [0xc4] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* pinsrw */ - [0xc5] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* pextrw */ - [0xd0] =3D { NULL, gen_helper_addsubpd, NULL, gen_helper_addsubps }, - [0xd1] =3D MMX_OP2(psrlw), - [0xd2] =3D MMX_OP2(psrld), - [0xd3] =3D MMX_OP2(psrlq), - [0xd4] =3D MMX_OP2(paddq), - [0xd5] =3D MMX_OP2(pmullw), - [0xd6] =3D { NULL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, - [0xd7] =3D { SSE_SPECIAL, SSE_SPECIAL }, /* pmovmskb */ - [0xd8] =3D MMX_OP2(psubusb), - [0xd9] =3D MMX_OP2(psubusw), - [0xda] =3D MMX_OP2(pminub), - [0xdb] =3D MMX_OP2(pand), - [0xdc] =3D MMX_OP2(paddusb), - [0xdd] =3D MMX_OP2(paddusw), - [0xde] =3D MMX_OP2(pmaxub), - [0xdf] =3D MMX_OP2(pandn), - [0xe0] =3D MMX_OP2(pavgb), - [0xe1] =3D MMX_OP2(psraw), - [0xe2] =3D MMX_OP2(psrad), - [0xe3] =3D MMX_OP2(pavgw), - [0xe4] =3D MMX_OP2(pmulhuw), - [0xe5] =3D MMX_OP2(pmulhw), - [0xe6] =3D { NULL, gen_helper_cvttpd2dq, gen_helper_cvtdq2pd, gen_help= er_cvtpd2dq }, - [0xe7] =3D { SSE_SPECIAL , SSE_SPECIAL }, /* movntq, movntq */ - [0xe8] =3D MMX_OP2(psubsb), - [0xe9] =3D MMX_OP2(psubsw), - [0xea] =3D MMX_OP2(pminsw), - [0xeb] =3D MMX_OP2(por), - [0xec] =3D MMX_OP2(paddsb), - [0xed] =3D MMX_OP2(paddsw), - [0xee] =3D MMX_OP2(pmaxsw), - [0xef] =3D MMX_OP2(pxor), - [0xf0] =3D { NULL, NULL, NULL, SSE_SPECIAL }, /* lddqu */ - [0xf1] =3D MMX_OP2(psllw), - [0xf2] =3D MMX_OP2(pslld), - [0xf3] =3D MMX_OP2(psllq), - [0xf4] =3D MMX_OP2(pmuludq), - [0xf5] =3D MMX_OP2(pmaddwd), - [0xf6] =3D MMX_OP2(psadbw), - [0xf7] =3D { (SSEFunc_0_epp)gen_helper_maskmov_mmx, - (SSEFunc_0_epp)gen_helper_maskmov_xmm }, /* XXX: casts */ - [0xf8] =3D MMX_OP2(psubb), - [0xf9] =3D MMX_OP2(psubw), - [0xfa] =3D MMX_OP2(psubl), - [0xfb] =3D MMX_OP2(psubq), - [0xfc] =3D MMX_OP2(paddb), - [0xfd] =3D MMX_OP2(paddw), - [0xfe] =3D MMX_OP2(paddl), + [0x60] =3D MMX_OP(punpcklbw), + [0x61] =3D MMX_OP(punpcklwd), + [0x62] =3D MMX_OP(punpckldq), + [0x63] =3D MMX_OP(packsswb), + [0x64] =3D MMX_OP(pcmpgtb), + [0x65] =3D MMX_OP(pcmpgtw), + [0x66] =3D MMX_OP(pcmpgtl), + [0x67] =3D MMX_OP(packuswb), + [0x68] =3D MMX_OP(punpckhbw), + [0x69] =3D MMX_OP(punpckhwd), + [0x6a] =3D MMX_OP(punpckhdq), + [0x6b] =3D MMX_OP(packssdw), + [0x6c] =3D OP(op1, SSE_OPF_MMX, + NULL, gen_helper_punpcklqdq_xmm, NULL, NULL), + [0x6d] =3D OP(op1, SSE_OPF_MMX, + NULL, gen_helper_punpckhqdq_xmm, NULL, NULL), + [0x6e] =3D SSE_SPECIAL, /* movd mm, ea */ + [0x6f] =3D SSE_SPECIAL, /* movq, movdqa, , movqdu */ + [0x70] =3D OP(op1i, SSE_OPF_SHUF | SSE_OPF_MMX, + (SSEFunc_0_epp)gen_helper_pshufw_mmx, + (SSEFunc_0_epp)gen_helper_pshufd_xmm, + (SSEFunc_0_epp)gen_helper_pshufhw_xmm, + (SSEFunc_0_epp)gen_helper_pshuflw_xmm), + [0x71] =3D SSE_SPECIAL, /* shiftw */ + [0x72] =3D SSE_SPECIAL, /* shiftd */ + [0x73] =3D SSE_SPECIAL, /* shiftq */ + [0x74] =3D MMX_OP(pcmpeqb), + [0x75] =3D MMX_OP(pcmpeqw), + [0x76] =3D MMX_OP(pcmpeql), + [0x77] =3D SSE_SPECIAL, /* emms */ + [0x78] =3D SSE_SPECIAL, /* extrq_i, insertq_i (sse4a) */ + [0x79] =3D OP(op1, 0, + NULL, gen_helper_extrq_r, NULL, gen_helper_insertq_r), + [0x7c] =3D OP(op1, 0, + NULL, gen_helper_haddpd, NULL, gen_helper_haddps), + [0x7d] =3D OP(op1, 0, + NULL, gen_helper_hsubpd, NULL, gen_helper_hsubps), + [0x7e] =3D SSE_SPECIAL, /* movd, movd, , movq */ + [0x7f] =3D SSE_SPECIAL, /* movq, movdqa, movdqu */ + [0xc4] =3D SSE_SPECIAL, /* pinsrw */ + [0xc5] =3D SSE_SPECIAL, /* pextrw */ + [0xd0] =3D OP(op1, 0, + NULL, gen_helper_addsubpd, NULL, gen_helper_addsubps), + [0xd1] =3D MMX_OP(psrlw), + [0xd2] =3D MMX_OP(psrld), + [0xd3] =3D MMX_OP(psrlq), + [0xd4] =3D MMX_OP(paddq), + [0xd5] =3D MMX_OP(pmullw), + [0xd6] =3D SSE_SPECIAL, + [0xd7] =3D SSE_SPECIAL, /* pmovmskb */ + [0xd8] =3D MMX_OP(psubusb), + [0xd9] =3D MMX_OP(psubusw), + [0xda] =3D MMX_OP(pminub), + [0xdb] =3D MMX_OP(pand), + [0xdc] =3D MMX_OP(paddusb), + [0xdd] =3D MMX_OP(paddusw), + [0xde] =3D MMX_OP(pmaxub), + [0xdf] =3D MMX_OP(pandn), + [0xe0] =3D MMX_OP(pavgb), + [0xe1] =3D MMX_OP(psraw), + [0xe2] =3D MMX_OP(psrad), + [0xe3] =3D MMX_OP(pavgw), + [0xe4] =3D MMX_OP(pmulhuw), + [0xe5] =3D MMX_OP(pmulhw), + [0xe6] =3D OP(op1, 0, + NULL, gen_helper_cvttpd2dq, + gen_helper_cvtdq2pd, gen_helper_cvtpd2dq), + [0xe7] =3D SSE_SPECIAL, /* movntq, movntq */ + [0xe8] =3D MMX_OP(psubsb), + [0xe9] =3D MMX_OP(psubsw), + [0xea] =3D MMX_OP(pminsw), + [0xeb] =3D MMX_OP(por), + [0xec] =3D MMX_OP(paddsb), + [0xed] =3D MMX_OP(paddsw), + [0xee] =3D MMX_OP(pmaxsw), + [0xef] =3D MMX_OP(pxor), + [0xf0] =3D SSE_SPECIAL, /* lddqu */ + [0xf1] =3D MMX_OP(psllw), + [0xf2] =3D MMX_OP(pslld), + [0xf3] =3D MMX_OP(psllq), + [0xf4] =3D MMX_OP(pmuludq), + [0xf5] =3D MMX_OP(pmaddwd), + [0xf6] =3D MMX_OP(psadbw), + [0xf7] =3D OP(op1t, SSE_OPF_MMX, + (SSEFunc_0_epp)gen_helper_maskmov_mmx, + (SSEFunc_0_epp)gen_helper_maskmov_xmm, NULL, NULL), + [0xf8] =3D MMX_OP(psubb), + [0xf9] =3D MMX_OP(psubw), + [0xfa] =3D MMX_OP(psubl), + [0xfb] =3D MMX_OP(psubq), + [0xfc] =3D MMX_OP(paddb), + [0xfd] =3D MMX_OP(paddw), + [0xfe] =3D MMX_OP(paddl), }; +#undef MMX_OP +#undef OP +#undef SSE_FOP +#undef SSE_OP +#undef SSE_SPECIAL + +#define MMX_OP2(x) { gen_helper_ ## x ## _mmx, gen_helper_ ## x ## _xmm } +#define SSE_SPECIAL_FN ((void *)1) =20 static const SSEFunc_0_epp sse_op_table2[3 * 8][2] =3D { [0 + 2] =3D MMX_OP2(psrlw), @@ -2972,6 +3019,8 @@ static const SSEFunc_l_ep sse_op_table3bq[] =3D { }; #endif =20 +#define SSE_FOP(x) { gen_helper_ ## x ## ps, gen_helper_ ## x ## pd, \ + gen_helper_ ## x ## ss, gen_helper_ ## x ## sd, } static const SSEFunc_0_epp sse_op_table4[8][4] =3D { SSE_FOP(cmpeq), SSE_FOP(cmplt), @@ -2982,6 +3031,7 @@ static const SSEFunc_0_epp sse_op_table4[8][4] =3D { SSE_FOP(cmpnle), SSE_FOP(cmpord), }; +#undef SSE_FOP =20 static const SSEFunc_0_epp sse_op_table5[256] =3D { [0x0c] =3D gen_helper_pi2fw, @@ -3023,7 +3073,7 @@ struct SSEOpHelper_eppi { #define SSSE3_OP(x) # x ## _xmm }, \ CPUID_EXT_PCLMULQDQ } #define AESNI_OP(x) { { NULL, gen_helper_ ## x ## _xmm }, CPUID_EXT_AES } @@ -3114,6 +3164,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s= , int b, { int b1, op1_offset, op2_offset, is_xmm, val; int modrm, mod, rm, reg; + int sse_op_flags; SSEFunc_0_epp sse_fn_epp; SSEFunc_0_eppi sse_fn_eppi; SSEFunc_0_ppi sse_fn_ppi; @@ -3129,8 +3180,10 @@ static void gen_sse(CPUX86State *env, DisasContext *= s, int b, b1 =3D 3; else b1 =3D 0; - sse_fn_epp =3D sse_op_table1[b][b1]; - if (!sse_fn_epp) { + sse_op_flags =3D sse_op_table1[b].flags; + sse_fn_epp =3D sse_op_table1[b].op[b1]; + if ((sse_op_flags & (SSE_OPF_SPECIAL | SSE_OPF_3DNOW)) =3D=3D 0 + && !sse_fn_epp) { goto unknown_op; } if ((b <=3D 0x5f && b >=3D 0x10) || b =3D=3D 0xc6 || b =3D=3D 0xc2) { @@ -3184,7 +3237,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s= , int b, reg |=3D REX_R(s); } mod =3D (modrm >> 6) & 3; - if (sse_fn_epp =3D=3D SSE_SPECIAL) { + if (sse_op_flags & SSE_OPF_SPECIAL) { b |=3D (b1 << 8); switch(b) { case 0x0e7: /* movntq */ @@ -3819,7 +3872,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s= , int b, gen_ldq_env_A0(s, op2_offset); } } - if (sse_fn_epp =3D=3D SSE_SPECIAL) { + if (sse_fn_epp =3D=3D SSE_SPECIAL_FN) { goto unknown_op; } =20 @@ -4205,7 +4258,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s= , int b, =20 s->rip_offset =3D 1; =20 - if (sse_fn_eppi =3D=3D SSE_SPECIAL) { + if (sse_fn_eppi =3D=3D SSE_SPECIAL_FN) { ot =3D mo_64_32(s->dflag); rm =3D (modrm & 7) | REX_B(s); if (mod !=3D 3) --=20 2.37.1