From patchwork Fri May 3 07:20:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 794357 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp609656wrr; Fri, 3 May 2024 00:21:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSm1oBuyEQLdlA3PO4MPq0mDfmzDHUkMVKew7T+M++mnjzr762ht7F4v/2bU5h2JIV5cpsMka6Mty5xk6vS7aN X-Google-Smtp-Source: AGHT+IHhbuctOF25gpRj0JCKBrkyxfCcfHuh5OikkxAwU7NGhyBzGVJ0chmUIWdxuoUaPH6V6lW6 X-Received: by 2002:a05:6214:d63:b0:6a0:c117:372e with SMTP id 3-20020a0562140d6300b006a0c117372emr2073296qvs.12.1714720880752; Fri, 03 May 2024 00:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714720880; cv=none; d=google.com; s=arc-20160816; b=QyFSyKIJE7BuQ/S1dCpnmgKma+7qKefYcbZTIoz5cehs0vbjV+pH0szZfYmQrBN6+L V4ad1i4pg0ovaTRKV9ATIsxO3TfcR0QZhtmyUlIwfOhkqfM0QChxmExeUTHfA8A+vjeT aUKUDFN6cgp5ufzSv8yArDGPxQaMoiBrR7+ebhhW8+alt+uDXn6dvPn9V9z+Db1UVJvL X1ax4Rl7GFovg9IRxvIdvkDmmu9o77Vn0/KGkuW/l4tHNv+WxB1IHVhpkY/BpBQ7lW46 IJefD46+Gsmw3FWja2soye9zW8qvy1Q14yz3tGj0X+QmTfFwu5myfA9B0Na0CiThCQOp 0mIg== 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=0lknL/ATTWgGI9RKDIzgYaRoy5BVwYjHb6qLBuptERQ=; fh=ZXDWg7hKG7Hj19AbRuutTLw+Zvn/B9RsGUUw/YagpFI=; b=ZjQJZSJC2GsqKCuHKrKh/oBX+y45CJ5MthJ7tCRIvjz3vF3eB5h90CI6Y6TzFNc1Ke fHnvQoC0zoHyJBsZacIy+QhRKG+JVqUKVY6QAN3drinFa6lyohlrf6Ye/PY5Mx07sDFg K55jlOSKbIN38W9QKxC6UZdO75J3NYCv8RuMwX8picfKq01ZJsKs8miXx4rtUDaabP9x wkDDr1sMdUyhjwzcCBVc3qQkNxzGdJLO42OX5KVtTkwAd3th5oZ50RoYvtLmrcBfzMai 94oRGrlHG+k6ChYSYkMlgZiU6Aqf/tRohEb72E45IJdpQ+1zl8Tank7y72PKhQKdABEh jZ7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gmvnklvd; 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 jf12-20020a0562142a4c00b006a0ac1c3c9esi2681054qvb.105.2024.05.03.00.21.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 May 2024 00:21:20 -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=gmvnklvd; 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 1s2nEE-0001UO-UW; Fri, 03 May 2024 03:21:11 -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 1s2nE4-0001MI-Cb for qemu-devel@nongnu.org; Fri, 03 May 2024 03:21:00 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nE2-0001NK-JX for qemu-devel@nongnu.org; Fri, 03 May 2024 03:21:00 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41bab13ca81so69549705e9.1 for ; Fri, 03 May 2024 00:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720856; x=1715325656; 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=0lknL/ATTWgGI9RKDIzgYaRoy5BVwYjHb6qLBuptERQ=; b=gmvnklvdSRHj6/8v0Sb0sTrGwiHc7V3WW4ZV4sryBYOXiuMsF2k0Cq8C7JzhBsy/S+ pwocgyPTrREP40MkSVAF36bXzWt8l9Z5GwEC+LZhXpfpiJzNffRVmhe06xhe1+yDP7H9 l50nVb2hsc587MpNiVjBJBo0A4vjmJ0rvHqYljI/myLRqB0sVngZt374QZUxlHR3IIIB KkdEWdI5A9ewxHOph6pB7Y4kQxTPazDOFLsneUa36EFaV8YzKP+aqbiWoLX5HPfZ3YYB 0U2l1SLdBLbAXRwWkeAdjEoHGK8zswmJncYrmXs4JftHV7FnlD0sGAMwd31nSgc1Yx5G WNug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720856; x=1715325656; 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=0lknL/ATTWgGI9RKDIzgYaRoy5BVwYjHb6qLBuptERQ=; b=m6GgDUCkE7cM0sInLTCCgfKlek/PR4a/4Tw2jwkG5jksnFsMpaPR7pRqIUSmtsiFdi HGPSKTdrViZ/z61+5SSuhkQ8STjO8xJp57dQJ8D1kJIaY6KfC+0KuUkZfyVjFlE9czvC ArCgH4Ll3SVNJ8F5Y3Hrs6v/OjPEGWIrI1b/9Wa1l4Puc8vmcbVroSdAkrhzXVuDJBni P/qE6vIXllUcjUKMmvPAMQ0UdrOJ+L/+RNKIpy2pN9cAwsux9WgD4mG6ze/EhG1cFTtI rO44AzapfI8aaBrzkpjq96kXcv/JusTXxfxqLmfGcDKhI5tMHs5tk4kRnlBuctaFpvFp RI+A== X-Gm-Message-State: AOJu0Yw+j7hJE5G0CVVxwioicOvwiaFg6dFY4wj+X4+brEUdKaip3I7o /pjp8Kd0qVtrFve9NlktWPuv/q5QeJOZ863mr5UHPalax8yHBz97bUkI6rMYIW7yEZpfUPaawfY H X-Received: by 2002:a05:600c:1d0a:b0:41b:fa34:9e48 with SMTP id l10-20020a05600c1d0a00b0041bfa349e48mr1849850wms.30.1714720856215; Fri, 03 May 2024 00:20:56 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id o3-20020a05600c4fc300b0041aa570bcd3sm8383822wmq.35.2024.05.03.00.20.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH v2 7/9] target/alpha: Split out gen_goto_tb Date: Fri, 3 May 2024 09:20:11 +0200 Message-ID: <20240503072014.24751-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240503072014.24751-1-philmd@linaro.org> References: <20240503072014.24751-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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 From: Richard Henderson 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é --- target/alpha/translate.c | 51 +++++++++++++--------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 079bd5d3fd..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,41 +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); - } - /* FALLTHRU */ + 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; } @@ -2920,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 */