From patchwork Sat May 4 15:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931365 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=A4RgGxdo; 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 4VWsN517Bcz1xnT for ; Sun, 5 May 2024 01:41:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HU6-00021z-DQ; Sat, 04 May 2024 11:39: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 1s3HU4-000212-Md for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:32 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU3-0006E7-0R for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:32 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1ec5387aed9so5050045ad.3 for ; Sat, 04 May 2024 08:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837169; x=1715441969; 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=Szn3u2DiPc63NcxLhhS13Pf/pn94U3NtwmvgmtkOMv0=; b=A4RgGxdokgoN1VDX1GtAlAPBdO428KEt19LREaFXJGYzx5H7HbDbbX3/5t6cQ2kJui PuPNcyE8NrT1+jyM9FCtUIeIgJLmcX83jCTLLo5bdXFQPurkH7iyAReFHiohvvnWUjpz fpEcnCPgIq5A2VgBQhl8+ZqaMjWBIuyIHEk7CzE90111DIO3Ruuok6qNM6XbdQywIgLl wheIHLKIJQcBEM2hsowos9jvwpg/poNyUIGkeOMHvE/0INP5Qc1HYhrY+wp/KhhvxzQ3 W0CybZBAU1avVyAetD6E/hdVDSU2j7J5hVR9ZIl8FPWptKzoDSgC0bMMXkSWsWKKA2/f Tbsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837169; x=1715441969; 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=Szn3u2DiPc63NcxLhhS13Pf/pn94U3NtwmvgmtkOMv0=; b=rtfnDYhjk7jbCA+FAuKH0W4//yHfSE1s1zlHU2Za86yagjROFLOjtBQ83p5ECGtRTB 4/WFJHWtOLgTDGJWtaQHKj0eYg8V7PnEW9ObFM4BMfDjuZYPWYNUSFnrkG9SRHkAVnqk mthnuCu9yEgHELyTPK2aHilj4TdTfAjO0pPDlEYwIu9jma9TcagRtXvHzzdTvE2JxMZT HPBGRPhSOsyIWn0mFR5hr/MSe1Dk1qZq8OqqlQAsJ9UCBs+WarJVx6/rVgzN3bcxxmm9 XpS8wpwtErKid2GT5mCv39GqE48TY4+9n46DlHF/aEnXrCn8KIxX1euG9NBJC9H53AkY 6Jbw== X-Gm-Message-State: AOJu0Yxbu3BxijYxYQVJUHL1Xq3U3Px+P7ecWrOjUnmpVwGOxOhfgncn SNkIPrTGyZMrQuw9TxrxeJtarU1ZEzX5mZdKMr/avWEWyy0C/0TopfNc5bnlQNxDLD5OGT5ZLaR d X-Google-Smtp-Source: AGHT+IEfjEoHJGJgxLeNU6QugQWJo4+ieNt8Da07R1ESrMs7oKJiG8B4hLa9DB+H4iTIT357h1KwIg== X-Received: by 2002:a17:90a:ac18:b0:2b2:9d08:80a1 with SMTP id o24-20020a17090aac1800b002b29d0880a1mr5241359pjq.33.1714837169188; Sat, 04 May 2024 08:39:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 1/9] target/alpha: Use cpu_env in preference to ALPHA_CPU Date: Sat, 4 May 2024 08:39:18 -0700 Message-Id: <20240504153926.357845-2-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::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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 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é Message-Id: <20240503072014.24751-2-philmd@linaro.org> --- 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 Sat May 4 15:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931367 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=F1sIB0CN; 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 4VWsNX5sJ3z1xnT for ; Sun, 5 May 2024 01:41:48 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HU7-00022R-N2; Sat, 04 May 2024 11:39:35 -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 1s3HU5-00021J-KQ for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:33 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU4-0006EC-4l for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:33 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1ecd9a81966so18850285ad.0 for ; Sat, 04 May 2024 08:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837170; x=1715441970; 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=p/6g7IPHM26fk2SatJJUV9sUQh1e0SSWEbxZZLoVbHA=; b=F1sIB0CNuDpGOPLpd19Zc97N4nLD594fe8PbPGvT44rk6PVG2BerYQ2q/+p1R0QLHh iZ1jkoFNIGeqqBP91+KU2VxJG1ddcXGKPXFGCUA/zGJdTH3m2N2W5xP81dnNkZ05lzra J2zuBNOW+HhXfpd6rucpXWO6y6s46rJ+IU9cbWypBxfvEMb69CSKjEcl0qNy6m9LA05n QS/ONzJ/rs3aTVDHfI0C6jnJZ+8FMgrO9ChOh3XzA/F5DE8L/b5G10Oa4rI95rdmkT9n l3S+xC6V2I3Vrwk8G8+szA5y8P0SX9Q7tzJXYyLmBRGMGkDJoZvajUJTzbdB3DngKtax yRjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837170; x=1715441970; 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=p/6g7IPHM26fk2SatJJUV9sUQh1e0SSWEbxZZLoVbHA=; b=Tr0YOu7uNoVUU2P55k6bCE6oSZNXX8n+Vt0zBxv5atzLMkGeEfgzTjw8/y3nZEt9vf hXPPKxF2V7wma4MKKVMigxE9GgXSCbTaScAqJ7vM4hwAvtPv097baJWutDNVIb+xhfxQ ULtazMwsZGBma4Ja8NEuvnwPImILqmWZnzXVSYZA7+AXoQMFh9xzd9MA68+AmiUbjZai 74qWklds2flXUVZ1SBYVNoRlG6DijvrrlOi7UeULXcL9ygMsVFVodVJ0QKTKKtFY/zeC U1jgNIye96fIl6ygzwLcsLL0royJmcC8RcQUB4e5dctraJDTPgXD35HQfNzwWgOgmHtf 56HA== X-Gm-Message-State: AOJu0Yx0LRyosWkxJgp8YrlZ13hZbQiuUuoarEOf+MQfuCjV2/nNeoCY EVeJ4SgwFm4EF7B2BnRHzul2NdEaWQGQRfAVY7FauReWoZp04efqmih7tcbOQQhCYk/qNQ3MoUh 4 X-Google-Smtp-Source: AGHT+IHlSBk2718oh16x7sxkqipeOzJ0wd5gKWFo5XPRWOmKYFDIKbXAYb07p/scMSXWGvGVP0JgRQ== X-Received: by 2002:a17:902:e752:b0:1e3:ce12:ef77 with SMTP id p18-20020a170902e75200b001e3ce12ef77mr8437938plf.11.1714837170177; Sat, 04 May 2024 08:39:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 2/9] target/alpha: Hoist branch shift to initial decode Date: Sat, 4 May 2024 08:39:19 -0700 Message-Id: <20240504153926.357845-3-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::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20240503072014.24751-3-philmd@linaro.org> --- 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 Sat May 4 15:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931369 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=zEdJ5CqN; 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 4VWsNg4Lpqz1xnT for ; Sun, 5 May 2024 01:41:55 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HU7-00022P-LM; Sat, 04 May 2024 11:39:35 -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 1s3HU6-00021U-05 for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:34 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU4-0006EI-IO for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:33 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-61eba9f9c5dso453659a12.0 for ; Sat, 04 May 2024 08:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837171; x=1715441971; 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=qfHxYfQijfNm9q0rpqswl8HrggnkGTpjh4fn75ISOwE=; b=zEdJ5CqNivpkqZWidMWcOhn8pqX2VYxrrCWeo1uuniGyPZrp1OicMfFMvw895wITvM kEtN3JPaL2ULV6EBxjNMetZXcayRsz1wrwF9prOLYYmkRMUpZTBbFUH4q5/kPpdebBLi 2Xn66THU1El2xAym/GO+LTMjUM2YMs+NIpMuNunE44fsFKnz1HBYAqVHEejY8xdVQf+x Xt/pXeT7iV8RzhAg2ggnJyexkLWKkbLm4vBRKj1YCSXpZhQe61z36e0Whts+cDcZesER X3VU05X3JRzTaHEfOcpcDfrRIbsyY9Rnqix0G8PUP6Hgrbp/xrnM0H9ZxD+Q/Q3PWBYz jo9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837171; x=1715441971; 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=qfHxYfQijfNm9q0rpqswl8HrggnkGTpjh4fn75ISOwE=; b=tjLCbRUidFxjApdv6c9Z+w0tv8NiLI8yXjTXDyUX/12Ysd8lM6Gk4Eq0YGDhugeq/w Wx1LCotoxDiQ44V6QI7VpqAgXflnnysEq6MkHAQuP+I+A5lCY2zcCcgat0OksgT/csM5 JnLrf7HeuUU69JyQW292jkLHzl6TIeL2Kwq/hWM+IhMpDtdkCWfjAD53gdYSaam7yw9G e3+L9MymJfzRdm+LZ+9mOxawzNjbUzjm3/Df3VbFirKzUybbZa/G/wHzNJfHeK2n3Nr9 TFY6hKh0yyl5kjb5GnJRQPN9XZbEdLMDdb4TpyBy0gRhW5/R+w5jUr1wDXnz82w42VAv 4z3Q== X-Gm-Message-State: AOJu0Yx8hMuq/ORVWmKEKWPEve7oN64GdE5IhHVdOuNGQkb3cls+Fnxl Rnx2vH+8mHpwsQ7lmF4g0A9fOVgYkkhKSgll1Efw0TOkaFvrME/l1rAm8PCpLeI/9MCwLHK9vNl i X-Google-Smtp-Source: AGHT+IFH8oA2Gk266QDn6+yaWXIiCenPKzKHAqasXAHBPApOVt/nSnEGZcrbWLKjfopeXL3jzYC4uQ== X-Received: by 2002:a17:902:f609:b0:1df:f681:3cd8 with SMTP id n9-20020a170902f60900b001dff6813cd8mr7201555plg.12.1714837171063; Sat, 04 May 2024 08:39:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/9] target/alpha: Use DISAS_NEXT definition instead of magic '0' value Date: Sat, 4 May 2024 08:39:20 -0700 Message-Id: <20240504153926.357845-4-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::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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 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é Message-Id: <20240503072014.24751-4-philmd@linaro.org> --- 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 Sat May 4 15:39:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931364 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=uGpEVFSS; 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 4VWsMx4BVwz1xnT for ; Sun, 5 May 2024 01:41:17 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HU8-00022f-EL; Sat, 04 May 2024 11:39:36 -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 1s3HU6-00022E-S4 for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:34 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU5-0006EU-8d for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:34 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2b12b52fbe0so433244a91.0 for ; Sat, 04 May 2024 08:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837172; x=1715441972; 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=fi/ZQeRrecbB7BBaXRi3+3SwPGSOgsgXACvVx9J1knk=; b=uGpEVFSSEr8060cP509cO+f4sPuHs+61OeLKLcmndJaneWGPUcAcYvrjRXF+n7M2XK pO3EprLaXPujlCOdCUoD2qAiluaOjhhNebN28oEJ3C7qBagfIXb25nKc5DTqhg3fTiS9 kh5EEDQdGkce/sD1hLtUoKrN2RdsuRJHANcg0g9Ur6hb8Wz/K5r8lbrcrnycZ2O2xNvg veTlY/eKbKSQCMINRzN8Pf9hyUcSNiXEDWyjZFTiA/KkYcMWo0e0730tL0ffXL9gCgtU VuNBhCJAj7M49IYzpxXlTlqyRXhAEHkp9kNDCoytSCwO1+ImiBIOpwO8q2J1vFdQTaxN JdGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837172; x=1715441972; 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=fi/ZQeRrecbB7BBaXRi3+3SwPGSOgsgXACvVx9J1knk=; b=hSI3C05QS4+fiCOgTxrvDk2eHTSlra8UotxkUyl+jcTkJi9aqUDY2tV4mkGiiOqiaE nqY3HkeUW4kgTOlyGgYg4b7fy8189/poGf7D8YP1P6nPCyZKR/H6SxxiLM4LU7G+12sJ 90aNU3YQdjFuyw0OFYTgkeqa5rvCMkayF38ZB42toAJG0oGQokjRRDXkWa/VEWQkND43 P3W2qoHg3tBGOFgxcV+zHpi/kKVlzyYZ/d0W3zOGm3w9nJcrMVU8EyBkSs9OFVXm4Xt3 FBJDUus1Gr7IJOfiu8lTOzMQpWuwdUt+MiZJ6ItvuIVBWkiJ6InDA/NCO+OuGoIgigul fiWQ== X-Gm-Message-State: AOJu0YxhNVmHRBm1NUGgXdQThyYv+hr0BVkeDNoueXbdBMpF2m1Omb7l zglpx99UDd1Wh4SbIgHBDtmc6LN3pA9FvTWRW0dhRBvgIaG7iZNEXHksv+IFe6T6zFPw0D5Ge7m 0 X-Google-Smtp-Source: AGHT+IG/hzdw5QCUao4sdoXVF0FENHoiHnoJROWBIlnUDLQRv7rt+zJGfwwarl4+o9JEA9QkQg3AEQ== X-Received: by 2002:a17:90b:684:b0:2b4:329e:e373 with SMTP id m4-20020a17090b068400b002b4329ee373mr5941195pjz.6.1714837171872; Sat, 04 May 2024 08:39:31 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 4/9] target/alpha: Inline DISAS_PC_UPDATED and return DISAS_NORETURN Date: Sat, 4 May 2024 08:39:21 -0700 Message-Id: <20240504153926.357845-5-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::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 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é Message-Id: <20240503072014.24751-5-philmd@linaro.org> --- 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 Sat May 4 15:39:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931368 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=zm738Eke; 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 4VWsNb1hHjz1xnT for ; Sun, 5 May 2024 01:41:51 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HU8-00022e-Be; Sat, 04 May 2024 11:39:36 -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 1s3HU7-00022Q-Kn for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:35 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU6-0006Ef-10 for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:35 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1ed012c1afbso4635635ad.1 for ; Sat, 04 May 2024 08:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837173; x=1715441973; 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=vY5Eou1jVTje6BF1WY7ML8aaACS2Ol4ajRC2WX0h/bw=; b=zm738Ekez1vsqoj2eIJcAYR4FiuHUSAfjXT3VKJY4kE3yfzl2et9TqyQ7ZY3Fl3cA6 Na+SLQsGFS7W5fSQTpJEVLGWN23nbLj6dUZfrsiaH7XjWa4EsObImx73Q60c16aTGcpn XoqJT1VA522jMs0AG52Frc1qejKxGYBaI2dGA608rVoMJE7XFiIWHYD549+X+5U3Wnwn hnjhjylc2DPaBQgLJblu//tRqNnu/v0uVWVf0pur0uz5iAMKzSc337IQDYQh8dzAcI6Z dmtFwvF+OTyTUOkYiI129NepGh7xu8Hh5PybDmalfEss13knJoGDcUDLbPvyYi3Ah8SX dWLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837173; x=1715441973; 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=vY5Eou1jVTje6BF1WY7ML8aaACS2Ol4ajRC2WX0h/bw=; b=YntijcJf5iKjUOQGdDQCaLtRokSwDqXSs5udJHYuQHT64JD0pLxHASeMj8am9vMp9G f/bjJDTUibimNX3yIiyip+csMIEIYnpNsMYBOj0v/A08dov1pEFzW7uU6X6rZqxCi42F 52rW/Ga5+0fi5O37KOOKRZJhejSsE5a4+I88YvzY5p8q2v5PcO3JV+0SA7rK+ZzjkV17 FRR6gAwXMkd2az49AT/dxg3TIGLSdJxpjI5wwcHDkgsCkGO6Iv97jZKRBpNauJz+SddX RbyBMBTKU7Pn6OYDojVgdmsEyB3x78ivSSBk3VD5HluYzQAB0Ql3Urq1/7oT6kQTb9fM umhw== X-Gm-Message-State: AOJu0YxfzD+ElFAxJGdeZr3RMWQxKqLBr6KHEIMbO2gb8WKJa7nuEb2G NwMnUBscVAslhAzB8lYSEjFqEOoyml+8mNzOt3ku1SlF3qexiCq+GckxnGD8mNqClBab3Hp73SS 0 X-Google-Smtp-Source: AGHT+IGNf6AMSmVZURg5RaJkf/UMKL+2ohwbYq6HNNXoNFPoR/CClbz4qaCdMOBv44TMEbsZjICOKQ== X-Received: by 2002:a17:902:f605:b0:1e8:682b:7f67 with SMTP id n5-20020a170902f60500b001e8682b7f67mr8654821plg.29.1714837172718; Sat, 04 May 2024 08:39:32 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 5/9] target/alpha: Return DISAS_NORETURN once Date: Sat, 4 May 2024 08:39:22 -0700 Message-Id: <20240504153926.357845-6-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 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é Message-Id: <20240503072014.24751-6-philmd@linaro.org> --- 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 Sat May 4 15:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931366 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=erh5dysr; 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 4VWsNB3nZKz1xnT for ; Sun, 5 May 2024 01:41:30 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HUB-00024X-Cn; Sat, 04 May 2024 11:39:39 -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 1s3HU8-00022k-Oe for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:36 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU7-0006Ey-2g for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:36 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6f44881ad9eso503299b3a.3 for ; Sat, 04 May 2024 08:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837173; x=1715441973; 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=sbgTvqZXx0oV/4QT5gXHywIupzMDjszkzNiZiQWIETo=; b=erh5dysrkgPPdSQhwPB6/rL9zUmMaxNFvNmF66mS8e4AM+EOCXfpERBnhRwE1NdepG qiPNWZTfwej+JQUOHL/io3dFhzylJkwwPV5xgtwrUVMVkUxkzgyI9q6JzgAjEj69Btng hMOaVB7x+LeLD8dtSbfQcPOh4z4oRihxH+r2TQpZu/TSh+ytfvoRcOp9iXNqLMDb/3pN N2ePRAoBXELbaXPGUOxKO9evFmmuvcDBv95z5QbpKFfu4RyrSlV2JsPnRawAwedqBmRg KVR6prNCYJowCd9AjOyMwG9Wao8RKdozvV3ByQWaMu0Tr06xLnOmz40FIfg+fefPFQBU raCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837173; x=1715441973; 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=sbgTvqZXx0oV/4QT5gXHywIupzMDjszkzNiZiQWIETo=; b=mw16f3JNapHTeoWLNxgr07ADQGq9/pio2a2/mZEVKdaFdGBDLn+DcxzrBbz7Z9/oDk FaxiteEAKJWeQMFxWb+tvATQz8f+n5pIk09aapfiwLU3tQwHL+CjsGKO5m3HFG7IkTr9 B3rMzqzlM7S3uoEPi1mMVBPNIiVeC88U/VFWVIgcpBe9ecHBGEhoK2rRrqQpeMLIGvB8 +z9/vzaETjxY+CmrBCjD0up0Z6mBrcrK+LLptkgSbyOr20B1KJyhz8VKqm6EHturKBW1 9tAQx8xLSmP5hh9EXk6PFXviB5Ffgij9lxSgltP4fI/K7vV0iwPTtInTUNqtReEs1Qmn Wk4A== X-Gm-Message-State: AOJu0YxlzVDZdz5ueCJNfW/9bYNOM91GcX7aTVbecYvH8r57fMbVmC1F 7RCwQYmZP73OcqD5HqhBFalRM63vUjpvGME4vg7T4I5hWBjRbDbCPAQdyQ9zaKyHvtNQnr0KbeV k X-Google-Smtp-Source: AGHT+IEcrE7LZvmWqm/4nV6TT0eMMT9SUnkl/thjmXYfBhhC5YcFa8gi3FuELyGTaSMAjpxhIx3j0Q== X-Received: by 2002:a05:6a21:164a:b0:1af:997d:1788 with SMTP id no10-20020a056a21164a00b001af997d1788mr1216910pzb.44.1714837173623; Sat, 04 May 2024 08:39:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 6/9] target/alpha: Simplify gen_bcond_internal() Date: Sat, 4 May 2024 08:39:23 -0700 Message-Id: <20240504153926.357845-7-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::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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: Philippe Mathieu-Daudé 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é Message-Id: <20240503072014.24751-7-philmd@linaro.org> --- target/alpha/translate.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 41151f002e..b7b94cc378 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -461,23 +461,22 @@ 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); + } else { + tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); + tcg_gen_lookup_and_goto_ptr(); + } + 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 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: 1931360 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=nEFYmN6s; 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 4VWsLs4pHNz23tp for ; Sun, 5 May 2024 01:40:20 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHcBwjE99xqxnJtkEZC3Z61nv3umAeO4o6zrnJByalth0j3JygsO+lpuAXzMn5MmOo1+w3L8A== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 */ From patchwork Sat May 4 15:39:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931362 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=Dtl7I85o; 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 4VWsLy1Y4qz1xnT for ; Sun, 5 May 2024 01:40:26 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HUC-00024q-0P; 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-000249-Nk for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:38 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU8-0006FI-Tz for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:38 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5e42b4bbfa4so319570a12.1 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=/dNPNLs1khRCpqkW7qQSkGpf2gCcH5jGPYIjxIk0MdY=; b=Dtl7I85o02IsilE/RAvQycghH3veu4YufVfJT+ozjzsmkH/RZdFCz6zTkMV4NZpeme ERsGso6XoTNf/G8GfWpv9nQtRLyT0TFVPtbjAg4pLlIo2spWKPaVPAh+X+6o/6gTokHB 5LZdtfDmH4/T+a9ipliyJUWHUBokQqbUF9zXDme1cxC3KUREFKJIjyFoSPadZM8HxNYK Sdl4OhlmbTYDx2p6HWzT9l5TPjNL4wLFHf98rToNMhFmEg637LnYYfRPbLq7iamD9o51 mAhP7c4B1E8IGH/YUEg5/1/sOpUZiZv4VbjtbEyD11ze3azYJyh/rhLGuQ2wMhDz4FZP CRDw== 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=/dNPNLs1khRCpqkW7qQSkGpf2gCcH5jGPYIjxIk0MdY=; b=itz0WwvV944T5SyWhQyvYwhJDaV717Q7hLNE+m+v9ZlsfVOcCrSrskbe3aqo+iUn3l UF7BKWyAGgqd/Ubow376QCX43yu2ye0S6dNqsvRptopMHNFJPE1vAhC+iehIhEVT5y/T WoocvN84hdUmitpG/o2EQUyrL1YTOIqB6eN43QUHTU4gHg841s8iQEtIwWTj9NsWQbBW eYvjJJu6uymk8VIuZeQnRQpVEuadD39dH4lWeORYPH46px8nhOnURj7X1RFCeM3HRynj OGORFRU8EGZnwmQwc37tYFBAzTs7Z7oLFHO7kip4MHJEaMhibIhnPmuqqSYwzkT/gELG ukPQ== X-Gm-Message-State: AOJu0Yw6ZGm0eX8kt9i7kM5yJG5ZnXX1QOyM2MJkyxtg11Y58WuRXfkY QwrcY/OMGv7Ins5nXSuJTh4SN9SEzo1xlfLFKG+NdL9JPP1IMQkKdPyI6bduxGUPCIe5Z/W39DV U X-Google-Smtp-Source: AGHT+IEHw0hbEAKWoogkQE60piDeGiF5T43pZJzRuqGBme4nV/1yLqyy6Rbhadbwyw4s8wwoadVNPg== X-Received: by 2002:a17:902:ea0e:b0:1e5:3d8a:75fd with SMTP id s14-20020a170902ea0e00b001e53d8a75fdmr6739272plg.69.1714837175579; Sat, 04 May 2024 08:39:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 8/9] target/alpha: Split out gen_pc_disp Date: Sat, 4 May 2024 08:39:25 -0700 Message-Id: <20240504153926.357845-9-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 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é Message-Id: <20240503072014.24751-9-philmd@linaro.org> --- 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 Sat May 4 15:39:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1931363 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=PZhR3wv5; 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 4VWsMX6DJ5z1xnT for ; Sun, 5 May 2024 01:40:56 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3HUC-00025T-VQ; 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 1s3HUB-00024d-IT for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:39 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3HU9-0006FT-MV for qemu-devel@nongnu.org; Sat, 04 May 2024 11:39:39 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1ec69e3dbcfso4591375ad.0 for ; Sat, 04 May 2024 08:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714837176; x=1715441976; 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=MWL0Ke+Jw6QzfCzbT3Y2xG1VsHYECu3YiFT2GS703uA=; b=PZhR3wv5PKdhPjG1nlhi7rmgPT8fVobamOaXatYSr7N2papdTW90+3jMBBpFldf/Y1 Qa1Al77P7b8hae9wtIFaLLlFrT3g3e8CElHRUSAReH5qAM9uMy6ebR8amQjgO8Q9i8wu zzOmlXSqR/teF9T/+2m7GiKTPaasmoA8rfJerQq2HlKSzdSjbdAMoPSTzzpxSXUdPnOK SwxP5jPn0VlTwNbC7jDz+5dMO+VBfWlaW1c9+s+MpH336ClJEq6TfIpages9M2V47R1n 1hd2nqdzwOPJ1BqHy/7Xxs24BWnRN1yXaCBIAIHU1cvtyOUbOnZgkt4B3vdiTQCn7Bqm nH/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837176; x=1715441976; 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=MWL0Ke+Jw6QzfCzbT3Y2xG1VsHYECu3YiFT2GS703uA=; b=BPZaNx3QM8bEYx6oDLw1l1ty/BebhQrpsH1KFhGBBVcyZxXB9mcqLin8f0Y1dVhx6J pIKaftkWTuBttTxgcEdEr96mKoTosFL2X1pbPR0Z9x9qDGLxRw/v0+zGmp4zYRvzBzhx 431FcpnJZRmPB96c1HV6eKvOCaONuOwB9DQ6ExkxQYo1yz5LCwQeFoyGHXasJS54G5lm pGGY1OCpibtHj3CVfie4qkU7Z8uwS1agzPK3SSLQP/TD8W0dlSdE/hrDDQf+UxpImwjc 8XEIj4u2srnMoRAlx6Yr1n55uUed2Td+Fudie+Dn/Jq6wuMdukovAsql3ZfhzAKpzH5U n2ug== X-Gm-Message-State: AOJu0YxGJqNTQkKEUmTFKqwGfvLxiweGR5QqbjKVtJ7kerN9VLRf0mG2 Z3Oq/+yVMwECMRSfY8QL9pTjk4QsBYiUBe0EwpLhWYPK8UPliEX7vILSJyBHfbEg6p0Yh6X+uQA V X-Google-Smtp-Source: AGHT+IGkBsFt3l6KcPPa1IN/eZwLHpSi+psnnFFYDPbIf5X7+x3aSG0jLFiIIAeS8U4/MIOrc7kS9A== X-Received: by 2002:a17:903:234b:b0:1ec:a65a:e4ad with SMTP id c11-20020a170903234b00b001eca65ae4admr6419420plh.66.1714837176291; Sat, 04 May 2024 08:39:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:39:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 9/9] target/alpha: Implement CF_PCREL Date: Sat, 4 May 2024 08:39:26 -0700 Message-Id: <20240504153926.357845-10-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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240503072014.24751-10-philmd@linaro.org> --- 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)