From patchwork Fri May 3 07:20:05 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: 1930937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=dcYmfF/E; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2Jj5Gqdz20fb for ; Fri, 3 May 2024 17:20:37 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nDY-0000mz-J3; Fri, 03 May 2024 03:20:28 -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 1s2nDW-0000mW-JX for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:26 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nDU-0001Ev-Rj for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:26 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41dc9c83e57so9514845e9.0 for ; Fri, 03 May 2024 00:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720822; x=1715325622; 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=oukcdiVQUJdJhgIgSZBe2+14jjl41PU9P9dpGWfTjTk=; b=dcYmfF/EtOphQuIq3jWxJ4YtudV6e9gc1wVOLZUax7vj+JMabRayq4zCf2rGDUFita jUzjy/iREpX0tU6pJ1XXlKYLCol3kVXa1+Dlv+wvnbLRlquwDB7Zj163FYEZIm2YTy9S tPC4BSxU2Fn9jeJJPuzLdc21j2KTLSPjCLaKdKKzSDFDVFe6oSZcutl5AgL7aJ3mBno2 m0o9nPUDJFPZeJeqpIZ9BdPoS10NgmPrXzbv65haxukKaLRLW7ZXtQII2IwqA7OTZw7t Sx+IE95540L3saj0RxjEUmZ4RjKyAj/wZ83ScvwY+N4KoqGvb/BCoIWBE8mbP3J14EEX MlmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720822; x=1715325622; 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=oukcdiVQUJdJhgIgSZBe2+14jjl41PU9P9dpGWfTjTk=; b=noPATPhO+EKAVJbSjBCcqf3hF9Y/YfPmhUrjMBv6lM2ZuTd2XX2bJfNvb0y4cTvzu/ XZJaH5TlAX73gNNqWRhDVtJVmuiS+iA70FGg8hBwBtes26lcoE7ae8+RjKCSWiSh/sQe v9S/spyB5utKxoYOcw5Iga+ZIe31YBuv7DL4Vq2yuv0+n8rjCMJxGnlG32yFANUCP/WU CvbZlRhBwIN9hX7RuEQSPy5KZH1Gl/juGbmPtRwV6Nt/b/svgY/0U+f55noL5AlCE0mF Zz7kpmHDOGz3mFnkWMKz7cigiJ6XxZA6RDvP01C7kNJUpawB949ogalKUdPF3VXojJUK O8dQ== X-Gm-Message-State: AOJu0YwuWyvd1FEv2Loek9lUVsoiyqGwiQcs0mAfrrkX0NwIv7kSBf68 Q9lSkE2Xr+qEyD2TzlWXNxcW0c7UBC+WPhVvU422VlREmgYyYNWyAiLdQOxkQMZhQ0edKeqUzKm K X-Google-Smtp-Source: AGHT+IF+yYBvz2+rAu6snEmmeAWQ6Kp5GRIEJzmeLgwZY24GezuB4EMpbDefaeDlz25DADJNsrIHGw== X-Received: by 2002:a05:600c:4508:b0:417:eb5d:281b with SMTP id t8-20020a05600c450800b00417eb5d281bmr4361515wmo.17.1714720822399; Fri, 03 May 2024 00:20:22 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id s7-20020a05600c384700b0041c12324eb6sm8377191wmr.22.2024.05.03.00.20.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:21 -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 1/9] target/alpha: Use cpu_env in preference to ALPHA_CPU Date: Fri, 3 May 2024 09:20:05 +0200 Message-ID: <20240503072014.24751-2-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson ALPHA_CPU has a dynamic object type assert, which is unnecessary considering that these are all class hooks. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/cpu.c | 15 ++++++--------- target/alpha/helper.c | 8 ++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 05f9ee41e9..f98d022671 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -28,25 +28,22 @@ static void alpha_cpu_set_pc(CPUState *cs, vaddr value) { - AlphaCPU *cpu = ALPHA_CPU(cs); - - cpu->env.pc = value; + CPUAlphaState *env = cpu_env(cs); + env->pc = value; } static vaddr alpha_cpu_get_pc(CPUState *cs) { - AlphaCPU *cpu = ALPHA_CPU(cs); - - return cpu->env.pc; + CPUAlphaState *env = cpu_env(cs); + return env->pc; } static void alpha_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb, const uint64_t *data) { - AlphaCPU *cpu = ALPHA_CPU(cs); - - cpu->env.pc = data[0]; + CPUAlphaState *env = cpu_env(cs); + env->pc = data[0]; } static bool alpha_cpu_has_work(CPUState *cs) diff --git a/target/alpha/helper.c b/target/alpha/helper.c index d6d4353edd..c5e4958f8b 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -124,7 +124,7 @@ void alpha_cpu_record_sigsegv(CPUState *cs, vaddr address, MMUAccessType access_type, bool maperr, uintptr_t retaddr) { - AlphaCPU *cpu = ALPHA_CPU(cs); + CPUAlphaState *env = cpu_env(cs); target_ulong mmcsr, cause; /* Assuming !maperr, infer the missing protection. */ @@ -155,9 +155,9 @@ void alpha_cpu_record_sigsegv(CPUState *cs, vaddr address, } /* Record the arguments that PALcode would give to the kernel. */ - cpu->env.trap_arg0 = address; - cpu->env.trap_arg1 = mmcsr; - cpu->env.trap_arg2 = cause; + env->trap_arg0 = address; + env->trap_arg1 = mmcsr; + env->trap_arg2 = cause; } #else /* Returns the OSF/1 entMM failure indication, or -1 on success. */ From patchwork Fri May 3 07:20:06 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: 1930945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=DkBYiH55; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2Ky10HQz213v for ; Fri, 3 May 2024 17:21:42 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nDe-0000ny-MB; Fri, 03 May 2024 03:20:34 -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 1s2nDb-0000nY-Km for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:32 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nDa-0001Fy-1m for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:31 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41b9dff6be8so48346885e9.3 for ; Fri, 03 May 2024 00:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720828; x=1715325628; 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=8EARN2QjxHRUGZxuseUERnN42PxuL4o+f6Wcb9HZQWs=; b=DkBYiH557yNNBU1cotc8JpNpaREkjGKuyovslqu4gVAOZLLVc4sXZSnA46nPUYBGGF 4R5FnnwwhR51DjYORFyXOciN43ktEC5dw2DNcxZYSct9tWTar8QJ6vmaInD4mfdxGbqU dR13LAykaXvpQd6yhC67bd9XZRYGPiO2jXVZwVkKGERbokV/tbTai+JBIV3cnEeiNid3 dwE2jmU4fjSXGG0/s+E7aPgDCcUin10hAOz6Q8LBDGYFo5I/9D2S6XRtbb4P88bToJPT Lzdwm5/vXvxD/0+vXlv9NOVoZPEmLHjXsBdCAZb6RTXjyrKCSMiIKSuOx70v82cNuGiN pE2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720828; x=1715325628; 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=8EARN2QjxHRUGZxuseUERnN42PxuL4o+f6Wcb9HZQWs=; b=dNVo81QxGIXD8I03FObKCmWTUlarLNmU1t1t8mZd0/7D8j2YwEsHpUUfq7gxcdy8L2 1NTQ8ZZ3cTZc1BgGcz72PEWy5iU5Rb8N8JSPk25JQss1aJY7+wCEMJJX7IqZ3g6to4JV ISV/MvpzlAEDnY0HQMXb5GbyJFPc4L+pjv6YNp4c0bG2AqnNTqbrL4WkRzqRfMrhPXLZ hn0I3W+88YtEQcO0nbEIE3cENYLYK8zJrY0RuIjjSKFT4LPOVli0Tr743MEewVsptE5O qIN4oasGJWNiJdzFftrrXPosCRg8L+/jJT9Ui9m4nJV3yWOH5R1B3CD3P+ydG6cCFkdk qhUw== X-Gm-Message-State: AOJu0YztDfOp74P7dtKLTdzQzgacl8A4RAXjqc66j66/OmZon6m7KA5l qlMCFUiepGYIbtmsnVVWzO6BncvGnIFgdLFeDvPLv/2wkGHxq5f1XJGBjDN3WRNuATk1HFpz8s0 X X-Google-Smtp-Source: AGHT+IFzLqFgruACRlcbDgcsiCs1HBQ1o2MXbo9y9xLlQcvYxrbyTRVociy5pDtUOjIDzGGeAMGJTw== X-Received: by 2002:a05:600c:35c8:b0:41e:1bc1:36de with SMTP id r8-20020a05600c35c800b0041e1bc136demr764642wmq.26.1714720828030; Fri, 03 May 2024 00:20:28 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id bd13-20020a05600c1f0d00b0041c012ca327sm4557609wmb.45.2024.05.03.00.20.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:27 -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 2/9] target/alpha: Hoist branch shift to initial decode Date: Fri, 3 May 2024 09:20:06 +0200 Message-ID: <20240503072014.24751-3-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index a97cd54f0c..52c2e6248b 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -432,7 +432,7 @@ static bool use_goto_tb(DisasContext *ctx, uint64_t dest) static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) { - uint64_t dest = ctx->base.pc_next + (disp << 2); + uint64_t dest = ctx->base.pc_next + disp; if (ra != 31) { tcg_gen_movi_i64(ctx->ir[ra], ctx->base.pc_next); @@ -455,7 +455,7 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) 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 << 2); + uint64_t dest = ctx->base.pc_next + disp; TCGLabel *lab_true = gen_new_label(); if (use_goto_tb(ctx, dest)) { @@ -1382,7 +1382,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) real_islit = islit = extract32(insn, 12, 1); lit = extract32(insn, 13, 8); - disp21 = sextract32(insn, 0, 21); + disp21 = sextract32(insn, 0, 21) * 4; disp16 = sextract32(insn, 0, 16); disp12 = sextract32(insn, 0, 12); From patchwork Fri May 3 07:20:07 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: 1930939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wDtQuuOq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2KB0dtdz20fb for ; Fri, 3 May 2024 17:21:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nDl-0000vy-Kj; Fri, 03 May 2024 03:20:41 -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 1s2nDg-0000qc-WE for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:37 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nDf-0001Jv-Fy for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:36 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41bab13ca4eso47319245e9.1 for ; Fri, 03 May 2024 00:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720833; x=1715325633; 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=NsUohuRZS7qAWRTP4Ddk/BzlIY+4ubmA4ImrHbv8aR0=; b=wDtQuuOqJM0npisIlpNYTH+InvckwZLRz1xOeD0vGVuUCAmK1ttuDmLUS7Xs+kquXO clOdj6QUBPGc+i/2ZjdKSo87hAAOguXmltknGOZ2HoSFkKOcDTnMVzSF9sn7/S1a5sXZ J5uqT8iqqhwygFoBahDQoF5XhKm+XvXzTKaZz5r0YwWzW9s5NP1q9piqr5js1MqsdnUF T5Ial6H1jUjH2hniSk/VrWx3C/MgYPNCcgMV/6haKgPGmFfwY6UMuzclUZZh/3xifcig jVfAKVsGvKQpDcIO3+4Du6ozz87RMOcNXU/m0++X05e+u6FHGVbewNoExYiVyvj5KKym naEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720833; x=1715325633; 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=NsUohuRZS7qAWRTP4Ddk/BzlIY+4ubmA4ImrHbv8aR0=; b=YuZuGWIQLB9FWBSxMMdA6siyhyBAEc2z8royL4WJPKYMDMZCux0KGeSuIld5Ra0Iga JOCvaNyLiYhGLChG3wWSGaaqXzH/diIPfSJouMGbKUv5km3y/vJoc+qwqWl/tOEFUK5b +c16S2DVxPkp0oaZMQNB9Rj+PB/ETrkaFy5QP/BJI5MAd8iVBP7uMhdk0JRjTYeveOoH 6Mysp5FnXR18gYVwUfUjrdDV4CnkjWteLQ2o0k3QrlN1R0XNi6CuGpIIcjOx53eU3ffb +KNdVxu9VuoZViBt5+xBN2R+Ue6wh6pDda9cv6AB684e9B3VXS7d9k7AQh7PdxRxed0a qe1w== X-Gm-Message-State: AOJu0Yxghya53lZMft36vC9KlzPQ3Vc/0OjOWuYMd3RBjYpaKt4WqX4G AosHOSlnPi2mFMkjdXjzxGfPbDwn8tg9K0wGz6RxjP3J5y135aB+yWuc2MiCboLpYiR/tHibRZM H X-Google-Smtp-Source: AGHT+IGGTxiOEu9QkkOju77VfPTN6btJoBaOvWPRgotA53tTtRDavLH0FimYCkTGSjRL+cheVmLh/A== X-Received: by 2002:a05:600c:5118:b0:41a:34c3:2297 with SMTP id o24-20020a05600c511800b0041a34c32297mr1356974wms.5.1714720833657; Fri, 03 May 2024 00:20:33 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id c7-20020a05600c0a4700b0041ba0439a78sm8317697wmq.45.2024.05.03.00.20.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:33 -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 3/9] target/alpha: Use DISAS_NEXT definition instead of magic '0' value Date: Fri, 3 May 2024 09:20:07 +0200 Message-ID: <20240503072014.24751-4-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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 1/5] Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 52c2e6248b..9ad7bf6e5f 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -440,8 +440,10 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) /* Notice branch-to-next; used to initialize RA with the PC. */ if (disp == 0) { - return 0; - } else if (use_goto_tb(ctx, dest)) { + 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); From patchwork Fri May 3 07:20:08 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: 1930947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=KXtEPrDa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2L65qNlz20fb for ; Fri, 3 May 2024 17:21:50 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nDp-0000z7-AS; Fri, 03 May 2024 03:20:45 -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 1s2nDm-0000wf-Sv for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:42 -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 1s2nDl-0001LE-7p for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:42 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41b4ff362a8so82474965e9.0 for ; Fri, 03 May 2024 00:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720839; x=1715325639; 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=PmOXXany6+IF+Zg4vOVkLGyHudTW6xzwKpcd61mzXPc=; b=KXtEPrDaLdNsdS4xRfcIeGSoV1/0gfrDpiEpLR1UxbonZ4n6/DK0ar5eHMTyFo96BV GwBMa7FWkVvw3JGBCsEjmxryZVFMiPBImKKqbMoc7N5bZDpBNNiiwBZ4QGP6Mhy6FG3E rwD9cN3AukfIYS0VtbFGSauGrZm1d0kE0W724cRteGQFu+3SqnLV0Ul6wzLpvfVA0PmJ M02+Sdr6XuADRhqYcteqYF9S3Edpj/nn4BFqjYUEbwTwXEQfhNqxoUH+qwktNJtyPz+S DJ33xuk3rF71V6Nj6ZUdCoTjm1CsnNYGS8r+OqaAFSIbkzmXZHuuFDvlfvVOZG9mtZy+ DYtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720839; x=1715325639; 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=PmOXXany6+IF+Zg4vOVkLGyHudTW6xzwKpcd61mzXPc=; b=DsNms7MM6iN03DYITMjUD8//AheRNc2bP5dcQWsMBnaROPvvRVkIxzjGS0KE/s9G95 qvWjeZ+fY6qD+co5No7eLPsGSjjDvWB/yQk6fyD6qTgVUPrV+KVhaYpRPvXff7AoGoz7 sddym8dw/Rn4lnQQJu4vt10AUUOkg2EtYXhWsISkNjOn9AF/GnUA5YJRBkx5AXBrmy49 Jxv+VnmtZNns9m8MI0AyV9SNYu8R7TPveiy5vQ8ZotbmHE/jSURCFHXpoT/25VuTonEw 0XEZomQkgUFdFEYQ0dZ9RdamrJIbJ585URbcFP6LKy93gQUXrrwkK4mpSgVo5BCl8A41 Cz/g== X-Gm-Message-State: AOJu0YxYv1fx0lBPMEn6NJv6YWk8JKGI/aGIm2oJYyvyzaGh1uVPoHyI /qvQGE1vg46piu+5XDW5aqYeK8XYbKn9p4BBejqd6AFbf7hK/84mnDXsUSW3B3BGhQO3eKIRjAr Y X-Google-Smtp-Source: AGHT+IGv6Lwzgra0IE536D99r5Yv97/84GJYar6x9gTDvjtvgWu3XBvq8cnYeXjx1RG8fPsdpMVcsg== X-Received: by 2002:a05:600c:3507:b0:41b:eaf2:f7e6 with SMTP id h7-20020a05600c350700b0041beaf2f7e6mr1896677wmq.2.1714720839289; Fri, 03 May 2024 00:20:39 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id fl24-20020a05600c0b9800b00418916f5848sm4572133wmb.43.2024.05.03.00.20.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:38 -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 4/9] target/alpha: Inline DISAS_PC_UPDATED and return DISAS_NORETURN Date: Fri, 3 May 2024 09:20:08 +0200 Message-ID: <20240503072014.24751-5-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson Inline DISAS_PC_UPDATED switch case from alpha_tr_tb_stop(): switch (ctx->base.is_jmp) { ... case DISAS_PC_UPDATED: tcg_gen_lookup_and_goto_ptr(); break; Signed-off-by: Richard Henderson Message-Id: <20240424234436.995410-4-richard.henderson@linaro.org> [PMD: Split bigger patch, part 2/5] Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 9ad7bf6e5f..01914e7b56 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -450,7 +450,8 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) return DISAS_NORETURN; } else { tcg_gen_movi_i64(cpu_pc, dest); - return DISAS_PC_UPDATED; + tcg_gen_lookup_and_goto_ptr(); + return DISAS_NORETURN; } } @@ -479,7 +480,8 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, TCGv_i64 p = tcg_constant_i64(ctx->base.pc_next); tcg_gen_movcond_i64(cond, cpu_pc, cmp, i, d, p); - return DISAS_PC_UPDATED; + tcg_gen_lookup_and_goto_ptr(); + return DISAS_NORETURN; } } From patchwork Fri May 3 07:20:09 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: 1930946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=U6J58vk3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2Ky1GLsz23td for ; Fri, 3 May 2024 17:21:42 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nDt-00017W-TI; Fri, 03 May 2024 03:20:49 -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 1s2nDs-0000zo-OS for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:48 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nDr-0001LQ-2k for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:48 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2dcc8d10d39so101723801fa.3 for ; Fri, 03 May 2024 00:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720845; x=1715325645; 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=hAInt9n6R0I02RcTDmsM7sU3am9+yxrb3hMuH3Duw+8=; b=U6J58vk3/SzG1xTpfPKxZTWczLFPVEQEWl6BX3RrPJxuqglXbPIFFnlIBjlAKdtFDs d7A54X7tzoPywW/DeSIg4pbBsM+8cg0R0f4bK6KHcoK8KiIJORv9WoCfBPEBU9VfO22B 7GqN0aA+qL25I2omLwIib9Y2GbwNWM7kAowhYzgC9n4IyjPZJcrUCPWyv/IuHtAUmXj7 1O9mJ9KG/kwfddpIPx9dLYU3G7Nn3z07eHhFY8WtmWY5bGe5y9d+afftxQztRBGC1Ymp PCPBZUVLNPxUqtJ+FtN+AfYZlJj30V10/Eov51wH9oyIhiamPfhLoek7R1xD7VWtDMSf rx2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720845; x=1715325645; 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=hAInt9n6R0I02RcTDmsM7sU3am9+yxrb3hMuH3Duw+8=; b=bOUL2wIuuayFy6YMBBUd8jK2WTWuVtNlMHnxhYVdkVbVzWymkR+Oqn2kT8CN3UP+7b 0uIt2xx7OEKHYH0vb4irsXmxvAy/GDjoIvgeEg4Ck/MK6dW6RehLlnDyERqs1gKlq2Qs IQiSk0aNFqpRvFsIy0FfdwRDx23FbtLS+4y7oy/4XedDdNs/+yzBnPc2pCjKC8cmrupJ nChN6S46BuiM21WYVAzwN8qIT8xhoxbouzPJWA+rDAp04Vy7Tbd53WodRyl25KJUCWRo ibjxePx8ncel8yfj35MmPxG6msoDKqSCMfd5ENnaZeH585XPTaylUCuQFVFuA5Ky/pTa 5iBA== X-Gm-Message-State: AOJu0YwVGL3ACJ8EBZIAaYnyMogHt9nn2KxH0jcb/n4ko7MNsCU9sHxQ dJyAUTvI9oCbRLStyMW8oia+NfL6AV/XPIO1qnRJdBuCdSKGjpZR3HYYoi0lIu1n4LVkRUpMvrl n X-Google-Smtp-Source: AGHT+IGK3MlPj+aXrGOxpKDLJj+zaqm50axp+vgE9ADNT0lsdn4wqtleQtfiTx86MCC3SoJVolW8+Q== X-Received: by 2002:a2e:96c3:0:b0:2e1:5644:24e7 with SMTP id d3-20020a2e96c3000000b002e1564424e7mr1222721ljj.13.1714720844841; Fri, 03 May 2024 00:20:44 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id dn15-20020a0560000c0f00b0034d9012e74bsm3071456wrb.72.2024.05.03.00.20.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:44 -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 5/9] target/alpha: Return DISAS_NORETURN once Date: Fri, 3 May 2024 09:20:09 +0200 Message-ID: <20240503072014.24751-6-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::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson Trivial change to make next commits easier to understand. Signed-off-by: Richard Henderson Message-Id: <20240424234436.995410-4-richard.henderson@linaro.org> [PMD: Split bigger patch, part 3/5] Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 01914e7b56..41151f002e 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -447,12 +447,12 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) tcg_gen_goto_tb(0); tcg_gen_movi_i64(cpu_pc, dest); tcg_gen_exit_tb(ctx->base.tb, 0); - return DISAS_NORETURN; } else { tcg_gen_movi_i64(cpu_pc, dest); tcg_gen_lookup_and_goto_ptr(); - return DISAS_NORETURN; } + + return DISAS_NORETURN; } static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, @@ -472,8 +472,6 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, tcg_gen_goto_tb(1); tcg_gen_movi_i64(cpu_pc, dest); tcg_gen_exit_tb(ctx->base.tb, 1); - - return DISAS_NORETURN; } else { TCGv_i64 i = tcg_constant_i64(imm); TCGv_i64 d = tcg_constant_i64(dest); @@ -481,8 +479,9 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, tcg_gen_movcond_i64(cond, cpu_pc, cmp, i, d, p); tcg_gen_lookup_and_goto_ptr(); - return DISAS_NORETURN; } + + return DISAS_NORETURN; } static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, From patchwork Fri May 3 07:20:10 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: 1930940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=AukzeALr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2KR57rnz20fb for ; Fri, 3 May 2024 17:21:15 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nE9-0001Iz-Uh; Fri, 03 May 2024 03:21:06 -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 1s2nDy-0001B8-A3 for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:54 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nDw-0001Lf-Mg for qemu-devel@nongnu.org; Fri, 03 May 2024 03:20:54 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2e242b1df60so5213271fa.1 for ; Fri, 03 May 2024 00:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720850; x=1715325650; 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=LEwRBwaFx3imllc5jSpZeArCH45vOi4quQKo4jZx97Y=; b=AukzeALrzPrqwcMoeRbdFASqAwghMhkLe+6pujo6w2NJBjVrek26d1ZaigJDVrtkrO oxm3B7qSis7Q2Bn5P38qFHQhO80WbOQEKs+AP7iuvASyNMuiSE+JBZIH974JpKwhL1x5 Kzawzdm0jsRK456k1FvHYcD6cpGxuY78T4A9haPg9x92EMuIUYUYTd48aPHfXydhDWFb Km+nXdy1hoynG1uSuRxgIA42mEyZj0plRzSiuHXlKrNKPETQs6iLBbKflqwSnOgs7MLk EB+dtEG5tRBkgAfbi2ekkQQ/COkBCfM7tvIZpQNfha1EXaAIYhpr2ltal1fOlpLHyT1+ +pXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720850; x=1715325650; 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=LEwRBwaFx3imllc5jSpZeArCH45vOi4quQKo4jZx97Y=; b=bp1BXxsaxCqjWHESSBAQOPENUR2ns3t9tBbfVJGLvsjGa2KxgDbukSPcBFPhOxgDiA eL8qouzLqSUANYnVpnknrd3Ge16cvCLxmtDC5vVDwya4cnRzpfVZ9CqYFebX1j+SlaMh riqMM2b14emVfcAOSTJQKjw1Q2sFzX8hQfLrYXa/xPqPeOJjt/Tjz9nQNXwyIMYT9nJm MA9W3B6P9QGgJ2tQhOdC4//y08TI0QQeTlkv0IjGL/9Rsk/jLiu8h4S3oJoI8Q7e+Hbw sqG6y7CfAofXSvvexvAzkdI5tmTSji2gIacqoRygeT7bDhgHGs5si9mmneUaAzxC3XDN g9Vg== X-Gm-Message-State: AOJu0YxgE7PRCezz7aYg8jvgJTCn6ieDYp4MxH4+X6uDHBsdT/TxZzZ1 vYESnQkENVjG5ekcBQJNuY/UXAOBO3dudpcp9nvFmvhZl6nt+IxUdzndI1up1xtbpiTqsTMYSKi D X-Google-Smtp-Source: AGHT+IHiSGnqWHri0FSbErtiFzDM+W9Xy1QEjAkFF48+z55omddn+Q+1j5jhSvJg9VZvK4+QfvwQ6w== X-Received: by 2002:a05:651c:20a:b0:2df:dea1:5378 with SMTP id y10-20020a05651c020a00b002dfdea15378mr1378589ljn.16.1714720850570; Fri, 03 May 2024 00:20:50 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id g9-20020a05600c4ec900b0041c542636bcsm8275564wmq.44.2024.05.03.00.20.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:20:50 -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 6/9] target/alpha: Simplify gen_bcond_internal() Date: Fri, 3 May 2024 09:20:10 +0200 Message-ID: <20240503072014.24751-7-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::22a; envelope-from=philmd@linaro.org; helo=mail-lj1-x22a.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Richard Henderson explained on IRC: bcond_internal() used to insist that both branch destination and branch fallthrough are use_goto_tb; if not, we'd use movcond to compute an indirect jump. But it's perfectly fine for e.g. the branch fallthrough to use_goto_tb, and the branch destination to use an indirect branch. Signed-off-by: Richard Henderson Message-Id: <20240424234436.995410-4-richard.henderson@linaro.org> [PMD: Split bigger patch, part 4/5] Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 41151f002e..079bd5d3fd 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -461,23 +461,20 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, uint64_t dest = ctx->base.pc_next + disp; TCGLabel *lab_true = gen_new_label(); - if (use_goto_tb(ctx, dest)) { - tcg_gen_brcondi_i64(cond, cmp, imm, lab_true); - + 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); - - gen_set_label(lab_true); + } + /* FALLTHRU */ + 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 { - TCGv_i64 i = tcg_constant_i64(imm); - TCGv_i64 d = tcg_constant_i64(dest); - TCGv_i64 p = tcg_constant_i64(ctx->base.pc_next); - - tcg_gen_movcond_i64(cond, cpu_pc, cmp, i, d, p); + tcg_gen_movi_i64(cpu_pc, dest); tcg_gen_lookup_and_goto_ptr(); } 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: 1930941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=gmvnklvd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2KZ1c8mz20fb for ; Fri, 3 May 2024 17:21:22 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IExUT94RUMGYghUOHY4iysM9FQFvR2GY2/TGByA9xcngQSuTyCrc8onR9bwJjDd3lrzgXz4BQ== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 */ From patchwork Fri May 3 07:20:12 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: 1930942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ZTVi/nuG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2Kg4zh4z20fb for ; Fri, 3 May 2024 17:21:27 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nEI-0001Yl-Ow; Fri, 03 May 2024 03:21:15 -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 1s2nE9-0001Rz-UK for qemu-devel@nongnu.org; Fri, 03 May 2024 03:21:06 -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 1s2nE8-0001Ou-5n for qemu-devel@nongnu.org; Fri, 03 May 2024 03:21:05 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41b5e74fa83so60090355e9.0 for ; Fri, 03 May 2024 00:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720862; x=1715325662; 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=iBtqCI5zdcZgATynvjUhC/8nsk7GHPhWu+QqfEEwrBQ=; b=ZTVi/nuG600iqJGGTJGx6pH7KTyfhJoaChGG0ujIoNH9+99vBm+XS1kckTYrAABXRS SrVrI7zg84KxnGafRBYhncqkyDpuW52yon0z8fKNFXYyy+dIq9yLvf7+ilw5X4Ff4nWC 4gWC7n+gkuzACsxtQPFjld+lo41FGMaEBFhJgOWYsCPjafbOw4haYhnxmrgOg1Qhhu8D /KzNarkZe48m9br9vg3woRvGXm0/aEWCRHPYkCPE6JiJkJJcnXOmdg1mcBoHwqG2xWUY oHDtGJBq5jUAEgZqVgQWBDG6nbBupE8KKWfa6U/tN2//eW236HwkexCeJOlUZCWiS8/8 qg/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720862; x=1715325662; 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=iBtqCI5zdcZgATynvjUhC/8nsk7GHPhWu+QqfEEwrBQ=; b=ErrSCvzrgFbb4Kqu43Oa/ox1EqkEvhdJGqSGBzilXQx+eTX+PBrVTYUi4N6TdpDg8m ODOzUnHswRSW0BgcCiZVm3ziKqjbSgcHt8qCwgeNRlbl2DCBX8nF9VH/V5Bt8jbzZAcV kLPF7QdWXlJn+CIDlZFcdVvNVUfbDDU9JkgYL1NB8Cz0lzj9tfWDaaHdCFOsTT4BmpQt FPveeKnshK9fFWNysM4TyXyOuASKgZdjAeJQCI/on7LSbCSwQmxhuX97QTZp0Yq8BX0M hnbJBeVDFXYVd5jcGhHnGWRXN1iRM1V8nATRpTWExloLjwrCCWDVVL/acOyRE4+gDJFp IB/A== X-Gm-Message-State: AOJu0YwzXmanfwuIbVdfZfQLTemBSiFg4qbbaiY1bvmTusSWxOUsC1rw oK/3oSf/6/wguWSvTONZ2Tnq9ms1/IYN0C7yL9IRkT4Y96dJKzZ9xj/SQ9/Q+iGI76xxr8+hyYT J X-Google-Smtp-Source: AGHT+IGVWUZtMGiepNAcBTuGndRf87Ag6+KWHnN3F8WW9rnsRMGx8d/lAyMQC/gnS6jPH446LvF78Q== X-Received: by 2002:a05:600c:354a:b0:418:f991:8ad4 with SMTP id i10-20020a05600c354a00b00418f9918ad4mr1435766wmq.6.1714720861871; Fri, 03 May 2024 00:21:01 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id b20-20020a05600c4e1400b0041892857924sm4635480wmq.36.2024.05.03.00.21.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:21:01 -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 8/9] target/alpha: Split out gen_pc_disp Date: Fri, 3 May 2024 09:20:12 +0200 Message-ID: <20240503072014.24751-9-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson Prepare for pcrel by not modifying cpu_pc before use, in the case of JSR. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/translate.c | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index c1a55e5153..86402d96d5 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -252,6 +252,11 @@ static void st_flag_byte(TCGv val, unsigned shift) tcg_gen_st8_i64(val, tcg_env, get_flag_ofs(shift)); } +static void gen_pc_disp(DisasContext *ctx, TCGv dest, int32_t disp) +{ + tcg_gen_movi_i64(dest, ctx->base.pc_next + disp); +} + static void gen_excp_1(int exception, int error_code) { TCGv_i32 tmp1, tmp2; @@ -263,7 +268,7 @@ static void gen_excp_1(int exception, int error_code) static DisasJumpType gen_excp(DisasContext *ctx, int exception, int error_code) { - tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); + gen_pc_disp(ctx, cpu_pc, 0); gen_excp_1(exception, error_code); return DISAS_NORETURN; } @@ -427,14 +432,12 @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb, static void gen_goto_tb(DisasContext *ctx, int idx, int32_t disp) { - uint64_t dest = ctx->base.pc_next + disp; - - if (translator_use_goto_tb(&ctx->base, dest)) { + if (translator_use_goto_tb(&ctx->base, ctx->base.pc_next + disp)) { tcg_gen_goto_tb(idx); - tcg_gen_movi_i64(cpu_pc, dest); + gen_pc_disp(ctx, cpu_pc, disp); tcg_gen_exit_tb(ctx->base.tb, idx); } else { - tcg_gen_movi_i64(cpu_pc, dest); + gen_pc_disp(ctx, cpu_pc, disp); tcg_gen_lookup_and_goto_ptr(); } } @@ -442,7 +445,7 @@ static void gen_goto_tb(DisasContext *ctx, int idx, int32_t disp) static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) { if (ra != 31) { - tcg_gen_movi_i64(ctx->ir[ra], ctx->base.pc_next); + gen_pc_disp(ctx, ctx->ir[ra], 0); } /* Notice branch-to-next; used to initialize RA with the PC. */ @@ -1091,7 +1094,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode) } /* Allow interrupts to be recognized right away. */ - tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); + gen_pc_disp(ctx, cpu_pc, 0); return DISAS_PC_UPDATED_NOCHAIN; case 0x36: @@ -1138,19 +1141,17 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode) #else { TCGv tmp = tcg_temp_new(); - uint64_t exc_addr = ctx->base.pc_next; - uint64_t entry = ctx->palbr; + uint64_t entry; + gen_pc_disp(ctx, tmp, 0); if (ctx->tbflags & ENV_FLAG_PAL_MODE) { - exc_addr |= 1; + tcg_gen_ori_i64(tmp, tmp, 1); } else { - tcg_gen_movi_i64(tmp, 1); - st_flag_byte(tmp, ENV_FLAG_PAL_SHIFT); + st_flag_byte(tcg_constant_i64(1), ENV_FLAG_PAL_SHIFT); } - - tcg_gen_movi_i64(tmp, exc_addr); tcg_gen_st_i64(tmp, tcg_env, offsetof(CPUAlphaState, exc_addr)); + entry = ctx->palbr; entry += (palcode & 0x80 ? 0x2000 + (palcode - 0x80) * 64 : 0x1000 + palcode * 64); @@ -2344,9 +2345,13 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) /* JMP, JSR, RET, JSR_COROUTINE. These only differ by the branch prediction stack action, which of course we don't implement. */ vb = load_gpr(ctx, rb); - tcg_gen_andi_i64(cpu_pc, vb, ~3); if (ra != 31) { - tcg_gen_movi_i64(ctx->ir[ra], ctx->base.pc_next); + tmp = tcg_temp_new(); + tcg_gen_andi_i64(tmp, vb, ~3); + gen_pc_disp(ctx, ctx->ir[ra], 0); + tcg_gen_mov_i64(cpu_pc, tmp); + } else { + tcg_gen_andi_i64(cpu_pc, vb, ~3); } ret = DISAS_PC_UPDATED; break; @@ -2908,7 +2913,7 @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) gen_goto_tb(ctx, 0, 0); break; case DISAS_PC_STALE: - tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); + gen_pc_disp(ctx, cpu_pc, 0); /* FALLTHRU */ case DISAS_PC_UPDATED: tcg_gen_lookup_and_goto_ptr(); From patchwork Fri May 3 07:20:13 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: 1930944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=d4r9X6kQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VW2Ky0m88z20fb for ; Fri, 3 May 2024 17:21:42 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nEP-0001pM-BU; Fri, 03 May 2024 03:21:21 -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 1s2nEI-0001bk-2w for qemu-devel@nongnu.org; Fri, 03 May 2024 03:21:15 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nED-0001SZ-A3 for qemu-devel@nongnu.org; Fri, 03 May 2024 03:21:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41b4ff362a8so82478865e9.0 for ; Fri, 03 May 2024 00:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714720867; x=1715325667; 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=EQCp32MhwULxErW3cF6VE6b6u1RptQVLJu9xOLH0dkQ=; b=d4r9X6kQgI4R2xBTP+/PmHJsYtqBysVg3CINwa+RFLY6Us8a8zKtvjQN83cXXb2mkv l+r0k7AYIIuedO7G/B1Z0AaVYnd9H3nLvFowxxcs1184yljpidgdJpSOGJ0fCtxvEZcm UZWDIGwmGna6vNCMzgTJC88KVdRyW3M5XNy/x+BB2sIS558TwK6T1FR4BfPcf3xnmAc/ yYB7kyDZTgWI6RNK+nhPGRy8ECjP6NVz/iI67aV21aOis1TUAufFzUMEN8Y+Vf86jHim SoeiJ3iraNVIDjOiF2S8XGL95YWJFYip5riJg9UUAuH2waopQQCLepcm7LPdjdiENghe CJKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714720867; x=1715325667; 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=EQCp32MhwULxErW3cF6VE6b6u1RptQVLJu9xOLH0dkQ=; b=r/k18m/kTmZyPnkxripa47ZgfPpXQmBvBsom4wM20MC6/SQNOH0OWP/4RpUYij8Vpb /f1dfoq4cuW+woVRodokL931YJPSmyEoBH7+fc7lh1+NLiBPh/jHGfCmitQPTuDSrId9 fP7ttKgw1Q/i6PvtjSxrgZQMLZUFfBoBtIkIRpiZmH3Z6zeWP9u+w+zzF1rLTYb1jCuy PPU1UfJI0uReRHfVQP7l2eg5cczPTnG3TDveHJsLJ8Azh4fosS1UUSj7GV5O+iRvhDV0 PW4GBULGv2DINrzHzdMYmFMTCDBcpsQL5jA8TtrX1AUizoWEv+bfuc5qMvF5lPiom3yT C/hQ== X-Gm-Message-State: AOJu0Ywwz0x8scebyroi/1PijWGfdcT2Myvm+GrukM5qqmE/qga4hf/c WXSo33h/Xfw2Vuet/wlIHpeL2P3P85rru+QQz0x9bH05lOcon6rjsydHmH8JBtpaQmN2NuGu4wZ U X-Google-Smtp-Source: AGHT+IGcTYuRhNBmXuyECvQjIuS5ZxV/+xzmf9Epgr/QCz2LwXu+dSjjTx7DkV37+YqN742j2vKFQg== X-Received: by 2002:adf:e4c3:0:b0:34d:8fac:9540 with SMTP id v3-20020adfe4c3000000b0034d8fac9540mr1565830wrm.59.1714720867450; Fri, 03 May 2024 00:21:07 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id r2-20020adfce82000000b0034dd7984d7fsm3011625wrn.94.2024.05.03.00.21.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 00:21:07 -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 9/9] target/alpha: Implement CF_PCREL Date: Fri, 3 May 2024 09:20:13 +0200 Message-ID: <20240503072014.24751-10-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::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé --- target/alpha/cpu.c | 23 ++++++++++++++++++++++- target/alpha/translate.c | 29 +++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index f98d022671..0e2fbcb397 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -38,12 +38,27 @@ static vaddr alpha_cpu_get_pc(CPUState *cs) return env->pc; } +static void alpha_cpu_synchronize_from_tb(CPUState *cs, + const TranslationBlock *tb) +{ + /* The program counter is always up to date with CF_PCREL. */ + if (!(tb_cflags(tb) & CF_PCREL)) { + CPUAlphaState *env = cpu_env(cs); + env->pc = tb->pc; + } +} + static void alpha_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb, const uint64_t *data) { CPUAlphaState *env = cpu_env(cs); - env->pc = data[0]; + + if (tb_cflags(tb) & CF_PCREL) { + env->pc = (env->pc & TARGET_PAGE_MASK) | data[0]; + } else { + env->pc = data[0]; + } } static bool alpha_cpu_has_work(CPUState *cs) @@ -78,6 +93,11 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error **errp) AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev); Error *local_err = NULL; +#ifndef CONFIG_USER_ONLY + /* Use pc-relative instructions in system-mode */ + cs->tcg_cflags |= CF_PCREL; +#endif + cpu_exec_realizefn(cs, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); @@ -190,6 +210,7 @@ static const struct SysemuCPUOps alpha_sysemu_ops = { static const TCGCPUOps alpha_tcg_ops = { .initialize = alpha_translate_init, + .synchronize_from_tb = alpha_cpu_synchronize_from_tb, .restore_state_to_opc = alpha_restore_state_to_opc, #ifdef CONFIG_USER_ONLY diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 86402d96d5..db847e7a23 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -54,6 +54,9 @@ struct DisasContext { uint32_t tbflags; int mem_idx; + /* True if generating pc-relative code. */ + bool pcrel; + /* implver and amask values for this CPU. */ int implver; int amask; @@ -254,7 +257,12 @@ static void st_flag_byte(TCGv val, unsigned shift) static void gen_pc_disp(DisasContext *ctx, TCGv dest, int32_t disp) { - tcg_gen_movi_i64(dest, ctx->base.pc_next + disp); + uint64_t addr = ctx->base.pc_next + disp; + if (ctx->pcrel) { + tcg_gen_addi_i64(dest, cpu_pc, addr - ctx->base.pc_first); + } else { + tcg_gen_movi_i64(dest, addr); + } } static void gen_excp_1(int exception, int error_code) @@ -433,8 +441,14 @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb, static void gen_goto_tb(DisasContext *ctx, int idx, int32_t disp) { if (translator_use_goto_tb(&ctx->base, ctx->base.pc_next + disp)) { - tcg_gen_goto_tb(idx); - gen_pc_disp(ctx, cpu_pc, disp); + /* With PCREL, PC must always be up-to-date. */ + if (ctx->pcrel) { + gen_pc_disp(ctx, cpu_pc, disp); + tcg_gen_goto_tb(idx); + } else { + tcg_gen_goto_tb(idx); + gen_pc_disp(ctx, cpu_pc, disp); + } tcg_gen_exit_tb(ctx->base.tb, idx); } else { gen_pc_disp(ctx, cpu_pc, disp); @@ -2852,6 +2866,7 @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) ctx->tbflags = ctx->base.tb->flags; ctx->mem_idx = alpha_env_mmu_index(env); + ctx->pcrel = ctx->base.tb->cflags & CF_PCREL; ctx->implver = env->implver; ctx->amask = env->amask; @@ -2887,7 +2902,13 @@ static void alpha_tr_tb_start(DisasContextBase *db, CPUState *cpu) static void alpha_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) { - tcg_gen_insn_start(dcbase->pc_next); + DisasContext *ctx = container_of(dcbase, DisasContext, base); + + if (ctx->pcrel) { + tcg_gen_insn_start(dcbase->pc_next & ~TARGET_PAGE_MASK); + } else { + tcg_gen_insn_start(dcbase->pc_next); + } } static void alpha_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)