From nobody Sun Nov 24 15:52:39 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1722499171; cv=none; d=zohomail.com; s=zohoarc; b=Fzn7pQ820khV5aMoASzVa1wdECSCeC/OP1LuEQdViOcSCmyfJdz28A0iD4ImUyr6I2BZsIL7W4rVMmwESAimkBHtnAjAzpyIXVmK2mDcDPEAB5VelauxRwSY6EO0aRt7tESGy9yYxTbOdW4J0I6dWq/7tzDdnFQWHAbE1obg2pw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722499171; h=Content-Transfer-Encoding:Cc:Cc: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; bh=OtOFpryN5p45NTecQPUgADSe7EdyZv6yuf4iUoGdYsY=; b=H+dedY6k6EK7EKRjWC/aOAFwB+tW6dZddgBGI0U51qKN7l1AwrNK71B5wAM73Uqx/C3LWtMXENUnMgysvkn5Yxsfrn5q+g8XfXc8Qsg1bTB4sx2aUusaQhY3xCe1wT3hxoCEUGC99zB6pudCIaRw8fgz5ypi4SrEjwcyKKdQdCk= 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 1722499171617735.8406873518167; Thu, 1 Aug 2024 00:59:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZQiC-0002yp-FW; Thu, 01 Aug 2024 03:59: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 1sZQiB-0002tq-7a for qemu-devel@nongnu.org; Thu, 01 Aug 2024 03:58:59 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sZQi9-00066j-Bb for qemu-devel@nongnu.org; Thu, 01 Aug 2024 03:58:58 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-7ab09739287so4032321a12.3 for ; Thu, 01 Aug 2024 00:58:56 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7ee148dsm132195755ad.144.2024.08.01.00.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 00:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722499136; x=1723103936; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OtOFpryN5p45NTecQPUgADSe7EdyZv6yuf4iUoGdYsY=; b=WaO8sY4mQk7hFRWdhdAdiVAC0EkdkJdXZtHhWn9gSYplNfe67GLe0E0iz5nFEtHV0w zZY6iWiQJxyNW5MhFxwKBJOHKMvoR9fhZBUZ2ynbHHTh9pEqvpRObkKhR+9ALawvQBM7 7bStpH1DmrkuWJxDoiYIXOrKL9JH85h5DMBimidldCTpX9ZYtOibWrINaa+VmeILpeK8 qmc0zprZnLAA/I+NayfK4ICDRFml40OX+zoG5VclGIS+J6byRpnWF6nYoCE/xAMkeiI8 UpszWod2RByicONrkjCJHgKWsmjfBUrpm1lqD/cu1nfy7gSJlC10SkV7wwCJO4CMCGKE dy5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722499136; x=1723103936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OtOFpryN5p45NTecQPUgADSe7EdyZv6yuf4iUoGdYsY=; b=xVCEoQrpd/IuGnrWh2nhtXe2SJbefq0td+kHSCEw9SW4y8De/vemwuq2R5rxCfVM2I TdyPMa1s3yEiyi2k2caA71eFIQDFZWos56rjLL/tcZDau3d6Z1AUNcungGR/XN+SJ5Ji InI97dwnTc2Ku/gjertOdTBGrt08hes5emjtWFpPv4OB4ES1fPt2rrmeCg4j4GlAw4oc yURwPG1ywIQJOtHfVw0IjnTYnBIC2fPmgRHHLsIWXnk1STzBa5nC+sir7q+7MA5ixOIQ tI1hpIdxiSdvXPO3cjI4n87qlRG7P5tdLbdRhOZkmW7rYUr+3dfdJpkCJ1EeWre24njB 1c3g== X-Gm-Message-State: AOJu0Yz+7+akIz42Zvf2LJzW6Mq9+3Ax4pYTABpJv09UcAklyk8h9NHO W+p7IgJjB5r5Wk6hzayvniQ9kmM+ffTBhNAhhZFN2G5hjDPQr8EJ0ICwsnMBahHJbBtUir1SzuR DfW3W8Q== X-Google-Smtp-Source: AGHT+IHEW0Wfepqox45QrZeYKkEpa9nifERVt7/0luIBoJNxBNlikXOU5p5nJH1l3YPR6kSVtXzYnQ== X-Received: by 2002:a05:6a20:c70b:b0:1c4:a49b:403 with SMTP id adf61e73a8af0-1c68d23fc64mr2026758637.46.1722499135559; Thu, 01 Aug 2024 00:58:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH 1/2] target/i386: Split out gen_prepare_val_nz Date: Thu, 1 Aug 2024 17:58:44 +1000 Message-ID: <20240801075845.573075-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801075845.573075-1-richard.henderson@linaro.org> References: <20240801075845.573075-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @linaro.org) X-ZM-MESSAGEID: 1722499171978116600 Content-Type: text/plain; charset="utf-8" Split out the TCG_COND_TSTEQ logic from gen_prepare_eflags_z, and use it for CC_OP_BMILG* as well. Prepare for requiring both zero and non-zero senses. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/tcg/translate.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 95bad55bf4..e62ffa2858 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -865,6 +865,18 @@ static CCPrepare gen_prepare_sign_nz(TCGv src, MemOp s= ize) } } =20 +static CCPrepare gen_prepare_val_nz(TCGv src, MemOp size, bool eqz) +{ + if (size =3D=3D MO_TL) { + return (CCPrepare) { .cond =3D eqz ? TCG_COND_EQ : TCG_COND_NE, + .reg =3D src }; + } else { + return (CCPrepare) { .cond =3D eqz ? TCG_COND_TSTEQ : TCG_COND_TST= NE, + .imm =3D MAKE_64BIT_MASK(0, 8 << size), + .reg =3D src }; + } +} + /* compute eflags.C, trying to store it in reg if not NULL */ static CCPrepare gen_prepare_eflags_c(DisasContext *s, TCGv reg) { @@ -908,8 +920,7 @@ static CCPrepare gen_prepare_eflags_c(DisasContext *s, = TCGv reg) =20 case CC_OP_BMILGB ... CC_OP_BMILGQ: size =3D s->cc_op - CC_OP_BMILGB; - gen_ext_tl(cpu_cc_src, cpu_cc_src, size, false); - return (CCPrepare) { .cond =3D TCG_COND_EQ, .reg =3D cpu_cc_src }; + return gen_prepare_val_nz(cpu_cc_src, size, true); =20 case CC_OP_ADCX: case CC_OP_ADCOX: @@ -1006,12 +1017,7 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *= s, TCGv reg) default: { MemOp size =3D (s->cc_op - CC_OP_ADDB) & 3; - if (size =3D=3D MO_TL) { - return (CCPrepare) { .cond =3D TCG_COND_EQ, .reg =3D cpu_c= c_dst }; - } else { - return (CCPrepare) { .cond =3D TCG_COND_TSTEQ, .reg =3D cp= u_cc_dst, - .imm =3D (1ull << (8 << size)) - 1 }; - } + return gen_prepare_val_nz(cpu_cc_dst, size, true); } } } --=20 2.43.0