From patchwork Sat Oct 21 05:30:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736608 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632026wrl; Fri, 20 Oct 2023 22:33:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjelM2Dm8ZB3TqTNBn8Pj22LzZNpliKhuE7Kf9ionFcS+X02L8Tn/VI3bgHCsxFx3ZTpaP X-Received: by 2002:a05:620a:28c3:b0:774:16fc:65e0 with SMTP id l3-20020a05620a28c300b0077416fc65e0mr4009217qkp.12.1697866404850; Fri, 20 Oct 2023 22:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866404; cv=none; d=google.com; s=arc-20160816; b=l2vf05uznT4Fl9Sh1D4jHBT6sJmyoa5LRPXyXqWQRttE+5MsquuFqCm59z9YcyekrP cSbJtEuQ5sTn9akDce0AapkJX+y8nKttnesQ9M2pelmSe5R8C944c33mKVWEvQRcx0w5 1UBRdGYEL1CrvyAAS5mE+/DI3DFdGlTXeDsJMJw1QyRNGBS+fIitzleCDAbZwexhe6Nl FD2VivoLtoGAKXpuAyuW65wXMyMxDsgvuL/Gcamx2alBgMMgIsU5x4dh3/e5rGn5mDWI Zl0lI3c4z2KQeuBBG+VQ+/+Szm50WN+bLNrwXtaKI8q5jGDgVaxMftH+O+NCB16ieX05 nwcw== 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=0MpjSEFfHuzfoWKCOMuh7dwx3IwqBorGEqJ4QZDa9I7OtNbH4P33EAKGX4MYnR0XyH YX9uFqXg5xr2B+Lvgbj85T+YmXFMX6vj45sAhcU/L3YTD8g7sev/kqchJHhItEgKFsA2 XTYrvU4+Vf53LC3zK0b4lPxt5+WDleJF9ThgX8cc4nROixjqLMeKjJlqhahZYWknmkdP A+lfqgW3ijqfVhCnBnnkTD2ykXKS87ztPI/0Q+rG1iT0tSOnXx8CSDbYHXYINGPzH1SU 7J0M4u7HHl2rPbbVmjBl+GqINRxaJefr1n4J3DVFIQ/HEK71dbqOqvkMkVbFk5eTf8cB A9oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k6ByhLGI; 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 q15-20020ae9e40f000000b0077742712562si2345264qkc.335.2023.10.20.22.33.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33:24 -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=k6ByhLGI; 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 1qu4bD-0007Hr-Ab; Sat, 21 Oct 2023 01:32:35 -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 1qu4av-0007BQ-2K for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:17 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4at-0008PH-GH for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:16 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1e9c9d181d6so1103903fac.0 for ; Fri, 20 Oct 2023 22:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866334; x=1698471134; 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=k6ByhLGIJjfbJV9LVDTIeMPrOyFVYGUchUGylXo8xSRjs2T5zfIxkOq2CBVqZtmc/U ScB0SdEcU67zIUUrON/k0BXmCg+CpCbBPNpnJpBDZ+4oOJ5gJFbPjRASuewI7E2MsnGN v9oGAx58ebna1Cha8PPM2yieBekKGkzLzlldDQyYgYMfqUQQ/vgvLMjVqmxKsCmBrOAD QjYC8yUIfXZ0V4g3/cZVIt/7U+aqmelMqPVFCDVXHiKC86m5lpNIdkUHc0/sKt5782w2 TMUCuFiw1ChnfVlh4eCcEjBDH1a1MDwZYFnyyVtpe9CRAoy+MRj6Zg5Jm5AbXcnCQObo Cckg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866334; x=1698471134; 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=tN7sznl8lG3hoDBRjcI0UCLj8dp79E7OJJDgIQHQpaX30gCiG8rUskhLqKGgKc9arG HfmLaLzc/rjBsKD4fMyVwg9HZlRRPax/5wKGQLf7+rwGV8V8qZavDcGiXS0hlxAgXHP5 7xLRVLb1Wb71vGcTTI7OXHtQG4AqT3Mw2+UUQC09KSzGApaQ+ROmeZRBqzh5RkniEIXS pD4Ok0MvU5XnDJcxiRPTLyaD6DoSZ8ItUIikXZWv/yTNSlijSI+MD5sIb5aHRnWW6IZb PueqcnWbuzY1njIPPxTAAgC81/+06gtmC5khxYK0U9FLJjvFL6hgTzx+ndmLTdH30Srh GjZg== X-Gm-Message-State: AOJu0Yw1LAMuaBCFbXtqR5DFqs5ann7kfVmAdfyQrFwf9begDHSlnWfq C/9tT11Cj1zeI1RxY007UMA38eFMFm8kIgfpUjM= X-Received: by 2002:a05:6870:1254:b0:1e9:dd69:2fc1 with SMTP id 20-20020a056870125400b001e9dd692fc1mr3952699oao.7.1697866334116; Fri, 20 Oct 2023 22:32:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 17/90] target/sparc: Merge gen_branch_[an] with only caller Date: Fri, 20 Oct 2023 22:30:45 -0700 Message-Id: <20231021053158.278135-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x31.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; }