From patchwork Thu Oct 26 00:14:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738244 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556756wrq; Wed, 25 Oct 2023 17:31:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEGoTLTFgFcIFYh7Je/BrkEDKdLZvgAKqpP4FvkNQmHi2YjC+uQOvmn1Esl6h8fOv1pceE X-Received: by 2002:a17:907:2d0a:b0:9b2:bdbb:f145 with SMTP id gs10-20020a1709072d0a00b009b2bdbbf145mr1269625ejc.34.1698280280438; Wed, 25 Oct 2023 17:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280280; cv=none; d=google.com; s=arc-20160816; b=nEsdRsQ9AilI6zw4xq7n1nJev+90A1NWmtri9EaeH3pUuTcmbBoa/Uu/uNoNN50Rn8 EQRpyLwoie277Jt22xs0dko34UgWgYjYy14oo4wGywV9FhmZ68/P02bKf8R0L/GOgeCm hmx+VomZFj5GPLbw7PnwQmThQYpPN68jUltebfnA3EcZ9vRMSu9woF9ISCxpxD3q0K9g lrmLRVl6SgxTU6y3k94Ycmv7KYmOg8fIhMhvIhAzR+Kl5YVDs9LjxN0gxA/y/WLIEJ8q PDRz2v7ZT02n5UqLtLwUIc4AkWruNRpTKF06tvBk+THbQfE4sAp76O7BpPSsuBdnTCa0 aJNQ== 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=Die0E9thWWJCvlQ5xUUN0v+CHdwVm8XQRwC6LlIs3H8=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=o7mqyb6NZyw979tjPx0Pafh2A8DilXyHV8CO7nMT40vzh7HblrE4WUK7VKsBQ21v6C S/OkYdg8d8od1ofzAHLEa8cWHopiY2LRMi2+epaX0C67y33BHQVbA9VixGL8w9CmabVC j1dGEQOuQQFlE8CsYtD2zorlI+n5DGPLqsvcPmqBMSK1n8N2mAqykQSiLTvOdsWnMLb6 NsjtD15gffTHJco3iKTM0wjMEn7t+627l+lZCKstmmZRl74v+TIZJPIRzeB79iB0bTZo CA1bQ951OL95pX8+2StfT7b6fhSgzRSmtsIOJlnsZmJJ5uws5V9WTRsa5H09lNowjmcs KTFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A5XwRmps; 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 17-20020a170906029100b009a5b99ff8adsi5728725ejf.264.2023.10.25.17.31.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:31:20 -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=A5XwRmps; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvo2y-0007LL-DD; Wed, 25 Oct 2023 20:16:24 -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 1qvo2u-0007CJ-RI for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:20 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2p-0004vG-Km for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:20 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1ca3a54d2c4so2280205ad.3 for ; Wed, 25 Oct 2023 17:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279374; x=1698884174; 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=Die0E9thWWJCvlQ5xUUN0v+CHdwVm8XQRwC6LlIs3H8=; b=A5XwRmpsjEPyFLPEB/9X2gZ83oXiKRVKELx6duFkJwn0XQRthmr15g6cllYQPX/0Oa SYMCw6A+oZ5Xa3RQzMyaAQf4ckoMWyvxhg33Bp7hZCCw0r7Gqtb+mH1o/dZ7ZNG8rlgv qpYCgke7GONysd8sZXSHEwy20TJMjwnMGCqymkz2EM9CVznlu/mRtQ9/DY4Ns4MJ4DYs U1H2rMyhCzbz7WDjCGBX3TnatelFZqZA3gyTce8qSzIAJWq3vGOV1F5LOT88z1yA1DxD QnszUnjuHjz05YJ15kfJbAPJwmhPt7attK7o2t40H3HV3/OfCEgPj3StR49EhcqThFba qogw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279374; x=1698884174; 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=Die0E9thWWJCvlQ5xUUN0v+CHdwVm8XQRwC6LlIs3H8=; b=p92Mjfd04Fm45Uikhgc35r/FjBENnvrjXlFXemtODAV8BitVMin2mmCOznmBDKQ3hr DHL7lTFURxQjf8yEQ04mLgvUddEXMJVdrkVDT9E0x2usasRnAjHQISv64BFfXiL+6C/s YsHCeuNT4jZEm32wApcSWD3WNp6Yt83zedBaAU1XOCTZkUBz2Fje52Bl82YLXKz9uzli Dtusqe838u4DKCVuy37rayR168V8xLWalRGxEYi8jkxt1N6MyQS2Fr8OcptzNbeuQ8gs AVpTN3CgNFYQB5Fci81etGKlNdluq0712AKXjccNPhLT3hcdfOIulE0dWoWsM/xoPF9w Hfbg== X-Gm-Message-State: AOJu0YyU6u9KCp+4p1ewiBmcqi6ZF7kJfc9ySeJbPAPVPCksLe+O+zvH kdROJ74UwgaFWCeos9eLR6pcNtgxIpBOjz/F5JU= X-Received: by 2002:a17:903:27d0:b0:1c9:ccb3:2352 with SMTP id km16-20020a17090327d000b001c9ccb32352mr16129432plb.12.1698279374429; Wed, 25 Oct 2023 17:16:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 19/94] target/sparc: Pass DisasCompare to advance_jump_cond Date: Wed, 25 Oct 2023 17:14:16 -0700 Message-Id: <20231026001542.1141412-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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-bounces+patch=linaro.org@nongnu.org Fold the condition into the branch or movcond when possible. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 503598ed93..d12f2b4b87 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2899,14 +2899,15 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, return true; } -static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) +static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, + bool annul, target_ulong dest) { target_ulong npc = dc->npc; if (annul) { TCGLabel *l1 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + tcg_gen_brcond_tl(tcg_invert_cond(cmp->cond), cmp->c1, cmp->c2, l1); gen_goto_tb(dc, 0, npc, dest); gen_set_label(l1); gen_goto_tb(dc, 1, npc + 4, npc + 8); @@ -2919,8 +2920,8 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) case DYNAMIC_PC_LOOKUP: tcg_gen_mov_tl(cpu_pc, cpu_npc); tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, - cpu_cond, tcg_constant_tl(0), + tcg_gen_movcond_tl(cmp->cond, cpu_npc, + cmp->c1, cmp->c2, tcg_constant_tl(dest), cpu_npc); dc->pc = npc; break; @@ -2932,6 +2933,11 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) dc->jump_pc[0] = dest; dc->jump_pc[1] = npc + 4; dc->npc = JUMP_PC; + if (cmp->is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp->c1); + } else { + tcg_gen_setcond_tl(cmp->cond, cpu_cond, cmp->c1, cmp->c2); + } } } return true; @@ -2951,12 +2957,7 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_compare(&cmp, a->cc, a->cond, dc); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -2980,12 +2981,7 @@ static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_fcompare(&cmp, a->cc, a->cond); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -3006,8 +3002,7 @@ static bool trans_BPr(DisasContext *dc, arg_BPr *a) flush_cond(dc); gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } static bool trans_CALL(DisasContext *dc, arg_CALL *a)