From patchwork Wed Apr 24 23:44:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791613 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1110550wrq; Wed, 24 Apr 2024 16:45:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWykkQbmTK2JZPSCYgdGp0fBuyTp8FwkdJoAh8kjn+Z0NRWJuyx9ja0CTOzEcGoxckzsHELrjtRuGfS1GMkLo92 X-Google-Smtp-Source: AGHT+IGCsKqC48EmfGwRy98Rw9PMkk9KSnCo3Btdzbm6IOSSoUGBFSBJ85bSKp3uYMBbrwkSihG6 X-Received: by 2002:a0c:eac2:0:b0:699:49d3:fe3a with SMTP id y2-20020a0ceac2000000b0069949d3fe3amr4172077qvp.44.1714002356795; Wed, 24 Apr 2024 16:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714002356; cv=none; d=google.com; s=arc-20160816; b=N1y86zw24cqNrYtqyZ2VN8o82z2J8FXbuXHtSTWVDrUwEG+mpA4FpxSBDq48p5bjwd RmFVg8+p5TnMdCkTZvRmVWsCUHrQqqMdgmnUQW1Tk5zPp5Zp1Jw3mOf3bONfrPRmQMlK Jpyt6OHqVapQk2RAFEtA/tw7aOa5flPHlcMsFpWSRukQi06PidvssFI5w896FYUMkLML pXC+rCiKoon8G0J/PMldp07NpFLi4Z+ORql2j1sEiGtV0do9r2Qm2JtKUahhtQwnmCOL H88ApHQ6NRokHk7TCIEr9HJUevbQN7LP6SayOOcayTDVv7AjjbjPajXD3h+zmIvEhBgK G9ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UcNiArx2YUV5oHwUywv/QvdvtoymVGfjzxZPBIu3NNw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=HoObf6785nEo865iSpw5LjvAxiex8iv1MZ4IePBiYCZED6a8QgzQggtKL679b+RAgm eAkhm2/+1Tv3h37eEtve1VPzos2NPkdWc3mpdc+yLyGU2slVQCMLLAETB1VmBxIsHMKO 8xyFOBCXjMETE0cNls+6XKd69azNZf4Kw15ypXThzVr/Z2+1/NILlZ1m4LVgwanPK9DK +69EnysJ2MQ5JgtkTXuFYYBDm6dlFQaMnbjCFtKRlO7IofHpUq9B8ZZXiiTkr5Acr757 k+M7Zi2vV+0t14n6xQyQa5zynnamiKmjayWt8wYKPM7Hx1exKFpmwdM+WxLex6YEcTb9 BvWA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFFJUdcq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gg10-20020a056214252a00b0069615ae66cfsi16446795qvb.311.2024.04.24.16.45.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:45:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFFJUdcq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzmIU-000114-Lw; Wed, 24 Apr 2024 19:45:07 -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 1rzmIL-0000xr-Oi for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:44:57 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmIJ-00028Y-KF for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:44:57 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6ed32341906so481284b3a.1 for ; Wed, 24 Apr 2024 16:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714002291; x=1714607091; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UcNiArx2YUV5oHwUywv/QvdvtoymVGfjzxZPBIu3NNw=; b=fFFJUdcqDuP4IdkIj6OWsLwIPzKvfeuL3V5TFiK+TBEI1aD19iVeo+KFXTO1HVBvgi n4KAp1x1xJTgqZNdX3xWyDlTT6iR8w9gW7OPh5Wzj6KGPgQVDMMasXf+rv8jc6r1sZUc 9Goyy9aBkv8WpB7EqLuf2xQousydXSaRktoK7I2wqXm06YfdMmh1ZVtPqhWR42qNGdzZ IFGJKzH68aBWK9tI380nW9IgMqnW7cuKSDtqVlZ/DNaUIoRVZx3wqN1dKtYDrSsET4yy oNynTPHWrGUt+VD3UV2/9jTWus2C0kyVahhtQazgxuYISuzt9bN2sOF+yUL3dCw8UQsi IkWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714002291; x=1714607091; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UcNiArx2YUV5oHwUywv/QvdvtoymVGfjzxZPBIu3NNw=; b=msQ9Pv93J6claiU/fkFibx8HAaa63kVoI1jYuMO10MFm5uZ6YybniD88lDSVsuQq4Q o45mkwO68ZVMfTWl+ZF+cSqmZs5NWE15fnEn1emteEFsVRjxrUgAE5ZS6OWrgWZ14Rmz gAE83MElIsLgAchJeVVgQInfaiwDynpnnp/fKHdRb/t7B6BZHZdK3lWm+vRtaAjt+90g 5kv9jrTCj10wgxSbCBjgjDTAVyfYqFpmsvTP3ZG77vYePkpjnuWwKVSgvn5AxurwsUUG a3LbYPkGaQ6Zs+bzVW+uq09hM5xsWByBFEqZQeAtukKoKDhL7/N9KzA7XJYRGKfLIFrw 7DVA== X-Gm-Message-State: AOJu0Yxs1pLJIyh8I71UrPwh4ywGVGpOrMXZfcwlaipnPEBweqvhnp6Y 2UfohijQ0PZ4CLEZoM6TCuxAPzlSLOlZtLaP4+a/DvzWj5Z5TyS491SmX9krepdds4rL0GMFUy4 Q X-Received: by 2002:a05:6a20:3c91:b0:1a3:dc33:2e47 with SMTP id b17-20020a056a203c9100b001a3dc332e47mr4934910pzj.4.1714002291402; Wed, 24 Apr 2024 16:44:51 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001e49428f327sm12531642plf.176.2024.04.24.16.44.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:44:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/5] target/alpha: Use cpu_env in preference to ALPHA_CPU Date: Wed, 24 Apr 2024 16:44:32 -0700 Message-Id: <20240424234436.995410-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424234436.995410-1-richard.henderson@linaro.org> References: <20240424234436.995410-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org ALPHA_CPU has a dynamic object type assert, which is unnecessary considering that these are all class hooks. Signed-off-by: Richard Henderson Reviewed-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 Wed Apr 24 23:44:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791612 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1110527wrq; Wed, 24 Apr 2024 16:45:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXr6jfZtl746wPy3BWm0mmETeMez0P3jtXu5aEwh7zrjybhb7/SlKJov+C6hFd052HRADZS/HG5qvwtMe4MiW+j X-Google-Smtp-Source: AGHT+IGdDXGCbmaQl+WACPxCxPIBw+fhCYOqBfQwP01phD0WeUfe485gNvzBnlfXOf8EHHUrG6GL X-Received: by 2002:a05:622a:1309:b0:439:fe08:e3fd with SMTP id v9-20020a05622a130900b00439fe08e3fdmr4690860qtk.35.1714002353015; Wed, 24 Apr 2024 16:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714002353; cv=none; d=google.com; s=arc-20160816; b=NPcmSx/bfkFeTTZhpIp+9bkYNUlcujtuFGrrB0+vjuQ3yg3gytlZPRxzBZ0ekWqSPr IHCu2e+a9nQ8M2QH45/Cxys5J0HM0adSnHN2N+4B8ouljHlXDmqYJzaou8wge1Iv9e66 hWBAEWA8xOIrEyO+dQu1Cyl21KePwfD5NcwhXfFjmHjzA+ckJ52E1BrxFvtrg/NLg9Z0 cFVD21ErTePTQ0W/i13bhKOqNhTo/a8z1gRzDIa1KyJnOec6qTuvoeTvTlvVTYEsKKrz elVFpcYho4SfGv9uW1n7KEmgojkbYWbaZTsggarVID30Kn7MBb14lMCKpPDtXV2Jv9Ai VPoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xp7F1dpl/yWtxNJPPz/02BB7DaGLCNxpN0PiR1H7/z0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Ro8flamV46HrudohIkgqPouw8+XI+XTFopafO+Ne+Y9x2YAlc2NupazzoK/OsC/NVd lWj582EDS3SOGNvZUuROyez0PK5IRDHThLhy65cwx9fQyc07ePb8CtyTtvXjjopInVB+ dNv65ZacI3+keqC0Jv/BJnIYxvCDYDROtbPoS3j733Yh85FzAps4vmCGV8kCJkzDl/Wd slhat3R79FTEdoexECp7xhnI4SM2w4WhSTsGAHyuR2qFTH320hqleqnsJLb7d7so+4DZ jMYPug1zw0kNbCzbYY4amHmtG375SxOIFPxhX4q4gPQBPhGtq6usv72daIHL5qct2Tsi PwrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RL+q2jVc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id en3-20020a05622a540300b00437794a297fsi14360283qtb.599.2024.04.24.16.45.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RL+q2jVc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzmIU-000113-Ku; Wed, 24 Apr 2024 19:45: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 1rzmIL-0000xw-TD for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:44:57 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmIJ-00028c-Kh for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:44:57 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ab791bce6fso353442a91.1 for ; Wed, 24 Apr 2024 16:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714002292; x=1714607092; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xp7F1dpl/yWtxNJPPz/02BB7DaGLCNxpN0PiR1H7/z0=; b=RL+q2jVcPpK1DZ0QCjDMPQWq5B/GyoLqGgj4sodzK4KLEcgolf9Bwz7lmdTqzWrqsR cr09ubcOALFGJZvkhRQQO0VjwpFGqCJPR7Yly6Y8CW8w1xiaD6zv7yaTHRKubXD2+4WJ ohWFzLsroVvYOg684DFoyPQ9FhXd4VPqk1fs5LZYJbj/nCQAU4lkws2Y0ArZaVVBuU92 U3/IVxCbV3hJc5Pz5gQX6nh4gl//7IJLA88EjBOY/m3FKi3VIcTUKTGpJTEj2mmY5YTF 6miu47Q9YteWRQyH4ORVk5Q6zUWciMQkct5tIxEmZNTFlgTvk2Ntx4RHCOvZJ4mfCJ1u xRdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714002292; x=1714607092; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xp7F1dpl/yWtxNJPPz/02BB7DaGLCNxpN0PiR1H7/z0=; b=D4boA0bsjrgJxgCAEP6giCADwhAjeA22rHUP5jFnN32UjUKfrco0Jnkxy3Q4c11eik 9xR8cmOaSuSzohZM24NRs3u+fpguoIrzbEwaZlyTfmkQnqXV+7WFHiS0Yh+IiO5HvDTd DIqVYO4pavtqpkmc/ybqouIiVGhpJzZr5mqQZt5wsQsxFhN6zEMMkV7NSgxlKvSmhvCj aZpb7cCuXMjgN01/xDJ274bxvyCu9GxdRi4GdZBer2LOeFONGjBJ83UN8t5uqoWirn5q AMHJPYRFLCbW6xaJqu2qoNpyZextRpW0tH8xOsKmLYMIwpuEsCej2GCaeJM0jt14NzJy ycdw== X-Gm-Message-State: AOJu0Yz3mpKH8BRR+2XylJnb9XW+Sdu9xryNEkY4FbUf99gMHZPICTSQ 6x61+p8GxqKYiTELv6dfSyPOIK+QZ8ajmy88MWbTxUrfiEQKX0bHOQmz92GrBnnbfP7dcq5UxvA d X-Received: by 2002:a17:90a:ee8f:b0:2aa:5c79:853c with SMTP id i15-20020a17090aee8f00b002aa5c79853cmr4241096pjz.21.1714002292302; Wed, 24 Apr 2024 16:44:52 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001e49428f327sm12531642plf.176.2024.04.24.16.44.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:44:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/5] target/alpha: Hoist branch shift to initial decode Date: Wed, 24 Apr 2024 16:44:33 -0700 Message-Id: <20240424234436.995410-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424234436.995410-1-richard.henderson@linaro.org> References: <20240424234436.995410-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-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 Wed Apr 24 23:44:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791615 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1110685wrq; Wed, 24 Apr 2024 16:46:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVpA2hhyT2U2Kx/uj6NrzqzDYvV7t08/LnJOo65F2EEMJgK1U2/evF2kVOHxMLawcOn1913B1zWoV/Ia6Q3Mg0P X-Google-Smtp-Source: AGHT+IFjkabOkDKYLj4ylvexSTCdgPJYf5CuI9QbvOzlXTSTyeIBC0wRoPsz15fWQ1EeE8NjJM3I X-Received: by 2002:a05:6358:2192:b0:17c:263a:5b8e with SMTP id v18-20020a056358219200b0017c263a5b8emr4990608rwb.14.1714002386505; Wed, 24 Apr 2024 16:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714002386; cv=none; d=google.com; s=arc-20160816; b=rCmt7vDPSt4DzsT0HbeeCA9vBdZBfK2OS0a4ObxGHym9qlDlt1Tw0hA9tTFe/pVzpp naBsWAIXKyA4UDxssBitY6Sl2LHcGvhLh4ZOnRQmCCgLvr6UYzBagYxVhkZMrjY6wQV2 gNerhu/fy4cHbFyX0ObLA2YBSyGA4z9Og0JelejPcQFs5Mk9LLnFmFAviQcz6+iCNATz pr6TYHOwM5d8ENlgv53qPm/y8ONQjSmRQNhaXzABdSJ5RfIL3XcSa1W525SSpJb5iHyj nT6yR+fjJzUGzuAqO6ou/taXGFPfh5fSJZ7E3tqOx2CmSm4VZyYeAHqohao2cnKKW8W7 XAMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=R088D4z5RrGC3ENBq7NdeJMAQG6+Qk8mMWqAtHkj3hU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NITNPScXO5LiInSvnGHukpQTHJrpn+3rA3HF2wKOO7GPYtkVHwm4NCExDyttScxit0 l2BQnvvSNDfA9iTvTAsyFYu89Sd7zCHgITubcFCbJC7NQAWTVE1pCl9gyQt6IYyYzIJc fYuzCEF6pKo22tslV4qB7pgMUJrtnZ98dQHAkCQVZ1pKfIjSDGRMDM3OgYB+gj15NXlj HWSMb4TEhMIKR6oWxg82MXpSP1ADWZ/GOPVhdu6NrnmMU5BA9i97JuMuByuorYMnIXUy zphQePoEQCPB1pcvs6EjeuaLwchFhVIte+2J/YhIhwT0ckR9xBdOT1OT2obZgPCIP1SO 95XQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NGmBAZjW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f9-20020ac87f09000000b00436d9cdd2b7si17126884qtk.245.2024.04.24.16.46.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:46:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NGmBAZjW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzmIO-0000zK-1s; Wed, 24 Apr 2024 19:45:00 -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 1rzmIL-0000xu-Pm for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:44:57 -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 1rzmIJ-00028k-KW for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:44:57 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1eab699fcddso765565ad.0 for ; Wed, 24 Apr 2024 16:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714002293; x=1714607093; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=R088D4z5RrGC3ENBq7NdeJMAQG6+Qk8mMWqAtHkj3hU=; b=NGmBAZjW2nAX4QNreICv7m5oY0gQdJzr6eS6ToqBk+4lRnF4wgat2JZLzrpxI+doV4 UdxNSK1/cPhCI6i7xXD/r/zsixI5nBfOAOfb7Rt5XIfH4/ulFsPaOBgxa4zm8brb/0jA k2RIdwD1C8QR9hXUeanOtHC+GNgFM2YS9qofiRngMbRlaGXGQMQYJSt97bkcvscqhELg kb5jCqg5yNri/Yv/kW3fZgMJWvlJcHAQp5w5n/mNOr7lyWFRdGZj3hplC3bsBCSsjh2Y LUrSHiTm7JFVjDzs5MnPetL0DZPcZ7nbue+tQt2IfyILOssDxWfnojEdyz1G/gSW88f2 HfoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714002293; x=1714607093; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R088D4z5RrGC3ENBq7NdeJMAQG6+Qk8mMWqAtHkj3hU=; b=bMlOC2vlG482IjmEEVJSKJgF69Rm1UUCo4RwxL0IceGD17FM2LjSEMKAFocZeq/hCS 5inyUCcwoRG7ZRSXFUnk0ns6dL1as4+gAk5EsugrWbzqf/9/LhQlKQQEalpsC2VKbxuR XDS+/QxA63Ys/PH915sCGHN8sW+pizdn5eLWH+Zw4+pF1n8e6W1cl5sSq/b4QCtxeKSC +w+9wNxprBDHx4rdXrkeg5sv9vVG27FbN6hWtC4N2DUqQ1AqoQ4e9IntEvFVPBvvaQgK q1bmCT2dZcgg0nemhqqIk7PeBxc/+dCr850hQp8grLcLtU8s5HsUIPRdV9l+RqZCT7Dn XMzw== X-Gm-Message-State: AOJu0YyheD+Zv0KPWD32McAAa5GxCuu46U1YmJKq1WmTTAogs+z16YxN XeQql/usI/Sx84KY3R3XzmUz1MwvdB9xUuY950bKF0+n/+RDN/JhzIhjGcYNyxPSgDWpWum00Wh Y X-Received: by 2002:a17:902:e848:b0:1e2:7fb2:b08 with SMTP id t8-20020a170902e84800b001e27fb20b08mr4856036plg.43.1714002293636; Wed, 24 Apr 2024 16:44:53 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001e49428f327sm12531642plf.176.2024.04.24.16.44.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:44:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/5] target/alpha: Split out gen_goto_tb Date: Wed, 24 Apr 2024 16:44:34 -0700 Message-Id: <20240424234436.995410-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424234436.995410-1-richard.henderson@linaro.org> References: <20240424234436.995410-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/alpha/translate.c | 61 ++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 52c2e6248b..c1a55e5153 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -425,60 +425,45 @@ 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); } /* Notice branch-to-next; used to initialize RA with the PC. */ if (disp == 0) { - return 0; - } else 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); - return DISAS_NORETURN; - } else { - tcg_gen_movi_i64(cpu_pc, dest); - return DISAS_PC_UPDATED; + return DISAS_NEXT; } + 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(); - if (use_goto_tb(ctx, dest)) { - tcg_gen_brcondi_i64(cond, cmp, imm, lab_true); + tcg_gen_brcondi_i64(cond, cmp, imm, lab_true); + gen_goto_tb(ctx, 0, 0); + gen_set_label(lab_true); + gen_goto_tb(ctx, 1, disp); - 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); - 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); - 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; - } + return DISAS_NORETURN; } static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, @@ -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 Wed Apr 24 23:44:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791617 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1110782wrq; Wed, 24 Apr 2024 16:46:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVj+9DMuM81aHMPf4B8N3y0X6QiVwL08k8tqbms9NOcV3XOFkLJ4mjslODB6y2n8yz3NbIGEcW2AfZbidEi2p1O X-Google-Smtp-Source: AGHT+IEcYE6f/flu0QeNvqfBPHKXHVwJKWal4t5IEasiPDzYzr0P767R0Ae5nRUA1I8JVzJIoZvI X-Received: by 2002:a05:622a:1921:b0:434:b823:1b48 with SMTP id w33-20020a05622a192100b00434b8231b48mr4300817qtc.50.1714002407799; Wed, 24 Apr 2024 16:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714002407; cv=none; d=google.com; s=arc-20160816; b=T9vX0z2uMZewv3billtX3bxMAOWTWe7IHXx6t1bNwya+6k3gPlZBqgN3Yq2dhsODzj umWqxcqbx2KJKj85RuN2W/PqirtT25dyxgcHjwn5RjnbkVx2u7ppPOjJgQ9Fe9RmTBmo SKaGo0MB7SmsMI2ravcS82jxjfCJAZMGUUwcH4ebv2S0KMsYg7LtnyJvIYpdmJgV1r15 6l0gLo0BUWbBvcK8SDZmC7xuj+IckqddFKPYROu5pKyNEgyO/em7L6qidN91WKtrk1qk HCQz1cMuyFCCMFbJwp8iRcpISzDsqbEfBiWofPEoR9SPMwJ9acGffXO+HTy8PjgBWvio 36XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JlF9yvG1tLc13jMw+Ez3fV/BsqlR5r0EuFKx522bnZo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bt3BEfbuVh9YOpPOA7Felj8e0ouKfThLPl0nu1hs8av1ARjPr9mWgOsXxd3k8gasvn Qnkeoo3m4IwHpzCJkJmnRBUbCF9uqRevnFZv0VntIyNcu+cIOxUkfksWfVAE1ZmV5UMu 9ehR2hmQi/Dhb2JAIxx2O8UDfsbArb5c7GTCVnrPawSTI0YiCHGCkgPfVtKujYChmVlI E32He6kw0DpN7hyzUdfhxtbzYf7qEIHk/4mFOlrt+JInv7wpmXViBwjJDLfYYxAdyoDA 3kBAQR/8jWLHaGWg78p3xGXmvf7WD2hRzjkSoo58eMnGxcIKdyPYBCW4cAb1M6OS3d/S 9M1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xf4Jx93B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dh5-20020a05622a4e0500b00434a267ddafsi15067711qtb.588.2024.04.24.16.46.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:46:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xf4Jx93B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzmJA-000182-NY; Wed, 24 Apr 2024 19:45:48 -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 1rzmIe-00013I-HR for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:45:22 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmIS-0002AS-R3 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:45:09 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1e411e339b8so3245605ad.3 for ; Wed, 24 Apr 2024 16:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714002303; x=1714607103; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JlF9yvG1tLc13jMw+Ez3fV/BsqlR5r0EuFKx522bnZo=; b=Xf4Jx93BGQgaFgNC/2KdpdvncCH8K2VWWRnLThuKSUsp8jrijtqb5abO6g0FWdUecn yn1PG5HdMI+9IGZxOrz3883zXh7tUN0rlfAYzyZxxWWXRWbgeBQ6NIEOeOK6yWzU8cWs E4d2l3g7pC5DkTMXTRbmntayJ+StbHhE9oq1/RrvzuQmNAg5FA5l4vohbNIZ5MyilgDM SUipHFXPI0GfAyJ67D+qYtfDhMLEehQt5xODcPQtAD52/nzP69eA1yuFsY1V3ooY+kda qiz8yoFfbU/nxdbrM3/3Hw8xLQ501Ql94ZHynI5upp7NwmhcQqv9kcenPcevNxabxxEp q+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714002303; x=1714607103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JlF9yvG1tLc13jMw+Ez3fV/BsqlR5r0EuFKx522bnZo=; b=AL3tsF2NhyTQYuP5EOe4W+DSkNVR7uPkx+L0ITLR+SapMDD/CoZ8RA84iz+r1AjtA8 UBxt1LeKnuWKX2Xe3KtbAY++eKken/hVkC75SdhoqlX1CSOeZxDkCR55haFd4KMdGErg tmD1TKf/J2JxddizPA+BbCKS33yrlBEEQ8FO4X09rZYLPZRQpz6wF4Tl0XKgj2Jzdkpc o1WF7RCkublggV8ISbtOYWOs7K/oXE+QwibxceKUhK0u6251SVrS+8yKcA+zvVvGAWln wzNY4DHrWrrU4pNzrgz9mOg9k40Ss1ZXyVpvnYo/2nzxfPVRtxaeCyyypkz9zg6wOjlJ DAhQ== X-Gm-Message-State: AOJu0YzAvPoEr8wOALjPyEj/gBfYih9ggxe6YqubrtaIkbDU7PyYdENh 02IZgOm9ibS+temZjrvyd3kdldS0poVntn9zYpcZ8FNEEdkTjZOnZ5sNunhFicFp6IeC6b8DBky d X-Received: by 2002:a17:903:22ca:b0:1e7:b6f4:2d75 with SMTP id y10-20020a17090322ca00b001e7b6f42d75mr5699216plg.6.1714002302734; Wed, 24 Apr 2024 16:45:02 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001e49428f327sm12531642plf.176.2024.04.24.16.44.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:45:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/5] target/alpha: Split out gen_pc_disp Date: Wed, 24 Apr 2024 16:44:35 -0700 Message-Id: <20240424234436.995410-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424234436.995410-1-richard.henderson@linaro.org> References: <20240424234436.995410-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Prepare for pcrel by not modifying cpu_pc before use, in the case of JSR. Signed-off-by: Richard Henderson Reviewed-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 Wed Apr 24 23:44:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791614 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1110683wrq; Wed, 24 Apr 2024 16:46:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX74W2y93XIXB/ISUoX9emLeEaFaAvXnQJWMc01oeESzAidfAnfEk4k3spgx2NHCpOCWvoZtf0AqTHGQro0spQb X-Google-Smtp-Source: AGHT+IEqkClefQUFzXGf+QMvk+aYVeFJ9iR0C8OSswT3RD4/iExmU5x1BEmLAxh7B/UdqY1lF+Ic X-Received: by 2002:ad4:558a:0:b0:69b:24f2:c2eb with SMTP id f10-20020ad4558a000000b0069b24f2c2ebmr3945685qvx.59.1714002386268; Wed, 24 Apr 2024 16:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714002386; cv=none; d=google.com; s=arc-20160816; b=DE2GRzKnyUta00c29lANjH19e7NYhoc3ybbjEsJxqtsx6gH0MJEtz18UTW3lrFOsK/ VqS1xIvfYB61bSeVOID0toW5G0nqAKyO0U/2vNf8im+c9i2lCfqA282zfeU+s/ZLh0ek xxut98MwTabKOSAIpBkpyF6f3pW2AFnWQeNVBmFRK9Te1LOVJdE80B+k4dj912lHQ1Ap +ByCQON/ELNgSRNzwHFv0QK5jYN1k7jqz2D6pO0y1X+XTzwD0c3j010t5cUVjv8uuxis LWoq+31L8hIPRfSL4Oj1m4PxWA0qbPkWlQgRNViB949MKL+7eYPmj1hG2S4KCSuanf+x Prww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+fYxFDEu9QUatBFkfchgNydxoYm4Cqsftsf9cDR/W3Q=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=EUGey+krnxzicKoHLA/nCLOS+NFVdjKr99D7fhR0TJTbFY99yONn80yHcS+kcDERqO PKlp46qz3pvm6xEc5g34KwzK+M6N3+7PXTSDekWlUMeH04UGl825muEhniDyz9rDe1TB AVSt/qQ1KhbHg4jkf/3nKnc1CC9yyBEQpT9NEI/wnFX/snFLn2asvfrxRUnDk2foV6dE b/ZRCikbL0IdyN0E8PNK1/MbLp59M5nNEnmBBv1op4YFEBbxP6Fi2FwyILnK5AaZ0CDn kiU0RmnaCvilRrYYKnbsxLjYBHi77+zyXi2SC4BuGG2Pm2KAw6DFgxOPMXkmZBkwYZAf 0H3A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FjsID58i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d10-20020a05621421ca00b0069bb4be563csi16943587qvh.609.2024.04.24.16.46.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 16:46:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FjsID58i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzmJF-0001Cx-GU; Wed, 24 Apr 2024 19:45:53 -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 1rzmIi-00013b-Or for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:45:30 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmIc-0002Lm-Tx for qemu-devel@nongnu.org; Wed, 24 Apr 2024 19:45:19 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-60275a82611so333889a12.1 for ; Wed, 24 Apr 2024 16:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714002309; x=1714607109; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+fYxFDEu9QUatBFkfchgNydxoYm4Cqsftsf9cDR/W3Q=; b=FjsID58iMBMDQywYxdXLmc/KZGgJRNP8mgU08ELBM7d0nTxoraNnV8d4MApqvqCiJ4 wO+wMacBUxnK4j3i+0qeqSScT0KxjZMFhl6zT2mgKR6uY+5vUF5mjr0klRIt0E+3BSbu sy55kp6+SuAg3N5/vkOxl4BqAkPUoS6WLLd+fzpuapcU3ZkxIGLn6ORpfITazHNrTAB+ in81g5IiUOh4h7aLl+B1u1pWjAN1EOmD7MSSw8H9moLR1gV3PPtY2SK7EZQhVtBx/bqQ k1SKjd4uic+0b9S0Fxug+V29C71GixcQdju20CHiE8kKuWUSxvLvtQYITYF6yVUVuJXk H4dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714002309; x=1714607109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+fYxFDEu9QUatBFkfchgNydxoYm4Cqsftsf9cDR/W3Q=; b=agb+7a/uzTG8SRYIk8c3ziHJuvipixcwAWjat2YwA31kYyCNmPF7UX7/mWJ85l6scJ j6gwv0SbqsdrEQu2bET2muEH7clWQPKJJ3M/q4fgva4QsZbTwAtKMcbWXitFBdhu06VL advHdZrzCaT8hqaz8WPlTNpKpM8jZu1PYT8IcXweDHQSUpbp98z25NsP+fQdiPk9fKvO oKTaJ+RsUUKk8EyNoejGuEHxYWHi/rug+m6KFFf6XSW8ze+bFWQfKaWVrS0q2L0+j+AS gH9A4vPz3BZMmq3bLBSXVkLWjuotLF3gU0rAKdaRLQHK+jbJYlmbenhZDSlWoGZVwTcV iogA== X-Gm-Message-State: AOJu0YxImD1puW55LQ+wXQUXLnB99+iXwAUk3cMXXNmPuoBE0McEZ0cq AJ/lSevC/fUeMTSm6xsyik3b2+2+V5MFGEwdQGQx3vcUavLgQHF1vBEaXZPTZGpnQP9mYXeOGp2 4 X-Received: by 2002:a05:6a20:9193:b0:1a7:7cae:24dc with SMTP id v19-20020a056a20919300b001a77cae24dcmr4858663pzd.5.1714002309294; Wed, 24 Apr 2024 16:45:09 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f55100b001e49428f327sm12531642plf.176.2024.04.24.16.45.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:45:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 5/5] target/alpha: Implement CF_PCREL Date: Wed, 24 Apr 2024 16:44:36 -0700 Message-Id: <20240424234436.995410-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424234436.995410-1-richard.henderson@linaro.org> References: <20240424234436.995410-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- 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)