From nobody Tue Feb 10 01:32:52 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=1712681438; cv=none; d=zohomail.com; s=zohoarc; b=L+NWyuYCRVrCKexGDqfm0MOJ7iSJQaOIPDxOBME7CSLeD9ojSPv65JBqDgSNabuPnwhk5jG3+Mo8GfYP72RjmNwqclEHQGnNwrAQF1WC9QJLKHv4Oa/Ub9Ln7qVBcpnUwofxSbb/2HLXmTOouXsnEB1Yn/YrYtxLnoJZqZxrO/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712681438; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=3dBjfULU0sDr337Hpo9NybkNaRsnBMREB60wbOp5+4s=; b=ZL4fS1zkhI4FRcy4MnTHXEQhnecjIVrU02Ix9/+6kFvosOSNMhQ2QWKgcAMJ+ER9L6qbHXDH5TgnacrOAHfT5HYoQNixJQwrWfQYrkXHv9IDtnRD1OD7RG6i3q64tuJXr2E02TmsW25m+G3rK5q+Ud+/s8/Nr948JNjqY6muJ6s= 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 1712681438719699.4619912566391; Tue, 9 Apr 2024 09:50:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruEai-0001AF-E1; Tue, 09 Apr 2024 12:45:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruEa9-0000eG-7m for qemu-devel@nongnu.org; Tue, 09 Apr 2024 12:44:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruEZz-00086f-TU for qemu-devel@nongnu.org; Tue, 09 Apr 2024 12:44:22 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-J7rRhDCjOh2rHNxbw46I4g-1; Tue, 09 Apr 2024 12:44:04 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-416ac21981dso4592025e9.1 for ; Tue, 09 Apr 2024 09:44:04 -0700 (PDT) Received: from avogadro.local ([151.95.152.232]) by smtp.gmail.com with ESMTPSA id p14-20020a05600c358e00b0041674bf7d4csm7851084wmq.48.2024.04.09.09.44.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 09:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712681048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3dBjfULU0sDr337Hpo9NybkNaRsnBMREB60wbOp5+4s=; b=KuqhP/qbDw6CH9lcVQ1RyVQpe1m7bfrEqJPdUBXSATHQ4SfCVnaIkpBnHtlvaXqZJSB3kz KygiRMClSJQ1DqZ8rW04YKq7nPMJ2W1y1SbbFHkQnAn4OcIaq+AkWiVgf2HPxKi5utPVnL foQVK9HxFbY4UHKR++XsDPdfHzMvTtQ= X-MC-Unique: J7rRhDCjOh2rHNxbw46I4g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712681043; x=1713285843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3dBjfULU0sDr337Hpo9NybkNaRsnBMREB60wbOp5+4s=; b=RPVy7H35mG68OCaBe5BXFQ48SuGAUPr5Ja+WQVIWuPE163DusUN8ejoduyUsiIhcL9 VMb2mwYxUZatOhxSOWrp652Zqo9apiR1dvOEMjnZ6APlRtaJLAclbo37lfsMs+FXSW0+ 3DEYYQrVQOcvrPYZFC9yozCDBP+mbxPXWE+6IVJ0qlQ17aBlDXSgS9XP4r7EXJ9owX1m okSZAbZAEFd/bM3PLS4XrcCpWQctw5YOjI83fvsQmRWdQzXmY7pfS0w85QOEwlRmtUKD F3FMlj6f9Vc1FRVLG0sTGZrHqFbMGqlyXB5yJXvmVQrLh9ilzJHo4pz1RvQPnAWsBBBG /5Tw== X-Gm-Message-State: AOJu0Yycu9zTm701JmDcqsJVVe4pS4cyFL4Q/CBXEhKUv+IQA0bIG8oe GsLAOSui4p4mU4CV5z4xH9VKvVPMfYeKDZnmmL02s2+Y4R/jwBKkcAtSbaOq1aUCkvY9j7doIJq uvQ8wfdqEPzUMkAYYuo7fjPJQQI44h+AWmPMgESfpqXJdggij0KlIdaPcIM8Nbci7GlDhQgppEQ E/ZchwLnf7l7h1sOnF2KGUI807YUalBhMJRsh3 X-Received: by 2002:a05:600c:4748:b0:416:2674:1938 with SMTP id w8-20020a05600c474800b0041626741938mr2857646wmo.15.1712681043056; Tue, 09 Apr 2024 09:44:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZ+44dp/Q4EGhHP+Mcxv1+Zq4yiOiyKIXBr3JvlcW69FFI3hkowXBHdyu4HdBi6a1iJLd09A== X-Received: by 2002:a05:600c:4748:b0:416:2674:1938 with SMTP id w8-20020a05600c474800b0041626741938mr2857627wmo.15.1712681042637; Tue, 09 Apr 2024 09:44:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH for-9.1 13/19] target/i386: move remaining conditional operations to new decoder Date: Tue, 9 Apr 2024 18:43:17 +0200 Message-ID: <20240409164323.776660-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240409164323.776660-1-pbonzini@redhat.com> References: <20240409164323.776660-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.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.701, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1712681440176100001 Content-Type: text/plain; charset="utf-8" Move long-displacement Jcc, SETcc and CMOVcc to the new decoder. While filling in the tables makes the code seem longer, the new emitters are all just one line of code. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/decode-new.h | 1 + target/i386/tcg/translate.c | 2 +- target/i386/tcg/decode-new.c.inc | 56 ++++++++++++++++++++++++++++++++ target/i386/tcg/emit.c.inc | 10 ++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/target/i386/tcg/decode-new.h b/target/i386/tcg/decode-new.h index 77bb31eb143..cd7ceca21e8 100644 --- a/target/i386/tcg/decode-new.h +++ b/target/i386/tcg/decode-new.h @@ -106,6 +106,7 @@ typedef enum X86CPUIDFeature { X86_FEAT_AVX2, X86_FEAT_BMI1, X86_FEAT_BMI2, + X86_FEAT_CMOV, X86_FEAT_CMPCCXADD, X86_FEAT_F16C, X86_FEAT_FMA, diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 26e4c7520db..f3c437aee88 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -3209,7 +3209,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) #ifndef CONFIG_USER_ONLY use_new &=3D b <=3D limit; #endif - if (use_new && 0) { + if (use_new && (b >=3D 0x138 && b <=3D 0x19f)) { disas_insn_new(s, cpu, b); return true; } diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 87ae63faf9a..36eb53515af 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -993,6 +993,15 @@ static const X86OpEntry opcodes_0F[256] =3D { /* Incorrectly listed as Mq,Vq in the manual */ [0x17] =3D X86_OP_ENTRY3(VMOVHPx_st, M,q, None,None, V,dq, vex5 p_00_= 66), =20 + [0x40] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x41] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x42] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x43] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x44] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x45] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x46] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x47] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x50] =3D X86_OP_ENTRY3(MOVMSK, G,y, None,None, U,x, vex7 p_00_66= ), [0x51] =3D X86_OP_GROUP3(sse_unary, V,x, H,x, W,x, vex2_rep3 p_00_66_= f3_f2), /* sqrtps */ [0x52] =3D X86_OP_GROUP3(sse_unary, V,x, H,x, W,x, vex4_rep5 p_00_f3)= , /* rsqrtps */ @@ -1020,6 +1029,24 @@ static const X86OpEntry opcodes_0F[256] =3D { [0x76] =3D X86_OP_ENTRY3(PCMPEQD, V,x, H,x, W,x, vex4 mmx avx2_256= p_00_66), [0x77] =3D X86_OP_GROUP0(0F77), =20 + [0x80] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x81] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x82] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x83] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x84] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x85] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x86] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x87] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + + [0x90] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x91] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x92] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x93] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x94] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x95] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x96] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x97] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x28] =3D X86_OP_ENTRY3(MOVDQ, V,x, None,None, W,x, vex1 p_00_6= 6), /* MOVAPS */ [0x29] =3D X86_OP_ENTRY3(MOVDQ, W,x, None,None, V,x, vex1 p_00_6= 6), /* MOVAPS */ [0x2A] =3D X86_OP_GROUP0(0F2A), @@ -1032,6 +1059,15 @@ static const X86OpEntry opcodes_0F[256] =3D { [0x38] =3D X86_OP_GROUP0(0F38), [0x3a] =3D X86_OP_GROUP0(0F3A), =20 + [0x48] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x49] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x4a] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x4b] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x4c] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x4d] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x4e] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x4f] =3D X86_OP_ENTRY2(CMOVcc, G,v, E,v, cpuid(CMOV)), + [0x58] =3D X86_OP_ENTRY3(VADD, V,x, H,x, W,x, vex2_rep3 p_00_66_= f3_f2), [0x59] =3D X86_OP_ENTRY3(VMUL, V,x, H,x, W,x, vex2_rep3 p_00_66_= f3_f2), [0x5a] =3D X86_OP_GROUP0(0F5A), @@ -1057,6 +1093,24 @@ static const X86OpEntry opcodes_0F[256] =3D { [0x7e] =3D X86_OP_GROUP0(0F7E), [0x7f] =3D X86_OP_GROUP0(0F7F), =20 + [0x88] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x89] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x8a] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x8b] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x8c] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x8d] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x8e] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + [0x8f] =3D X86_OP_ENTRYr(Jcc, J,z_f64), + + [0x98] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x99] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x9a] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x9b] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x9c] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x9d] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x9e] =3D X86_OP_ENTRYw(SETcc, E,b), + [0x9f] =3D X86_OP_ENTRYw(SETcc, E,b), + [0xae] =3D X86_OP_GROUP0(group15), =20 [0xc2] =3D X86_OP_ENTRY4(VCMP, V,x, H,x, W,x, vex2_rep3 p_= 00_66_f3_f2), @@ -1917,6 +1971,8 @@ static bool has_cpuid_feature(DisasContext *s, X86CPU= IDFeature cpuid) switch (cpuid) { case X86_FEAT_None: return true; + case X86_FEAT_CMOV: + return (s->cpuid_features & CPUID_CMOV); case X86_FEAT_F16C: return (s->cpuid_ext_features & CPUID_EXT_F16C); case X86_FEAT_FMA: diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 07f9b506043..dc5142be51f 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1375,6 +1375,11 @@ static void gen_CMC(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) tcg_gen_xori_tl(cpu_cc_src, cpu_cc_src, CC_C); } =20 +static void gen_CMOVcc(DisasContext *s, CPUX86State *env, X86DecodedInsn *= decode) +{ + gen_cmovcc1(s, decode->b & 0xf, s->T0, s->T1); +} + static void gen_CMPccXADD(DisasContext *s, CPUX86State *env, X86DecodedIns= n *decode) { TCGLabel *label_top =3D gen_new_label(); @@ -3270,6 +3275,11 @@ static void gen_SCAS(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode) } } =20 +static void gen_SETcc(DisasContext *s, CPUX86State *env, X86DecodedInsn *d= ecode) +{ + gen_setcc1(s, decode->b & 0xf, s->T0); +} + static void gen_SHA1NEXTE(DisasContext *s, CPUX86State *env, X86DecodedIns= n *decode) { gen_helper_sha1nexte(OP_PTR0, OP_PTR1, OP_PTR2); --=20 2.44.0