From patchwork Sun Nov 5 20:12: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: 741050 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp793151wrr; Sun, 5 Nov 2023 12:13:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHQQxSYzjPtt9Y64DeR1PdsNU0LsBEcA1ioUgih4Lg4BFDyLNKTk8ynja7a/9zHA5GDhBs X-Received: by 2002:a05:622a:2d6:b0:418:d14:1ca0 with SMTP id a22-20020a05622a02d600b004180d141ca0mr33364840qtx.27.1699215234834; Sun, 05 Nov 2023 12:13:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699215234; cv=none; d=google.com; s=arc-20160816; b=QbdRyVBwUvUfamgQ1VNX3JkiA2s40keez8cck7GKto72StnHZsixRJMHdBKHeEudyR mI7rtl6zTFhi0+jDjv8Yf+gWHUIQKD00m9Ju339i2U2UTnO69ARVFEme2gEPKY7L6AZ7 OI7MSTNbLT1iNfWfJ/xqlgB+oYdBonTmRkPJYN06ouWa5Uha4tT/+V+hTKm7hYjOkm+g tQzUruFpYhG53hdOc6vBiBqn0QksqYp0BnrxrPV637gyUGTNJoWIHUOHEBr3qjuW38eL DvrkFNUJdJkkWbEa1aauLpSZU52/j07mGLLCu3Q5F8c25LUWHV6EcvowbhaU1Nd3MONE xt4A== 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=DKj41VweZhjCF7fzIbibfC9ijUJvX4oDkwTltCV+TME=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=JJLCfijJ5Qwk7h7BfrBuNJCqvqN5dZOehs2eq9JxqmrAS5fuzyj5r/nDZQaVjeh+5b LNx65cBYZs+17zhlQTnV3AW8X/l56URBJ9g65xS8LXhu7KZN6PeDHoOCx4sLgGwHiDJZ oEa8fKsGEzsyDwKZ1BCQU2qc606KTpiebwhmJsqrlP8drCkkc1JvBPbEX+2/TyVEw7nj 47js4/Uk3LjGc+nuJjJ9IXN+gOmAuUvd3+ESYkCs3W+ZXoGb1Dhg7oGMrncl2o7P940S EGdgA37zk6d42nLIC9sHLr9sbZozbnMyPqvAMhX8w8ljffagw0WS/RwhTlX3QQ5PSlhh +4og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3CQE2wv; 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 b2-20020ac85bc2000000b00419900396c6si4655930qtb.207.2023.11.05.12.13.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Nov 2023 12:13:54 -0800 (PST) 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=K3CQE2wv; 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 1qzjUB-0003R0-1V; Sun, 05 Nov 2023 15:12:43 -0500 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 1qzjU9-0003PU-7Q for qemu-devel@nongnu.org; Sun, 05 Nov 2023 15:12:41 -0500 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzjU7-0002Ab-KE for qemu-devel@nongnu.org; Sun, 05 Nov 2023 15:12:40 -0500 Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7a956887c20so160798739f.1 for ; Sun, 05 Nov 2023 12:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699215158; x=1699819958; 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=DKj41VweZhjCF7fzIbibfC9ijUJvX4oDkwTltCV+TME=; b=K3CQE2wvFSRpvj1EZTY1UPGO9PeYcdRnw8QlZIs52tSwgcpcZZvswiBuBUCY87ju3M ivLSKhjK7iVpiuCEFOe95K0jRvzUurMonjFzW5DOf14m50s+GN+kD3QmSY67Uy4CErgR /pwgY2/umcxAW1RqBCh5o0Q957IWc7SDeyVeQClINMksO7CAN+tU3l02/W9P8CvjlDMb t3nSvpW2M8u13y5p5OZ6wIe43QfZSKKOu+NqLsP5nCq1T8GfD4r/v0En0b1xNnmb4+n/ O8OsaFtiRarqXY/vOXMrfP9nzzW6Fjv2IvamA0fabEhWt1/sS/Dg5QbpDZQOUc9gOdvc tBdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699215158; x=1699819958; 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=DKj41VweZhjCF7fzIbibfC9ijUJvX4oDkwTltCV+TME=; b=aX8c09phHQcAdZpdULRVIIvafhp8peEYPDiGtorTdOIAlFDnt6rebnf16BhzRuancL cGJPeMZHic718PqZmGx7OiTzc578iPlH09J4bnGy+TGKbUZZ2lbyZQYdkyTyJJKqvOme d+x4UREg8hOMXfUCjQIyLFyDBtXgfFRjmMLIvcqWWb6apfedv8e2JtnLGTaJu3X0YlwN 9Bt46B63FUC2ghQGrWYpOCx2dEwQIty0ULRPcZ4a+49CWmVeZVsLta6lUxPxXx0h+SJK yCU52w3AHqYEGjGicwFx8UXcq5UgSOatZ5MIP6wVPn2wfeXgvfl1B6P8BLB0XBCOeH/B rq4A== X-Gm-Message-State: AOJu0YzNRj3kf3cZQdk/nirv2ZIk7Q+uWHFdYdRTXW0xCFWNYHtZIUaY 7gI5y8Gf2/9ce53eosmNWxAYBB5lh1PyVN4wV6k= X-Received: by 2002:a05:6602:1607:b0:7a9:afab:b984 with SMTP id x7-20020a056602160700b007a9afabb984mr33204503iow.17.1699215158442; Sun, 05 Nov 2023 12:12:38 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id u23-20020a056a00099700b006884549adc8sm4359777pfg.29.2023.11.05.12.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 12:12:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 17/21] target/sparc: Record entire jump condition in DisasContext Date: Sun, 5 Nov 2023 12:12:18 -0800 Message-Id: <20231105201222.202395-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231105201222.202395-1-richard.henderson@linaro.org> References: <20231105201222.202395-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::d32; envelope-from=richard.henderson@linaro.org; helo=mail-io1-xd32.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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) {