From patchwork Sat Oct 1 14:09:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 611364 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp223874pvb; Sat, 1 Oct 2022 07:28:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46KN0YgPzGPShV3rhnZb4Yy1b9YbS/BP6OyzwOKQNdIA0/WrnNGPFjzzt/DdJ0FT7eB7H+ X-Received: by 2002:ac8:5e08:0:b0:35c:b97b:8b23 with SMTP id h8-20020ac85e08000000b0035cb97b8b23mr10742372qtx.585.1664634507623; Sat, 01 Oct 2022 07:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664634507; cv=none; d=google.com; s=arc-20160816; b=L/fpLUUl/kUg2kTRUIXERX7oM8g+rTNRSTDtKWL6WbsHjytdmvfj4Xt/TS8Lj4o1Pe wWDpMySJSqSi0j8/+dW/gAOhbHBGdzosgQoYBOppMGE0pGhyU0RW4SMhKnufgtj3GEAU C1E0s3jiMKoch9X2WwvceO+1CQSLmoxJ2jGtWWgWyloZ+K3iJR9zafiPxZZSfwQj0bfS +4fQvuao8lBMwITyVex+SZZSAOmypCRcGKl8boVJG8qPLUk7v8d42BlBq4tcUKB6k1ye drYBjOUFb4nGlCLSB6B6Wg2JdINg6TpcXIVpExcopHyUZFiqJgS95Kyxp5p1q97O47C7 TmUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rhU6prNr5k+kysecBHvIxaXnfM3j+gbXRvuZ+nCGy2U=; b=SyMHJyS+JcrHOoaf9r90Iiyum9EfdKGdl8q8Jxr2rIftZhTC7ZEvkfx+qP8DqqZzG8 FiEJv+WTm5rbPpi+XIZpnnti6zBI94ka6OJPuVxs+rV/GsCIdz4bgNVpsn0wlG0TNv5N 3gDE8oYyewPdD/OvftE98U64i7mL2ZYAHS4yAMhUsLuLxB/qyxSyAMnWFUzs5SXu1fGS 2JVgZhNLa3ARBH5duuqi/yZSEtezsgL4o4RkbwAy/jMDCKeU2qc5TmoVXTjxniYvNHGi dpCKU/vHM38dN7VhtQ3X0CaGLoxnULFq+XHbdf6DdB+19HgT+w8oD77AVdn3n9Ud0CmK TadA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VATeLhGC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 22-20020ac85616000000b0034377464502si2658127qtr.566.2022.10.01.07.28.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Oct 2022 07:28:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VATeLhGC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oedTf-00057x-53 for patch@linaro.org; Sat, 01 Oct 2022 10:28:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oedCR-0003Jc-ER for qemu-devel@nongnu.org; Sat, 01 Oct 2022 10:10:39 -0400 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]:43700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oedCK-0004Gt-JO for qemu-devel@nongnu.org; Sat, 01 Oct 2022 10:10:39 -0400 Received: by mail-qk1-x734.google.com with SMTP id o7so4408084qkj.10 for ; Sat, 01 Oct 2022 07:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=rhU6prNr5k+kysecBHvIxaXnfM3j+gbXRvuZ+nCGy2U=; b=VATeLhGCm6uzxT6B/S0CPTrKdtJ0mJtBEZA3KDFiAmDgnWQyqYMF+4/Q//H8YiiAFG e/EY4TU/Rux1mnpmrQtkr2xKqVZzwcbC1yVfmUXg00hwM07Lrbcdwdcq4NrNFqjCAhsj lFzms2mbSg3aXt4/lwB95kAJfRtD6o0XL/TyWBfpNrS97uPN8NMQbyWtUeQGwJMD3WTq tI71Nv7FXLqarNVaBQVRfO9/EmKraP+su7blMRUBT+46D01DrJG8SFbZB0d2d+kNtwOF RfMJrmQxf2E0lxemJipZBwqbGOGn3dwAL8GjZ/usWsAPOeezcorrcNScNSxfS2/+DZNN Bu/w== 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 :subject:date; bh=rhU6prNr5k+kysecBHvIxaXnfM3j+gbXRvuZ+nCGy2U=; b=LimsWtXsRTGzOfK8b32rqdsChPW/BG631BadlAD1D1AA/jhRvWQCDG9YgBuL9mwlk/ /jqk7qrxgGYRKnerH/35yEzcKTG6DkadoaWxGuBSArZ4+h8oTQ7+i2coEB5muV74z8JM uxD86ZmFRyQxguUj7Vy71K1shjGG+W/jN5G4KvIHrk31wqrxRB0EO00bof3e+TPIZB9A ZZbhfQUhGZwiToX2cZ+QiXV9DeqAq5Q4LliXTvjKSSZt52UGOgh/bSmENSzqHoBm2JlO baH93+cCWjKe7ABbwx5Qh2hfNmGkWrYrl8EkYaSpgOmORJCIFJWAN67o6Sj7ZzYf6kvw q/xg== X-Gm-Message-State: ACrzQf1bSufMHe82RfeL5AzBYkvRpJRA27B/ZSsl+oX/kAvgXdKdOzkN 3a+lsGAqcdMWL4MNhgRPlEIE+Ikw9QzvQ7FI X-Received: by 2002:a37:a982:0:b0:6cf:6de9:1bee with SMTP id s124-20020a37a982000000b006cf6de91beemr9339301qke.423.1664633430713; Sat, 01 Oct 2022 07:10:30 -0700 (PDT) Received: from stoup.. ([2605:ef80:8080:8162:afc7:8362:2616:ac15]) by smtp.gmail.com with ESMTPSA id j16-20020a05620a289000b006b615cd8c13sm6075914qkp.106.2022.10.01.07.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 07:10:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH v3 21/26] target/i386: Remove MemOp argument to gen_op_j*_ecx Date: Sat, 1 Oct 2022 07:09:30 -0700 Message-Id: <20221001140935.465607-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221001140935.465607-1-richard.henderson@linaro.org> References: <20221001140935.465607-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x734.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These functions are always passed aflag, so we might as well read it from DisasContext directly. While we're at it, use a common subroutine for these two functions. Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index cf23ae6e5e..9294f12f66 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -676,20 +676,21 @@ static void gen_exts(MemOp ot, TCGv reg) gen_ext_tl(reg, reg, ot, true); } -static inline -void gen_op_jnz_ecx(DisasContext *s, MemOp size, TCGLabel *label1) +static void gen_op_j_ecx(DisasContext *s, TCGCond cond, TCGLabel *label1) { tcg_gen_mov_tl(s->tmp0, cpu_regs[R_ECX]); - gen_extu(size, s->tmp0); - tcg_gen_brcondi_tl(TCG_COND_NE, s->tmp0, 0, label1); + gen_extu(s->aflag, s->tmp0); + tcg_gen_brcondi_tl(cond, s->tmp0, 0, label1); } -static inline -void gen_op_jz_ecx(DisasContext *s, MemOp size, TCGLabel *label1) +static inline void gen_op_jz_ecx(DisasContext *s, TCGLabel *label1) { - tcg_gen_mov_tl(s->tmp0, cpu_regs[R_ECX]); - gen_extu(size, s->tmp0); - tcg_gen_brcondi_tl(TCG_COND_EQ, s->tmp0, 0, label1); + gen_op_j_ecx(s, TCG_COND_EQ, label1); +} + +static inline void gen_op_jnz_ecx(DisasContext *s, TCGLabel *label1) +{ + gen_op_j_ecx(s, TCG_COND_NE, label1); } static void gen_helper_in_func(MemOp ot, TCGv v, TCGv_i32 n) @@ -1183,7 +1184,7 @@ static TCGLabel *gen_jz_ecx_string(DisasContext *s) { TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - gen_op_jnz_ecx(s, s->aflag, l1); + gen_op_jnz_ecx(s, l1); gen_set_label(l2); gen_jmp_rel_csize(s, 0, 1); gen_set_label(l1); @@ -1286,7 +1287,7 @@ static void gen_repz(DisasContext *s, MemOp ot, * before rep string_insn */ if (s->repz_opt) { - gen_op_jz_ecx(s, s->aflag, l2); + gen_op_jz_ecx(s, l2); } gen_jmp_rel_csize(s, -cur_insn_len(s), 0); } @@ -1306,7 +1307,7 @@ static void gen_repz2(DisasContext *s, MemOp ot, int nz, gen_update_cc_op(s); gen_jcc1(s, (JCC_Z << 1) | (nz ^ 1), l2); if (s->repz_opt) { - gen_op_jz_ecx(s, s->aflag, l2); + gen_op_jz_ecx(s, l2); } gen_jmp_rel_csize(s, -cur_insn_len(s), 0); } @@ -7397,16 +7398,16 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) case 0: /* loopnz */ case 1: /* loopz */ gen_op_add_reg_im(s, s->aflag, R_ECX, -1); - gen_op_jz_ecx(s, s->aflag, l2); + gen_op_jz_ecx(s, l2); gen_jcc1(s, (JCC_Z << 1) | (b ^ 1), l1); break; case 2: /* loop */ gen_op_add_reg_im(s, s->aflag, R_ECX, -1); - gen_op_jnz_ecx(s, s->aflag, l1); + gen_op_jnz_ecx(s, l1); break; default: case 3: /* jcxz */ - gen_op_jz_ecx(s, s->aflag, l1); + gen_op_jz_ecx(s, l1); break; }