From patchwork Sun Oct 22 05:59:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736933 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003587wrl; Sat, 21 Oct 2023 23:03:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKqyGSSBhchg5KzWu2xtAuvoFlUpHJ5sFJZxydyLgeazUZZ5IzMJ/usb6XVo6oKzQklPQw X-Received: by 2002:a05:6358:3413:b0:142:fd2b:da2e with SMTP id h19-20020a056358341300b00142fd2bda2emr7088422rwd.31.1697954624101; Sat, 21 Oct 2023 23:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954624; cv=none; d=google.com; s=arc-20160816; b=jseE7DyAfzYQj5bBYLElwKeDHQ+4AIDTcEDiretioa7k8nyjkjkah3JPE7cKWWTQfn Q2YW4VukdhsEgrNDD+nWqqx7N6PJ/A5pyAdM716OZzoC3euK22+mwkoKdcoTz1KuLxG3 yQ12PAjWIlpthKFTzbjwCoblqW5vgkMH4LPcvGnvfW6Zr4lkaCWToUD1tSSJToY9aqYY zt+YOUtJlBfNvohrIvlpAR74zb0jl7kE5QUO1khW3dVFtT0s4nRLtqrv27LXT+xL/gE9 2ZWbajk2A8v3IitZzGWVCk0wtYg6CosAUe9VIllRYxL613tMjIPWOQkVhwLJ10upH9C4 CLUQ== 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=0bRQOnevKS41xkhrVOREUbtHjCWnHr38sXTFU/ZrPKc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=gy1329hZcid+eK7yvF6tXqB64okSX9lzvH9zk3jUSXw9zR1oSN+UlG0lSUpZ5RtoaO BconjnOGz6j0HCQmaTuJs/IeX3OEvJh5NziHIs4GxU7i5aUEcFy81BDOQUfrEHNG+Vid JC9eDaLMoPN6Qxl9MNvMFfJw2oBbBh/7Fb+sZS01cz9iM4uo7b7qEVaidIWu5YThvExs 6ncPV9ehV17dOYMxwiQEs1HA+Ah760qFZuEChXUlT9ZSXgAVImYWxWe6lvIsrEnG99uH JhX//jN+ps01EPwOs9AVxsgjLyeUtmj9B4xO+u9nCjPm8w2OLq4WxPslXuH9gk0j389+ Su3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j8k/Gltn"; 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 v8-20020ac85788000000b00418079720b3si3841260qta.533.2023.10.21.23.03.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:03:44 -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="j8k/Gltn"; 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 1quRWS-0000fV-Kk; Sun, 22 Oct 2023 02:01:12 -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 1quRWA-0000Zs-RR for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW5-0001Yg-2A for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:54 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d425a2dd0so1924618a91.2 for ; Sat, 21 Oct 2023 23:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954447; x=1698559247; 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=0bRQOnevKS41xkhrVOREUbtHjCWnHr38sXTFU/ZrPKc=; b=j8k/Gltnrx18Xh52I+JBx9eKFY+lRW7bs47IhTRNYbbs2NHkXRt1ESydxxMwhmZnOr Ldc0l2o2Kxfaz9F8RC6gWmN0Vm1eGDsFgfvsIdWFWQ4gSN7SNORva9hcdiHV8iwOvhf5 5WYc0H2kgz/JJqKnazl9TZgvGPhhUpYM83SVih7eaGbNF/wffjvdb5YiVXlbJB9rzl3F u419aKx4XlpduMdJNTzWyLHJcIVhBomXrT8It6jR5+5CFvbuOhTpVn4OQVKuCJfwRsry Sojfa+pZ8kw9JvK36PuGrBaGikACGUteJsVt4rFOhPi5ICFdeeDBSXyLUjtCY3Zo4uoC 5yDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954447; x=1698559247; 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=0bRQOnevKS41xkhrVOREUbtHjCWnHr38sXTFU/ZrPKc=; b=mC4L71ZDgzsykNwgKhBaJUrD0KsVitGwAstiU01JHF+tJohkau206Kvo2Uoyt59YIp LAq+rHDom+XRtVM3wvcWDL/I+P8qo1zOTCGlx9k7oF7dgkY4BHjK4Nq3tVWal0hScO+3 ie3MvWWwfn646aR0GOWC0Cpa1BYPX9UP9peQgbB+0PuYejKxFr2aTBYph/pgXUGsYaAp WgOw9ctg9kByiOuoQvHefFH+U3589CnXEx/nCIcn2saaJ7dDdZEoM1P6cq6imDeyX8gj YzD3hfGw8icKGfhvVRTnaGjBek1bV53Z2lIUNncuAikO7VEGERXopVJxsv038EvxZZAi avEQ== X-Gm-Message-State: AOJu0YzYaotnK2WdHB2dPcOYPpryXsR+gsrHqUyWS+Z5/84ZcY41Hw2t 3gbdc4lSbRDIa6m2m52u4ArcpjbZEafaD5TGRDc= X-Received: by 2002:a17:902:e5c3:b0:1c9:aac5:df1a with SMTP id u3-20020a170902e5c300b001c9aac5df1amr7403875plf.51.1697954447137; Sat, 21 Oct 2023 23:00:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 17/90] target/sparc: Merge gen_branch_[an] with only caller Date: Sat, 21 Oct 2023 22:59:18 -0700 Message-Id: <20231022060031.490251-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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 Signed-off-by: Richard Henderson --- target/sparc/translate.c | 73 +++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b8d51d6d64..503598ed93 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -900,47 +900,6 @@ static void gen_branch2(DisasContext *dc, target_ulong pc1, gen_goto_tb(dc, 1, pc2, pc2 + 4); } -static void gen_branch_a(DisasContext *dc, target_ulong pc1) -{ - TCGLabel *l1 = gen_new_label(); - target_ulong npc = dc->npc; - - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); - - gen_goto_tb(dc, 0, npc, pc1); - - gen_set_label(l1); - gen_goto_tb(dc, 1, npc + 4, npc + 8); - - dc->base.is_jmp = DISAS_NORETURN; -} - -static void gen_branch_n(DisasContext *dc, target_ulong pc1) -{ - target_ulong npc = dc->npc; - - if (npc & 3) { - switch (npc) { - case DYNAMIC_PC: - 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_constant_tl(pc1), cpu_npc); - dc->pc = npc; - break; - default: - g_assert_not_reached(); - } - } else { - dc->pc = npc; - dc->jump_pc[0] = pc1; - dc->jump_pc[1] = npc + 4; - dc->npc = JUMP_PC; - } -} - static void gen_generic_branch(DisasContext *dc) { TCGv npc0 = tcg_constant_tl(dc->jump_pc[0]); @@ -2942,10 +2901,38 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) { + target_ulong npc = dc->npc; + if (annul) { - gen_branch_a(dc, dest); + TCGLabel *l1 = gen_new_label(); + + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + gen_goto_tb(dc, 0, npc, dest); + gen_set_label(l1); + gen_goto_tb(dc, 1, npc + 4, npc + 8); + + dc->base.is_jmp = DISAS_NORETURN; } else { - gen_branch_n(dc, dest); + if (npc & 3) { + switch (npc) { + case DYNAMIC_PC: + 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_constant_tl(dest), cpu_npc); + dc->pc = npc; + break; + default: + g_assert_not_reached(); + } + } else { + dc->pc = npc; + dc->jump_pc[0] = dest; + dc->jump_pc[1] = npc + 4; + dc->npc = JUMP_PC; + } } return true; }