From patchwork Sat May 4 15:39:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 794623 Delivered-To: patch@linaro.org Received: by 2002:adf:a453:0:b0:34e:ceec:bfcd with SMTP id e19csp189903wra; Sat, 4 May 2024 08:40:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXOLOqY+7mnKK8aSy3lN++gdXvuoOo6KL/dc/CGnCWdb7aiTm+S03X2cpBMY9qa+hMwChfbtvmHHJmJFectfE73 X-Google-Smtp-Source: AGHT+IEIPk5HYUW3kM25hzhHSe4O5pNEFfK467YcsKEr80WKldA56GHcJ+kRFTkt5Zse7yLoPIxt X-Received: by 2002:ac8:5849:0:b0:43a:e5c6:b70b with SMTP id h9-20020ac85849000000b0043ae5c6b70bmr5736821qth.31.1714837219297; Sat, 04 May 2024 08:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714837219; cv=none; d=google.com; s=arc-20160816; b=UcsCaEllBAAbTu7RUv3uG53WYeK8zdJTU0pUazL++h5ukm2aLNahTTV1gulHp4YMBQ 0qolDThyDWDi1TMrtjGt76FSgVgOTp76F8Aq5AMiqRTi2PWR+q84kLOO0tsrGdf7VVCB 2bZ3Q48dZtEw/SgRNOGS5SzY9f9/3h7ZEBlfX3nJMRNxF7EmWN89DPxz8T2s8N1SOi5G 9VoAkvVYql9yLaQCaItBnUPFBXqC5c8gIfUr4yWBxalEehw1KxfsxHbf6cfy/pEljZQj bqEow0xoEC/4/4Xx/KJtoelKobzSnWKXxv+J/YJnOmpqZ/lzxvtsK7+biSnpzj03gi5U QvTQ== 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=xVVPRKrlT2Orc69ECKDjPxn2WVFASwuWViHwTTTKVCk=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=AhaYhsImEzi+sV+rWkBzToXFdrhEBj0MYfhXPCQHxsPuyZqVt45fvMCWK3DY6haE4G DSefctjGBcK9Dx51+X5DxSVgNkAv9nO36fkWzVUzpf1lkdVNcfaCrMuRxFuoREJ5D8rv CEaST9zJbsUvdvBbWLUMZN7/qIA9T4CF8Bd+mPZ3yfvBpyMt2mtZRdbvg+eLPs+rAXni 4HlaDMEwI197xFLi0gAJipPhx/ILyRZ1bFDC8H0VrHSvYNMLOEPdvExIHUGvB9D6YlKv YIxwzOv/YGQ0bmP2Lj5RBDGXjUORDc4a4IqlRC9jTnD2dBqw55mTqzeR+SyovK9FlzFf aLsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nEFYmN6s; 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 ea14-20020a05622a5b0e00b0043ade35ba8fsi2560960qtb.791.2024.05.04.08.40.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 May 2024 08:40: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=nEFYmN6s; 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 1s3HUC-000257-5x; Sat, 04 May 2024 11:39:40 -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 1s3HUA-00023s-4m for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:38 -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 1s3HU8-0006F9-GP for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:37 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1ed96772f92so2966305ad.0 for ; Sat, 04 May 2024 08:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837175; x=1715441975; 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=xVVPRKrlT2Orc69ECKDjPxn2WVFASwuWViHwTTTKVCk=; b=nEFYmN6suGlspSM4JCvNYyhkb3fNpxI5zTZ/jYa5reAahd54c/PCWlfqSI0qXEH6Te TZP18y2rd/W3hNol1UOXeCK6FU06DRjCeuljpTqHf2ms7NFjdmXOp1Dg3P19+LxPTCVJ uE7TiNJNHqhfoPIFJJGl6ntyGD008mQXKRIBmJfIU+Xd9wlY+9E9hNvGSFtTm0ZWm0eN BJ3mc//eAx2fXwgGDhH/OwXkhREbK3yim4k3UPPfkyaMC1Jry2x+W36s2UuC2TwhVI+v QjEV0Xwh3MaFe/53tLRLYiYQGFBMZc9PYx9PAFm275ZTg2Qr1dQpzzFhVBymxvkRIoO3 AFdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837175; x=1715441975; 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=xVVPRKrlT2Orc69ECKDjPxn2WVFASwuWViHwTTTKVCk=; b=afgRejoqQSPeeBsoh6L0tX5tsgMppJGvyeQDljltzomKlVazfZw6Ce4VxIJ1pMw74o 3QZw6DQUGjMvgUFo/oavPvv7bcLyBU359jhuekWRwRC4sRHQpDALyhywXn8Ar/MPcytw zKGu20CffUf//+JbeQLvNO9HbLtRAsIXRPkudWwkLWDj5/2aYTAL03z+NbEzCp81hVjL 8vHwRAqvXHOaE2anG0O9Ig3GpGbIxuiuG8+pajYptP6YGMfhTcwnOU4R4srPg91ukefA Q38VLe08swqTS4Yo7FNZ3XCv1cD5SfelzWKEUn0sy6Wc0Uce2XC9lwQpJStXgI9WiHQo OnkA== X-Gm-Message-State: AOJu0YyLiIJqA+kQZrcxKW9kokpM6wB48AsrYrgjn8e/V8BJJt2TPCEV JkYYhJIDJq3bMs4UwmE58+j3/90TrzE/AFcQkm+yR4OGwOiYCW6NqmEHYZtXUkqrXj9O/trfv3W v X-Received: by 2002:a17:903:228e:b0:1eb:51a4:3685 with SMTP id b14-20020a170903228e00b001eb51a43685mr6776336plh.52.1714837174794; Sat, 04 May 2024 08:39:34 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b001e4d22f828fsm5197859plf.33.2024.05.04.08.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 7/9] target/alpha: Split out gen_goto_tb Date: Sat, 4 May 2024 08:39:24 -0700 Message-Id: <20240504153926.357845-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240504153926.357845-1-richard.henderson@linaro.org> References: <20240504153926.357845-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 Signed-off-by: Richard Henderson Message-Id: <20240424234436.995410-4-richard.henderson@linaro.org> [PMD: Split bigger patch, part 5/5] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240503072014.24751-8-philmd@linaro.org> --- target/alpha/translate.c | 53 ++++++++++++---------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index b7b94cc378..c1a55e5153 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -425,15 +425,22 @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb, return DISAS_NEXT; } -static bool use_goto_tb(DisasContext *ctx, uint64_t dest) +static void gen_goto_tb(DisasContext *ctx, int idx, int32_t disp) { - return translator_use_goto_tb(&ctx->base, dest); + uint64_t dest = ctx->base.pc_next + disp; + + if (translator_use_goto_tb(&ctx->base, dest)) { + tcg_gen_goto_tb(idx); + tcg_gen_movi_i64(cpu_pc, dest); + tcg_gen_exit_tb(ctx->base.tb, idx); + } else { + tcg_gen_movi_i64(cpu_pc, dest); + tcg_gen_lookup_and_goto_ptr(); + } } static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) { - uint64_t dest = ctx->base.pc_next + disp; - if (ra != 31) { tcg_gen_movi_i64(ctx->ir[ra], ctx->base.pc_next); } @@ -442,43 +449,19 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) if (disp == 0) { return DISAS_NEXT; } - - if (use_goto_tb(ctx, dest)) { - tcg_gen_goto_tb(0); - tcg_gen_movi_i64(cpu_pc, dest); - tcg_gen_exit_tb(ctx->base.tb, 0); - } else { - tcg_gen_movi_i64(cpu_pc, dest); - tcg_gen_lookup_and_goto_ptr(); - } - + gen_goto_tb(ctx, 0, disp); return DISAS_NORETURN; } static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, TCGv cmp, uint64_t imm, int32_t disp) { - uint64_t dest = ctx->base.pc_next + disp; TCGLabel *lab_true = gen_new_label(); tcg_gen_brcondi_i64(cond, cmp, imm, lab_true); - if (use_goto_tb(ctx, ctx->base.pc_next)) { - tcg_gen_goto_tb(0); - tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); - tcg_gen_exit_tb(ctx->base.tb, 0); - } else { - tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); - tcg_gen_lookup_and_goto_ptr(); - } + gen_goto_tb(ctx, 0, 0); gen_set_label(lab_true); - if (use_goto_tb(ctx, dest)) { - tcg_gen_goto_tb(1); - tcg_gen_movi_i64(cpu_pc, dest); - tcg_gen_exit_tb(ctx->base.tb, 1); - } else { - tcg_gen_movi_i64(cpu_pc, dest); - tcg_gen_lookup_and_goto_ptr(); - } + gen_goto_tb(ctx, 1, disp); return DISAS_NORETURN; } @@ -2922,12 +2905,8 @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) case DISAS_NORETURN: break; case DISAS_TOO_MANY: - if (use_goto_tb(ctx, ctx->base.pc_next)) { - tcg_gen_goto_tb(0); - tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); - tcg_gen_exit_tb(ctx->base.tb, 0); - } - /* FALLTHRU */ + gen_goto_tb(ctx, 0, 0); + break; case DISAS_PC_STALE: tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); /* FALLTHRU */