From patchwork Wed Nov 1 04:11:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 740055 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp97592wrv; Tue, 31 Oct 2023 21:16:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEC3/eZpD1P3gWjm9t+8tSkvvBbG+t7LzykcMChU76WbxRiXPqpzFbNOhQOQ06LrrCiWf4+ X-Received: by 2002:a05:622a:40d:b0:419:7e82:9190 with SMTP id n13-20020a05622a040d00b004197e829190mr18918338qtx.31.1698812179932; Tue, 31 Oct 2023 21:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698812179; cv=none; d=google.com; s=arc-20160816; b=fOnWP3CoR4WfYXNESAyVx+V3O9LtBt5Z7UR1gUjBrEY/R+6Zb7QR58hzpcVyX/D8DR 5DxE1qM6RDSkdJtQ6UKfCBoprMaZgPq5OxmYi9iuTUV9+eKxDxYQCQIZ2PvSIQi97Knk VpCmqLB5XO0tVfiYKRkh8WLc4rDO2kRlcP2sZD/DIXzpQ8/FsZE8tVJsTsAcdJ5z3gkw af9TsinW9nXrB33c1WrG/EyNW/jVMbu8GvjOleag99TFILMf53oQ78vw3NfFquX2Yr+9 8Pu8nNaHxYmOHxsX4EDw+ZUWj09HYZ4m3VC73sHhO7bOAQgc21rAnYYEwztx56lfg2N6 1vhg== 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=xk5ZwxYX86AmAacGdCPjwS66WTpS6fUcE9+XR+Lw5Gc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=eb5CaK+rYN9q7pH2EJ7U41hR0Qr70TL8O7CJPznJaLNIe5R6dw2xjZLgX9scaZL3Xa qSa46MkV3FM3vSDPABjIkcUJ9+PKr67tZUifo7PXnVBliJq3LgT3awMGzrVquspkcwkO EWchjxaGLFyT+LO0YRtw01dwXqXM7MgX/gDI5nkpBPJhpMUYr/DmoaPjG1AVBUYkE+07 NfftbLi5yxqZckYf47PO+1IDdldkDoztW/j2Iig6VOeyntFPlcSAZLGXPW+dBynyQ7wZ rauKwB9xkQ066I+NtJNlOUKq4gJTCjgO85O0x8S8+eW7K89XDpgyjBZ76dQCD37Y4Ut9 q9fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RyqS5Aap; 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 a6-20020a05622a064600b0041962d20ecasi2391683qtb.90.2023.10.31.21.16.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Oct 2023 21:16:19 -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=RyqS5Aap; 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 1qy2aC-0005yf-M9; Wed, 01 Nov 2023 00:11:56 -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 1qy2a7-0005xi-Kk for qemu-devel@nongnu.org; Wed, 01 Nov 2023 00:11:52 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qy2a5-0007Zx-SH for qemu-devel@nongnu.org; Wed, 01 Nov 2023 00:11:51 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6b201a93c9cso5341240b3a.0 for ; Tue, 31 Oct 2023 21:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698811908; x=1699416708; 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=xk5ZwxYX86AmAacGdCPjwS66WTpS6fUcE9+XR+Lw5Gc=; b=RyqS5Aap0tZvqCRHYiboVGLq0NUkk/MUhTaLvpPQ+Bdeblssz1tiy6ruAmlxaPdRLP T9Zt0TMs1WryQG1Yyxkpmtnz2LFFtRyOl909HEgphvbbMRqquwstxhh1nQJndLsucqcq i2hf1oORmawWsW8GEODItHXy6kSGeu27eBdSr91kQNftLWsWkwbUV5EyntC3ANG7v3fo VANR5vHnbO0JBUtexiANZCxT5TTvmHPODmFvZl1M9AYqUvg+Kb2zV/plHJRyIwfacz9/ F+AH7twnK/l6elrbURE5DM2AgEwYnPHCzD/Io9H4x8uY/YCN3wwqlytQ9oczI4Bocb7Y 3+Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698811908; x=1699416708; 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=xk5ZwxYX86AmAacGdCPjwS66WTpS6fUcE9+XR+Lw5Gc=; b=p7NhgSeU39OVu01T4J+kURRBpg0cUxfHMUNRru2o+j1uMuV9KHuIlHp8YvKSO4rvB9 BVqhuJ+FOtrVu4OvWy3S31AcsC54lHxwhGDuBS11Al+ItYNZVP4FTbJFC/vsCS4yugkl 7mi9oRAb0p7O8oP0nj0es+pFW++hCWXc5eLvls60k73VqFc5XXK8XS37zW7+/eBN1ZSa hy+LgvMDbbf+3pkz0SGF4shqIDycURD1HMm9QHic+IwJH7smL+/n0glgrCaQ4nuvHiwS KARQ2dyyzfPMmwU0R+hf0grE/e7HU5UZiJ/a5V0kpiBvll4yXh6Psde6LgGkHEnruePs alRw== X-Gm-Message-State: AOJu0Yz4k5nFkyvjAvVGfZ63+A/x6enL9f61auggq2lDtcRV4URNYUwZ 7Mtuc4qRVQ65xvO+IZJ9nUnfGv3Ko9oGIwH1cUM= X-Received: by 2002:a05:6a00:22c5:b0:6b2:5d32:58c with SMTP id f5-20020a056a0022c500b006b25d32058cmr12919126pfj.22.1698811908418; Tue, 31 Oct 2023 21:11:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id k8-20020aa79728000000b006875df4773fsm359576pfg.163.2023.10.31.21.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 21:11:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 17/21] target/sparc: Record entire jump condition in DisasContext Date: Tue, 31 Oct 2023 21:11:28 -0700 Message-Id: <20231101041132.174501-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101041132.174501-1-richard.henderson@linaro.org> References: <20231101041132.174501-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Use the original condition instead of consuming cpu_cond, which will now only be live along exception paths. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 0bbe4cff3b..5c9a3d45fa 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -146,6 +146,12 @@ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; # define env64_field_offsetof(X) ({ qemu_build_not_reached(); 0; }) #endif +typedef struct DisasCompare { + TCGCond cond; + TCGv c1; + int c2; +} DisasCompare; + typedef struct DisasDelayException { struct DisasDelayException *next; TCGLabel *lab; @@ -159,7 +165,11 @@ typedef struct DisasContext { DisasContextBase base; target_ulong pc; /* current Program Counter: integer or DYNAMIC_PC */ target_ulong npc; /* next PC: integer or DYNAMIC_PC or JUMP_PC */ - target_ulong jump_pc[2]; /* used when JUMP_PC pc value is used */ + + /* Used when JUMP_PC value is used. */ + DisasCompare jump; + target_ulong jump_pc[2]; + int mem_idx; bool fpu_enabled; bool address_mask_32bit; @@ -178,12 +188,6 @@ typedef struct DisasContext { DisasDelayException *delay_excp_list; } DisasContext; -typedef struct { - TCGCond cond; - TCGv c1; - int c2; -} DisasCompare; - // This function uses non-native bit order #define GET_FIELD(X, FROM, TO) \ ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1)) @@ -912,9 +916,9 @@ static void gen_generic_branch(DisasContext *dc) { TCGv npc0 = tcg_constant_tl(dc->jump_pc[0]); TCGv npc1 = tcg_constant_tl(dc->jump_pc[1]); - TCGv zero = tcg_constant_tl(0); + TCGv c2 = tcg_constant_tl(dc->jump.c2); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, cpu_cond, zero, npc0, npc1); + tcg_gen_movcond_tl(dc->jump.cond, cpu_npc, dc->jump.c1, c2, npc0, npc1); } /* call this function before using the condition register as it may @@ -2347,7 +2351,7 @@ static bool advance_pc(DisasContext *dc) case JUMP_PC: /* we can do a static jump */ l1 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cond, 0, l1); + tcg_gen_brcondi_tl(dc->jump.cond, dc->jump.c1, dc->jump.c2, l1); /* jump not taken */ gen_goto_tb(dc, 1, dc->jump_pc[1], dc->jump_pc[1] + 4); @@ -2434,9 +2438,10 @@ static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, } } else { dc->pc = npc; + dc->npc = JUMP_PC; + dc->jump = *cmp; dc->jump_pc[0] = dest; dc->jump_pc[1] = npc + 4; - dc->npc = JUMP_PC; /* The condition for cpu_cond is always NE -- normalize. */ if (cmp->cond == TCG_COND_NE) {