From patchwork Wed Apr 24 23:59:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791788 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119623wrq; Wed, 24 Apr 2024 17:11:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZIVLJtSuvgyF6hcfoIg/CK/iXxrNXBp1NHWPheP4WsdpvdKdHbeoyF7j0kmP3q+tX+GGZUZm7ipKa+HkTqjQO X-Google-Smtp-Source: AGHT+IFzr7LV+YccnKl1WyE2lPxRju+r6xza7V16jp/8m0vwkBMtNiqybkFv2TI7TbxYR6k+RgBG X-Received: by 2002:a05:6214:2cd6:b0:699:23f8:1044 with SMTP id lf22-20020a0562142cd600b0069923f81044mr4328612qvb.11.1714003917714; Wed, 24 Apr 2024 17:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003917; cv=none; d=google.com; s=arc-20160816; b=zUelJHXy8i8MQDmjXfUB7As70BlIXdkMabc4i26/EPiz8+CJq+nU9H2o56wUST0/LE rbQ/sQ8Pwd4I6JrovFkR5AJaRDbtDY5n3eptBCv9Ls4NMv4NAGEZ/lBZxgnx/5PJyGdS wrLmrvQVdVPVTmrTd6nbnoqFxkI1UzNFUlpUcv/0t2bON7y335uMb0tsF2grm5gBJ9Ls 9Onz/uSewHlwXv4n3YV1aLveKI+eLt8CA7RC3ShqLGjENKPYMEvjGhTlO9i6KMRJPrSe em60RbrrAAeO4yW/YLHIe1kR6tGi284nZD3/48GSPgxoVP2jiiNyGFScjvlsAHKDQmH3 1+6w== 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=3ygFLD876CIrAdUeERdKDaK6OhehnvKPDKxHUBl+Z6U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZfBfoTxb9bF9aoqRDWba3leRPzTDNlyG4Nvk52xRrzJvs5DlB22nr2VAB1dt6mJkIt bN0P4kNYRExfbSGMxKmMEMYgOz/okeysnSw/3dr/f+ENXd5Q6lUJgbXrmGc7yGtbUAIV RLUe+/Ik8C75POkykGQTiMtZnTnKnDKNuij2x4+HMbsoEDnHLMQhaSdI6vFpWGks1Uep UHIup6PtX/uGUQGonSbKQYnRzT3ORdlCitRjZNLeCAuw+qeA1BNluRF7FSeEBEO3b+HS mC/CdIXENXrSrvt2RwsI42hO0g+vGoZHMfsnefiSBBYgD/cRUqmEVvDQ54zNydqPO69B lZeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lqE3RzEt; 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 jk14-20020ad45d4e000000b0069b6c12056csi16357138qvb.20.2024.04.24.17.11.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:11:57 -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=lqE3RzEt; 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 1rzmXy-0008Jd-VY; Wed, 24 Apr 2024 20:01: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 1rzmXU-00088j-NG for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:40 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXN-00068n-K8 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:34 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6ed32341906so488537b3a.1 for ; Wed, 24 Apr 2024 17:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003228; x=1714608028; 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=3ygFLD876CIrAdUeERdKDaK6OhehnvKPDKxHUBl+Z6U=; b=lqE3RzEtD1mVqEHzftl5wCNvH5HyfiY/uZuRQ0OdRuABVeZB2tn4FdNx1DgDZvCTcJ wz1rBhX0eps3Xs3ULnWw7wOqKIxgdMRwEYEqLmvZ/JaUg84SOVb26Rxc4pEJi8avDE5H F9TI1d+dBJHeTyU/mtqBrGctFk/jHphd788MFsyhUEU+5WNua6K5h36J0UlFVpK3xKBc VDdBwYgAIFMO7wcCB5dbxSX6NbfS9ahDHtMI9jMxWau/fH3KXtuA5Npgh8k5GXwVbYtg 9ezlluXvo1HCeJYur0rM1vByRfwQbCi9kY9TRG0wRemUs0M1XdMqpxRvXUUgsl7b/eHg Nbew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003228; x=1714608028; 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=3ygFLD876CIrAdUeERdKDaK6OhehnvKPDKxHUBl+Z6U=; b=beibRtv5Uirh392xAx6VuQoSErxQ3QQ2ayOOR5ERsH1ep6TJhtmPGZMRipK9W60gJ3 atc6+kUXQ15vylikDeR0/et5t+2ZSAslu1QSKpsiNlIAc7wXZnWNDPI5pa63JRDio12X xVL4uMColVKxaaHejsKMrKZ1TxTw/C2drBug36i+Xi8QnEUiUPbSzzyze31+ynPdvmxl m2rDYT+B+YW7jg+rEGhuUfunsrxSP1lOSq7asIYFLjvXTuzrqmMnMDrz4fpPySbpP13k w1KabGkO/6erknunQhe8ayJYg0mw6HJYjP69bQw7Y0y+cjCrmIG0/k7q2VFV6xkri4Lb jpXg== X-Gm-Message-State: AOJu0Yz7xH2FRk82EUX4IeJ3kCh90vwhXlPVEXQaEcbPEEzP3YNkMXOH FOaS+RBFeClDVkdoelHRiqSdrhgU23gC0/s3xFvp+MaIB8X75RFry4n9pNwldXnZj+LNr2W2Wy8 V X-Received: by 2002:a05:6a20:4392:b0:1aa:928e:62a2 with SMTP id i18-20020a056a20439200b001aa928e62a2mr5150599pzl.10.1714003227587; Wed, 24 Apr 2024 17:00:27 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/45] target/hppa: Move cpu_get_tb_cpu_state out of line Date: Wed, 24 Apr 2024 16:59:39 -0700 Message-Id: <20240425000023.1002026-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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/hppa/cpu.h | 43 ++----------------------------------------- target/hppa/cpu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index a072d0bb63..01dc8781a5 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -320,47 +320,8 @@ hwaddr hppa_abs_to_phys_pa2_w1(vaddr addr); #define TB_FLAG_PRIV_SHIFT 8 #define TB_FLAG_UNALIGN 0x400 -static inline void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, - uint64_t *cs_base, uint32_t *pflags) -{ - uint32_t flags = env->psw_n * PSW_N; - - /* TB lookup assumes that PC contains the complete virtual address. - If we leave space+offset separate, we'll get ITLB misses to an - incomplete virtual address. This also means that we must separate - out current cpu privilege from the low bits of IAOQ_F. */ -#ifdef CONFIG_USER_ONLY - *pc = env->iaoq_f & -4; - *cs_base = env->iaoq_b & -4; - flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; -#else - /* ??? E, T, H, L, B bits need to be here, when implemented. */ - flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); - flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; - - *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0), - env->iaoq_f & -4); - *cs_base = env->iasq_f; - - /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero - low 32-bits of CS_BASE. This will succeed for all direct branches, - which is the primary case we care about -- using goto_tb within a page. - Failure is indicated by a zero difference. */ - if (env->iasq_f == env->iasq_b) { - target_long diff = env->iaoq_b - env->iaoq_f; - if (diff == (int32_t)diff) { - *cs_base |= (uint32_t)diff; - } - } - if ((env->sr[4] == env->sr[5]) - & (env->sr[4] == env->sr[6]) - & (env->sr[4] == env->sr[7])) { - flags |= TB_FLAG_SR_SAME; - } -#endif - - *pflags = flags; -} +void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, + uint64_t *cs_base, uint32_t *pflags); target_ulong cpu_hppa_get_psw(CPUHPPAState *env); void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong); diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 3831cb6db2..1d5f5086bf 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -43,6 +43,48 @@ static vaddr hppa_cpu_get_pc(CPUState *cs) return cpu->env.iaoq_f; } +void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, + uint64_t *cs_base, uint32_t *pflags) +{ + uint32_t flags = env->psw_n * PSW_N; + + /* TB lookup assumes that PC contains the complete virtual address. + If we leave space+offset separate, we'll get ITLB misses to an + incomplete virtual address. This also means that we must separate + out current cpu privilege from the low bits of IAOQ_F. */ +#ifdef CONFIG_USER_ONLY + *pc = env->iaoq_f & -4; + *cs_base = env->iaoq_b & -4; + flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; +#else + /* ??? E, T, H, L, B bits need to be here, when implemented. */ + flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); + flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; + + *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0), + env->iaoq_f & -4); + *cs_base = env->iasq_f; + + /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero + low 32-bits of CS_BASE. This will succeed for all direct branches, + which is the primary case we care about -- using goto_tb within a page. + Failure is indicated by a zero difference. */ + if (env->iasq_f == env->iasq_b) { + target_long diff = env->iaoq_b - env->iaoq_f; + if (diff == (int32_t)diff) { + *cs_base |= (uint32_t)diff; + } + } + if ((env->sr[4] == env->sr[5]) + & (env->sr[4] == env->sr[6]) + & (env->sr[4] == env->sr[7])) { + flags |= TB_FLAG_SR_SAME; + } +#endif + + *pflags = flags; +} + static void hppa_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb) { From patchwork Wed Apr 24 23:59:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791749 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115214wrq; Wed, 24 Apr 2024 17:01:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6LOcIw3dngYtVLFqJa3Y2/WvxH1LpnOLLJifyooR5FUHUghQWq9QCbFw1dHLyOE3DVgEFamI5zfoTrq5OpeTS X-Google-Smtp-Source: AGHT+IF8AW7b5EJvkRy0RFrwq3cAcW/rLA8zHRdbOl/J2dllmhRR46aYnG+0J5xC7pXDKTwy5AaW X-Received: by 2002:a05:622a:1355:b0:43a:315f:86be with SMTP id w21-20020a05622a135500b0043a315f86bemr3231760qtk.43.1714003291927; Wed, 24 Apr 2024 17:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003291; cv=none; d=google.com; s=arc-20160816; b=G1Tr6L+xhVRL5WnsCybC/aLXVxTM4fE6GE2fp3Nn8q1p+yyDqRmH/mbqIrYKE8hwP/ 5dxjJVU949zBV02CQBimpKbzpEQyqZianKDjpOArCuqtgbfW/k+3bt8yARqFr4rezrc6 lHgtErF5IeRFJDM31JHgxy6HlW00iY0ofqPi6bJS35Y7qc2d8Tam+TJjIyqZtLxCMLXF JEtXMnQ4fk/1mbjUIUsivCUQw0szp8KAvbEM0skrWxM5TLuqaBx1pskiEyZXuUYfL0QQ UAUnUt1zGA1aEOJqxtFBwLu+0saB8Qc53V4bdZexf6eD53F7sNHXxGzrRfeR7F9QbCF9 6A9g== 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=sPOPP89zz2v/sO50UiLzGptqHlTjqXVxcZh0h8hT7xk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=P2cuwCCI+aoXND0cpywgtSASoH4vwP2y2HmENa0MOdJDYTbscHtDu+Z5Z9mCU+wREw tFuDmd0kybLlkJvBkU+ftUUfaEK7OELz79iUTdlub1F63P2MnjQ7j7MG2fqh9xrIRkPK bObSNGogUoex0A34CwCtP10U3Hmb+vsgw0fciDNtSZl3TsufFrRwuFLgabR89tEPpwT3 8Afm+vvEliabVkh95UOQv6I7Ayikb3TCWEuMOvKEUBscw/c+eDDzS5zsRlwPohpuDURP 1ardUbmk/9cTqUN+JD8S9BOyckHFyVyYVP+KWmV9GrmnHataVJacmG++oSSFWf3ptm2k qYzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JBykPiAJ; 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 cn4-20020a05622a248400b00439d2f2fac7si7074467qtb.70.2024.04.24.17.01.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:01:31 -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=JBykPiAJ; 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 1rzmXr-0008Ft-3v; Wed, 24 Apr 2024 20:01: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 1rzmXT-00088d-0e for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:40 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXP-00069g-Pg for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:33 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e834159f40so3377415ad.2 for ; Wed, 24 Apr 2024 17:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003230; x=1714608030; 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=sPOPP89zz2v/sO50UiLzGptqHlTjqXVxcZh0h8hT7xk=; b=JBykPiAJJnOAEdAqdZgEDVp0lK3YxwrCv4E35xwBcl118yZyoEzgidsOIxcaJsArbZ H3z4nIdew8OR4jv4B7U37lfzsNdlhCbmkhp5GOTNV8kVwBH71GOIc1tHEfwZAMSfDdkF Wik4Ex4sNA3UQUH9epp1L0o9A0Kv9NCRL/+49FvL9UG3K7JVeAGNd8+xybhsWD4qTNEr +AvDuLXLNf2YFvfnjfXl5jUwAeIqBLDeTt6Faze+1K8V8QAm4E8oEs2Au81x27kPX4OH V0pniLUvYyT/L24+0m2JFCkq/sT1mYtc2y/K6jXmBl0cwaoSk0u7Cyn0PiWUmIoPHCIc pF3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003230; x=1714608030; 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=sPOPP89zz2v/sO50UiLzGptqHlTjqXVxcZh0h8hT7xk=; b=u4BnaWS50Yrh5JuCTew0FZCTt8oMMq2lgcnEs+DooM4ihuwRP6mbZ7LRakOD08WpRW rYNaOnnVb+MtUAt6c4xqlN3XI8+ESffrusCTosjceMXPgNz4Y/ZTMiKnWtP3fWgk+EfC pRxH6qnWw1vpIjoayzIiemp4pisYtUoJpMW77MlWbY9ys+WlOq0CyRUauVwTy9IMONvx r1zCzQDe0uwIr8bXBzOGgBdnOPayVAVI4DiVGytCrmSMefHtbJJLBCLj9KpJJmPCfqAV TwIUg1zkeSItlgYITHTfyocDjQDqNFy3Iygthn3FNG1jPJwOufiboFUX6zw8yEJVO34w jGGw== X-Gm-Message-State: AOJu0YxJ1LQ6y+ZIemLatmpiGgEtk2WAyNXnqFeH99LJyz6xrjSJNCd/ AW+eYqUgmtY4YGCK0cNnmXpIOaGbeV/mDqLKPJjuuNUuXSq8HE1urknQeIiiqPEy7cA9b9E6EDN v X-Received: by 2002:a17:903:28f:b0:1e5:3c5:55a5 with SMTP id j15-20020a170903028f00b001e503c555a5mr5186794plr.8.1714003228481; Wed, 24 Apr 2024 17:00:28 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/45] target/hppa: Use hppa_form_gva_psw in hppa_cpu_get_pc Date: Wed, 24 Apr 2024 16:59:40 -0700 Message-Id: <20240425000023.1002026-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 This function is for log_pc(), which needs to produce a similar result to cpu_get_tb_cpu_state(). Signed-off-by: Richard Henderson --- target/hppa/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 1d5f5086bf..7315567910 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -38,9 +38,10 @@ static void hppa_cpu_set_pc(CPUState *cs, vaddr value) static vaddr hppa_cpu_get_pc(CPUState *cs) { - HPPACPU *cpu = HPPA_CPU(cs); + CPUHPPAState *env = cpu_env(cs); - return cpu->env.iaoq_f; + return hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0), + env->iaoq_f & -4); } void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, @@ -61,8 +62,7 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; - *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0), - env->iaoq_f & -4); + *pc = hppa_cpu_get_pc(env_cpu(env)); *cs_base = env->iasq_f; /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero From patchwork Wed Apr 24 23:59:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791762 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1117604wrq; Wed, 24 Apr 2024 17:06:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUuK+07x1neMMGYX1T2lRwYV5JD/UrH8pije5+xtI2h2o7mmRhBlmLg6VyFVLb09KQjIlqnTIy7bdZmbmjHqqbS X-Google-Smtp-Source: AGHT+IF1eUq2wyTxYV7r0CWA0XX2rmWCf/WAUWGe3n2Jvj3tDlRqxCApkTh+cdgwWiJo9x2v3dn3 X-Received: by 2002:a05:6359:4195:b0:183:4336:b901 with SMTP id ki21-20020a056359419500b001834336b901mr3532266rwc.5.1714003594887; Wed, 24 Apr 2024 17:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003594; cv=none; d=google.com; s=arc-20160816; b=kJV6IVPs9wz7l0iViTthPJdtT5rvUfjUA7kr1eaqbHerdqwvknPgNKKRkp4tNiLqvV KYqUpMe+hC3lxtc1nYNEwx+Ugoq0u7I6mCQHzMKbnt5O1I/Iy7nu8p5S9DXCxP+/s/Vm d6rVkw5gf8q/4F6lfufy3942enqgE242q9QAU9WMq1jUQzlfk4pVIcskoqx7t4jrEN2K yde631UXf2aOf/SMfkIxUzL6B6qEAHT0n1t330XSS71f/LRiTSe/AO/2cPyUAFrkcZ0X Buz30xMMqkMA3Fbqm10iqsdRbIxs26TRPuM15+A/I9JsQChZtKx91WSFiSHIj8qaVhUP brfQ== 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=Vx4Crlv1lb77eV2HoyqdyEXNFf4xuelX5wyOlguT8YE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=qz6WNYFfahDe/k1otgMkbJtJ1kHOFdMUaZzwoxgfidtTv3DAUcXbT1sMqH5zbnTTJ5 jXRODkyM+Cz5ON0eAVKK9vxQeFb9UtUeKmmIwGis7FUulgkLErsGOW4d6AsLyGhBt0ou 6zNPPVpsGKEcLaS+CymIVDJwaE9LnLsXi+pu0RLz9rJQt2BplPyCN3DF6i7TuBr8m59k Mdtg3OB1QGZP4+xQ4jN4MeTOH6ZIplKDX9MiH3db50r8Etlp7JzVaRek0sOpdnT1HOQN RgyJZkjCABCiGjv4cYbSuKMAQ3xPyfhW1koqJg567xprRorc5OEC/UCXBdDjn/+qHa7x qtRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pXU1Ybqs; 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 p18-20020a05622a00d200b0043a1cb26e26si2837946qtw.422.2024.04.24.17.06.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:06:34 -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=pXU1Ybqs; 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 1rzmY7-0008Nr-UO; Wed, 24 Apr 2024 20:01:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXU-00088h-B3 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:40 -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 1rzmXQ-00069y-9i for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:34 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a58209b159so389516a91.3 for ; Wed, 24 Apr 2024 17:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003231; x=1714608031; 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=Vx4Crlv1lb77eV2HoyqdyEXNFf4xuelX5wyOlguT8YE=; b=pXU1Ybqsnd+ITC99TXMMhhTdSYu/aq4Fh8SKzDoI57t+AHSALJ1FGfS6QxI5MppGFq lUr/bOul2USYKDrLn9D82HbdnEnNKTknqq1fnKpPT+H/nciN3LmctC3oxOU5fyNXCuAj Kef2XCi+Qr3V/Vn/sHRNPKZ/8YvKcRZZAg0sgeNaH6bCyOANSWfGBLLuJ2hnyi4ODCmb KgOKhEEnCDFK+nemx4y0eOHQstDmp4WoTU7yBDlOWXcX3/asIbygduyCRWAVfd9SOjUa LZHdudY7d1ziIQHTg5XshBqzHENszBvc+pWNkLbZdo1fTcPdMMKcMf65OBiTKJpyx4K5 xBfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003231; x=1714608031; 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=Vx4Crlv1lb77eV2HoyqdyEXNFf4xuelX5wyOlguT8YE=; b=eqJ98uR4wS3BeXCKoUpXJ44IY7v6lhSp6raMzryYRndMOo+kNMhfSzkH8lCd8NwFnx f3jSS/UADgV4WPBtbzWOouMCIT5D4kKNu98lnTJeJetMOLtXVrPb6Fn8bWMdlu4VoeYu UQzAFpqvs57nBlBo9k8ABYlfv5QsEnao+LCFDTqx+S2ABGIx+qtgnNl+ZI+zBZIkiv7X XKZmx5GkdHYHpGycWo55wa+Ag+azL15GOmdOV51kh/Fh64RZVss5WRRB5tnz7ho5F6vC QbG2/8FYKOy/ynAd3gqE3oMwoc/dBKGUho2YuloKH42xtYrORkZKQKgsjMSgwj6uoUC1 grOA== X-Gm-Message-State: AOJu0Yz9BrGcza0AfZyAvRFV7huvR1FvNYccNaVsKxJTpp8YncR88ZZM mHnWVYxgM5KJo+MCTO7bFhrQDIg8x1IDerlQVrCJDS9/utQA3xyndRxYH2+Dqzcz8t5HjXy/Y/L B X-Received: by 2002:a17:90a:c404:b0:2ab:de86:d667 with SMTP id i4-20020a17090ac40400b002abde86d667mr3736416pjt.48.1714003229321; Wed, 24 Apr 2024 17:00:29 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/45] target/hppa: Move constant destination check into use_goto_tb Date: Wed, 24 Apr 2024 16:59:41 -0700 Message-Id: <20240425000023.1002026-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 Share this check between gen_goto_tb and hppa_tr_translate_insn. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 42fa480950..cb874e1c1e 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -661,9 +661,10 @@ static bool gen_illegal(DisasContext *ctx) } while (0) #endif -static bool use_goto_tb(DisasContext *ctx, uint64_t dest) +static bool use_goto_tb(DisasContext *ctx, uint64_t bofs, uint64_t nofs) { - return translator_use_goto_tb(&ctx->base, dest); + return (bofs != -1 && nofs != -1 && + translator_use_goto_tb(&ctx->base, bofs)); } /* If the next insn is to be nullified, and it's on the same page, @@ -677,16 +678,16 @@ static bool use_nullify_skip(DisasContext *ctx) } static void gen_goto_tb(DisasContext *ctx, int which, - uint64_t f, uint64_t b) + uint64_t b, uint64_t n) { - if (f != -1 && b != -1 && use_goto_tb(ctx, f)) { + if (use_goto_tb(ctx, b, n)) { tcg_gen_goto_tb(which); - copy_iaoq_entry(ctx, cpu_iaoq_f, f, NULL); - copy_iaoq_entry(ctx, cpu_iaoq_b, b, NULL); + copy_iaoq_entry(ctx, cpu_iaoq_f, b, NULL); + copy_iaoq_entry(ctx, cpu_iaoq_b, n, NULL); tcg_gen_exit_tb(ctx->base.tb, which); } else { - copy_iaoq_entry(ctx, cpu_iaoq_f, f, cpu_iaoq_b); - copy_iaoq_entry(ctx, cpu_iaoq_b, b, ctx->iaoq_n_var); + copy_iaoq_entry(ctx, cpu_iaoq_f, b, cpu_iaoq_b); + copy_iaoq_entry(ctx, cpu_iaoq_b, n, ctx->iaoq_n_var); tcg_gen_lookup_and_goto_ptr(); } } @@ -4743,8 +4744,7 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) /* Advance the insn queue. Note that this check also detects a priority change within the instruction queue. */ if (ret == DISAS_NEXT && ctx->iaoq_b != ctx->iaoq_f + 4) { - if (ctx->iaoq_b != -1 && ctx->iaoq_n != -1 - && use_goto_tb(ctx, ctx->iaoq_b) + if (use_goto_tb(ctx, ctx->iaoq_b, ctx->iaoq_n) && (ctx->null_cond.c == TCG_COND_NEVER || ctx->null_cond.c == TCG_COND_ALWAYS)) { nullify_set(ctx, ctx->null_cond.c == TCG_COND_ALWAYS); From patchwork Wed Apr 24 23:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791787 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119617wrq; Wed, 24 Apr 2024 17:11:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXJqdoPVdAq81ZqjPKJG6kOIs2AuRQw4lWEbmanNFqEJpzJdCJX9H6UAw5rQ0dG3nGTQEoJC1AJvwWdIe5Tau04 X-Google-Smtp-Source: AGHT+IFJ9I2Lm+oNQUGmOcYUdVLXaOm4+u1rIgLhX7hpqO/QhJ9UcFm8Q1waqnWKDJknQy1YpFen X-Received: by 2002:a0c:d643:0:b0:699:419a:fb7 with SMTP id e3-20020a0cd643000000b00699419a0fb7mr4063740qvj.15.1714003917028; Wed, 24 Apr 2024 17:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003917; cv=none; d=google.com; s=arc-20160816; b=PL0XDiyRKfE/OOVGAHVcHCgT5I2N8Yf5z40lFQjdUYvNI4ft/YjKUBeIt5jmuBQQAx o6BOMiYQAbTr3fZVT7G3+bHd1rpSOUACbMYlhU2zvpyizJqnoQJdAdoJWO8zWxqm4Fcv q6fJtqbfIBYY7c9fLwgmxhngXRt9VCglvOQ1pec4sh5GH6pWIIqDe4SjkEXvT3kIF5a6 dW+6MRB5UoepFVbDryhCQRG7mT/MZzJs1s+Ym56Rga5QnzXRUfWVmYja5lhS7qI/A6kG Q1AJsuy0G35rp2tYctIdunEj1BUKWGfmz1bcJn2ZzNLyvLpDPjE5j3Vic4FR45ePlZg4 AMmA== 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=mQ9zdVg0xUYM0d85EqWf/ZeSMSQay0WcihJzo1lOuI4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=sIWY5v4dRjKTqLApMd7fSf2Ne6Y/o94gPon1ldXSBO/y8Gn3iGqXztRUw65h4fTRDa g4fIB4+tKcf5MasPBq5+xShyU1ZaIBxax+kYsuuLklZ+1c4ATJEyU+CeOw4i0SBAx/w5 6J4dFP93ouDILz0DH8vfp03muA/6zT7VXjaixsB5cPvCwKilFQTYB+80iOwAZK2PXKlj bgeCr7KqgpT2yzXrtUg7mOOFhIFSsKGay2g4rgelXUmP+3eWg3AArqI3O8Ktyj0rQS56 6B2J28sVYfrYlUuwbeLRxxNCEddAh9uwBjzdKG2FuH+ahk8SA5MUdcffoy1+dm70fjQn lASQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dSMMUOoo; 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 g1-20020a0562141cc100b006a085e4a654si6601712qvd.352.2024.04.24.17.11.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:11:57 -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=dSMMUOoo; 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 1rzmXy-0008JV-GQ; Wed, 24 Apr 2024 20:01: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 1rzmXW-0008AP-Uj for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:45 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXS-0006AO-AI for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:37 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6ed691fb83eso403101b3a.1 for ; Wed, 24 Apr 2024 17:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003231; x=1714608031; 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=mQ9zdVg0xUYM0d85EqWf/ZeSMSQay0WcihJzo1lOuI4=; b=dSMMUOooLFpm1qDTpa/UuCDr7oo7sJWdtJ1j8S7Ttb2UpRM2Fs6CAlp6IErJWQtvxE 5ntrBXkrVOj1bnCuc3lI3tLQLK1Da6j1IDxTkpOSXLB+359IIdZ4qfHID7/YGM9s0rat KFp3ndx/NcfGBq2+6ZfTdQYHJh82Rz6QdgDTFiAUqrqsSrhWYkPVBe+rV34tScYv+/uc 7xS4n+X8lztwCWARNAsX/3WS65DTh0pIK64IXTmmvdrXDM8ijWM/QyAaH6UFL6CcnWnt FfYp9zhc0vSUBkc7ikGzcrL0X9IEQQ4GFPzRT6bI/DzRRicE7uIgca6QTcVGUAFVCC1g rcQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003231; x=1714608031; 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=mQ9zdVg0xUYM0d85EqWf/ZeSMSQay0WcihJzo1lOuI4=; b=vjlXLU1pXevodQ5Ej+7byN9bUXl+3qd6ACQLlWajt6o6D5SHq0VsRItYzo2etaoblk vZeEErKzWH2mr14MaDJgnThSd9itiZcVJX9FaRKKkcucqiqFpqbC1w5OChxxGmJE0XHf CtN3SLhfhJgDH9lIAt3Lmn+CWbm+d7ndOefthZv479hDwGZP3+T8Lnv7vUG+lQP91LC2 7o1k7CNf1YR99XzabzKXGqJfNKSf6sW/aJNGNChrRHTfe4WWnjBz09YIGT7FIFcyjqej syGovzYfy876FAXWbe4tldzFPOUuK1/161By64vcIaBEmj5yRHtSdcg1ONzy8gw/JCy8 hBkw== X-Gm-Message-State: AOJu0YwLcYjbMD+6wbcIjkT4CenxxG60gB/d2u0mrbtQf8GhbKeF79hV aBQRU2+0SFhSbqZwYW8mPHdtTI39yFUDwZyG61rN7wFjqJR2PzyiKMEsYbTDifwQAOkxoQ/jdXP w X-Received: by 2002:a05:6a20:5b12:b0:1a9:c33f:224f with SMTP id kl18-20020a056a205b1200b001a9c33f224fmr3828042pzb.16.1714003230122; Wed, 24 Apr 2024 17:00:30 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 04/45] target/hppa: Pass displacement to do_dbranch Date: Wed, 24 Apr 2024 16:59:42 -0700 Message-Id: <20240425000023.1002026-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 Pass a displacement instead of an absolute value. In trans_be, remove the user-only do_dbranch case. The branch we are attempting to optimize is to the zero page, which is perforce on a different page than the code currently executing, which means that we will *not* use a goto_tb. Use a plain indirect branch instead, which is what we got out of the attempted direct branch anyway. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/hppa/translate.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index cb874e1c1e..cbf78a4007 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1765,9 +1765,11 @@ static bool do_fop_dedd(DisasContext *ctx, unsigned rt, /* Emit an unconditional branch to a direct target, which may or may not have already had nullification handled. */ -static bool do_dbranch(DisasContext *ctx, uint64_t dest, +static bool do_dbranch(DisasContext *ctx, int64_t disp, unsigned link, bool is_n) { + uint64_t dest = iaoq_dest(ctx, disp); + if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { if (link != 0) { copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); @@ -1814,10 +1816,7 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, /* Handle TRUE and NEVER as direct branches. */ if (c == TCG_COND_ALWAYS) { - return do_dbranch(ctx, dest, 0, is_n && disp >= 0); - } - if (c == TCG_COND_NEVER) { - return do_dbranch(ctx, ctx->iaoq_n, 0, is_n && disp < 0); + return do_dbranch(ctx, disp, 0, is_n && disp >= 0); } taken = gen_new_label(); @@ -3913,22 +3912,6 @@ static bool trans_be(DisasContext *ctx, arg_be *a) { TCGv_i64 tmp; -#ifdef CONFIG_USER_ONLY - /* ??? It seems like there should be a good way of using - "be disp(sr2, r0)", the canonical gateway entry mechanism - to our advantage. But that appears to be inconvenient to - manage along side branch delay slots. Therefore we handle - entry into the gateway page via absolute address. */ - /* Since we don't implement spaces, just branch. Do notice the special - case of "be disp(*,r0)" using a direct branch to disp, so that we can - goto_tb to the TB containing the syscall. */ - if (a->b == 0) { - return do_dbranch(ctx, a->disp, a->l, a->n); - } -#else - nullify_over(ctx); -#endif - tmp = tcg_temp_new_i64(); tcg_gen_addi_i64(tmp, load_gpr(ctx, a->b), a->disp); tmp = do_ibranch_priv(ctx, tmp); @@ -3938,6 +3921,8 @@ static bool trans_be(DisasContext *ctx, arg_be *a) #else TCGv_i64 new_spc = tcg_temp_new_i64(); + nullify_over(ctx); + load_spr(ctx, new_spc, a->sp); if (a->l) { copy_iaoq_entry(ctx, cpu_gr[31], ctx->iaoq_n, ctx->iaoq_n_var); @@ -3967,7 +3952,7 @@ static bool trans_be(DisasContext *ctx, arg_be *a) static bool trans_bl(DisasContext *ctx, arg_bl *a) { - return do_dbranch(ctx, iaoq_dest(ctx, a->disp), a->l, a->n); + return do_dbranch(ctx, a->disp, a->l, a->n); } static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) @@ -4021,7 +4006,7 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) save_gpr(ctx, a->l, tmp); } - return do_dbranch(ctx, dest, 0, a->n); + return do_dbranch(ctx, dest - iaoq_dest(ctx, 0), 0, a->n); } static bool trans_blr(DisasContext *ctx, arg_blr *a) @@ -4034,7 +4019,7 @@ static bool trans_blr(DisasContext *ctx, arg_blr *a) return do_ibranch(ctx, tmp, a->l, a->n); } else { /* BLR R0,RX is a good way to load PC+8 into RX. */ - return do_dbranch(ctx, ctx->iaoq_f + 8, a->l, a->n); + return do_dbranch(ctx, 0, a->l, a->n); } } From patchwork Wed Apr 24 23:59:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791790 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119644wrq; Wed, 24 Apr 2024 17:12:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUU+lOt5LxCW8gCXXZKjYTwZ1XguOY8SAQ/JKZjRkJiEaT5DqwwAsv+KQzF5TuvT5nOEn/BmHeET6fRWPm7yb+o X-Google-Smtp-Source: AGHT+IHR2NP6ACNtWOp7DNSxd8LAwHVKGjBnRmJVEmlHJig9fXgyu4iMYKHFYB2bWOD6WBu89/1T X-Received: by 2002:a0c:fc04:0:b0:6a0:815b:1c84 with SMTP id z4-20020a0cfc04000000b006a0815b1c84mr4530411qvo.32.1714003920077; Wed, 24 Apr 2024 17:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003920; cv=none; d=google.com; s=arc-20160816; b=ZeyBHiPagVkPSTrF4rw7lAYEuUSJWONIWfb9kyLsgsgfK4X+hgo31TlAC2QMYQscRg 7iG+b4brwhW+ueZ36QV1lFkUlyrr1JPZ9mVQg4vhFVRqWOTuruumsEcksvZpdN7YVh6b d3YhmtiVQ151QIXGLctWvJ7XXgp7d5Z2/OGyE1uaTzkswsy3cEfN35nyyegVFXOoFHNK TPzpWX7pUuP+idbTZGau82BLBGCxI6aJ3Pc6a73MkIS8GyzFdSRf+QX1YBDkXVSvM3Of 3LVPDJk/qDmQ/h68/wY0RmV79VaZqVM+B/ebNpvbGM9E2Cfvrir+DZ8bsO/Kdf77q+F0 WFVQ== 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=JvZtT+b94F+EHwcSvNa04xBqeHxjFbplsfzPgMsFT1g=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=X2nu/2x/JNElD/4GqRlAM5+dQv27kGMwRuvWK0hAKxqb6Bf7uJSgEnKh3225DTeB/t iCmaItk1+W9ZpzHiZx8RBCypKheXN66LRQQrsSZSKd+kv2nuVLhuJnPIGX3iH5QlSZ0E TXIweAyMWsfWuss6/qwym5G0MTzc6Ao8b5oRm/nUG5BXhV6h5KoGoXHfDkRrmujAMAQG d1iDSLON8iqSD9OdgiGo1+lOz+h7vbZpAWTdVL43Iucu5xyyGMYRppsuuEhtjKqYcM0L 5uKpsucArTYGIfiKzqsqlBclNAJq1X8oZBMoE5nAjxCcSp3O5r92tf1xGNuc6klnx58Z zLIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xpTZwfCC; 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 kk11-20020a056214508b00b0069b55bf1143si16016564qvb.240.2024.04.24.17.11.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:12:00 -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=xpTZwfCC; 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 1rzmY8-0008Nv-CU; Wed, 24 Apr 2024 20:01:16 -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 1rzmXW-0008AQ-V2 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:45 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXR-0006AH-A1 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:36 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5f415fd71f8so337905a12.3 for ; Wed, 24 Apr 2024 17:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003231; x=1714608031; 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=JvZtT+b94F+EHwcSvNa04xBqeHxjFbplsfzPgMsFT1g=; b=xpTZwfCCTdS8ObodZi+dXxxItX+zhQ5ffArw2SYD1qlJo4htKjK+vbXO8DbD36vZAx nvi8zsmvjydV2zlP5aODSTebaYf7lpxSl5H3wqevJnvk2qLEy54e7cyXl16e9dTlQlOl 58FO8z0Vnzf2oAk/2aYq7CPfWECyO5Rt+IUXZOR9n2yL08LuuW5vmlnp/GXCfsEkGz3+ nZPx1kr+GluzplYQ+I4r4y2icp7VF4OqFA7/qqsSaOKFj1RXVwbqxRvMmoAzgp4L/uy/ RthK06wxam7Sfc6ndJKxkNP2eQw4gYNE7lHmtPrMG0NDe7Y1Bi2lYdDuMQ75ySK2UTok x3xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003231; x=1714608031; 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=JvZtT+b94F+EHwcSvNa04xBqeHxjFbplsfzPgMsFT1g=; b=fhHCu2DI/BwO0qp28q1FN9jKtCH9VaIolJUbJUR8F8irvznFtxf8CVa1lJxQBHJvGf zxaTLj7+cFVNZEBX38v0mh6rRMKjQlQ1ERokMBsOGui1TgKkeJyWAltDX2Y1oXQnpSDx OVRwV92Nzl3PFhOfZ9V4NoTqQEiY3/u1aylrcvIwuvUce3hq/I5SlcYV825IuoABH6b+ +cwkgSlKck+D1R+lDmtcTJDo0GbdUH+rNt0TvZ5Kr+wxJ7DDAX95UPCezKybY5C8OZD1 5WY0qBiqbNefPVHp84Or7gq6W88OkOCwfxKWWb+0cdUBmqEJMulBwoC7oma1eVLbmsEA fukg== X-Gm-Message-State: AOJu0Yz4PluSojQ46FJRqHavp+j4iSbqWnAHGd8VWa5yf4d41v2IF2hD XhXEOY+VFIQ5HRjbJp6PJuYIPwUJ/vAdoSt8r9ZtTM7aWGMtEog887R9fAjM0mH+HHlbZOpPez3 L X-Received: by 2002:a05:6a20:9150:b0:1a3:64a9:11e5 with SMTP id x16-20020a056a20915000b001a364a911e5mr4456766pzc.50.1714003230991; Wed, 24 Apr 2024 17:00:30 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/45] target/hppa: Allow prior nullification in do_ibranch Date: Wed, 24 Apr 2024 16:59:43 -0700 Message-Id: <20240425000023.1002026-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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 Simplify the function by not attempting a conditional move on the branch destination -- just use nullify_over normally. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 73 +++++++++++------------------------------ 1 file changed, 20 insertions(+), 53 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index cbf78a4007..ceba7a98e5 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1870,17 +1870,15 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, unsigned link, bool is_n) { - TCGv_i64 a0, a1, next, tmp; - TCGCond c; + TCGv_i64 next; - assert(ctx->null_lab == NULL); + if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { + next = tcg_temp_new_i64(); + tcg_gen_mov_i64(next, dest); - if (ctx->null_cond.c == TCG_COND_NEVER) { if (link != 0) { copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); } - next = tcg_temp_new_i64(); - tcg_gen_mov_i64(next, dest); if (is_n) { if (use_nullify_skip(ctx)) { copy_iaoq_entry(ctx, cpu_iaoq_f, -1, next); @@ -1894,60 +1892,29 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, } ctx->iaoq_n = -1; ctx->iaoq_n_var = next; - } else if (is_n && use_nullify_skip(ctx)) { - /* The (conditional) branch, B, nullifies the next insn, N, - and we're allowed to skip execution N (no single-step or - tracepoint in effect). Since the goto_ptr that we must use - for the indirect branch consumes no special resources, we - can (conditionally) skip B and continue execution. */ - /* The use_nullify_skip test implies we have a known control path. */ - tcg_debug_assert(ctx->iaoq_b != -1); - tcg_debug_assert(ctx->iaoq_n != -1); + return true; + } - /* We do have to handle the non-local temporary, DEST, before - branching. Since IOAQ_F is not really live at this point, we - can simply store DEST optimistically. Similarly with IAOQ_B. */ + nullify_over(ctx); + + if (is_n && use_nullify_skip(ctx)) { copy_iaoq_entry(ctx, cpu_iaoq_f, -1, dest); next = tcg_temp_new_i64(); tcg_gen_addi_i64(next, dest, 4); copy_iaoq_entry(ctx, cpu_iaoq_b, -1, next); - - nullify_over(ctx); - if (link != 0) { - copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); - } - tcg_gen_lookup_and_goto_ptr(); - return nullify_end(ctx); + nullify_set(ctx, 0); } else { - c = ctx->null_cond.c; - a0 = ctx->null_cond.a0; - a1 = ctx->null_cond.a1; - - tmp = tcg_temp_new_i64(); - next = tcg_temp_new_i64(); - - copy_iaoq_entry(ctx, tmp, ctx->iaoq_n, ctx->iaoq_n_var); - tcg_gen_movcond_i64(c, next, a0, a1, tmp, dest); - ctx->iaoq_n = -1; - ctx->iaoq_n_var = next; - - if (link != 0) { - tcg_gen_movcond_i64(c, cpu_gr[link], a0, a1, cpu_gr[link], tmp); - } - - if (is_n) { - /* The branch nullifies the next insn, which means the state of N - after the branch is the inverse of the state of N that applied - to the branch. */ - tcg_gen_setcond_i64(tcg_invert_cond(c), cpu_psw_n, a0, a1); - cond_free(&ctx->null_cond); - ctx->null_cond = cond_make_n(); - ctx->psw_n_nonzero = true; - } else { - cond_free(&ctx->null_cond); - } + copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); + copy_iaoq_entry(ctx, cpu_iaoq_b, -1, dest); + nullify_set(ctx, is_n); } - return true; + if (link != 0) { + copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); + } + + tcg_gen_lookup_and_goto_ptr(); + ctx->base.is_jmp = DISAS_NORETURN; + return nullify_end(ctx); } /* Implement From patchwork Wed Apr 24 23:59:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791776 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118742wrq; Wed, 24 Apr 2024 17:09:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVL4hIbE+65Mz3VvExihCKga1piHRvAxdz7fbR99tzNKuOBuEunkDV2RoMuxnWecqaWzKWN5vgh4M7qHHwgwlf+ X-Google-Smtp-Source: AGHT+IF8oLt5bQ2IIgceOSC/tHC0X2gYBaIL/gIY2TgwU0ZFRtO+2/D+Wm/Q0xsC57r2XvBc37PH X-Received: by 2002:a05:6214:2b09:b0:6a0:8e1d:bbce with SMTP id jx9-20020a0562142b0900b006a08e1dbbcemr1667442qvb.22.1714003776102; Wed, 24 Apr 2024 17:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003776; cv=none; d=google.com; s=arc-20160816; b=grP++yP0Pj19btpqWjp/EzndbeHNLaFRUSMGURUgQZNZvL6nmeIi9RUWKrkWNsK0wC AK61U01QIt6MFaphTqgS1n09KXQkBzFijpS3oaQ9FTI49+l2uiKqmSdiarMPY8bWszkK wIvPGcN+Sh17wZAZqM5QASIIlw/taI5eMJE7VjtFIlIqg0/OpgzdJPhqZi9fLOrjT2Dh AaKW5kq00CugOCf60mC5vtLVXEZekhD2MpTttBkcYb4sbHZd9XZsyACOkFusMvJH3AW1 +pdgpoVyUpCeeB09vexH78cSUXYg+6enKh2pl0jDTsIzcimOZO1vyYqYTB7n3t2SaFnm 0JBg== 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=zvuJFJYhzHrJsCquoz1CbcaBtEBeZ6rJJCBGiMse0Jg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=wij3TXIx8LeO6fAXled22PP35zEXmt1RDHVocTEOKVvYhJhgkSvq5c6XHJw8b0KHKE SMGv8goS+lmSmDKqIeMGCH3u2X28HsNXUovq4Kp60xg/o5ymjr598TusKdo8LMl06RRT eUpJggEQEHQpPNAaZJPqmnbQtU7mMdS2Jtzt3d93ljG9ihwcdUTAx9PpA4RdW2Kz/qmD p0Hkk+8mxktewr/7X+KG6u11feL7kWAdgQEXHNkGtJvm5ofeSPTXtkxi6BoZPtE91BDR 6Ecn6ETOyONtQQmYKCKrc9fhDYzw3WPtW6RfX/S0dTTOaRoFX2/9HOpWiwqog+Aex/ef Vd4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nO6WpEkd; 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 y8-20020ac85f48000000b0043153299a15si16160447qta.695.2024.04.24.17.09.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:09:36 -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=nO6WpEkd; 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 1rzmXy-0008Jc-TP; Wed, 24 Apr 2024 20:01: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 1rzmXW-0008AR-V8 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:45 -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 1rzmXU-0006B3-8l for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:38 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-60585faa69fso328465a12.1 for ; Wed, 24 Apr 2024 17:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003233; x=1714608033; 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=zvuJFJYhzHrJsCquoz1CbcaBtEBeZ6rJJCBGiMse0Jg=; b=nO6WpEkdoIkKL1cAgEckbmlXXq/kUoemNLzZxCrOgn2Qq4upCHuFrwzfFrOj5Z7TZi 5vR7bJYQCLWIxc3LXFSXUi7/ZBbDTByGqeb+pVstYBrzHa2WLQiMjDeQqCxMUycic9ye kmVOtRucirhhgRZWPtOurXcqsH6uArNG+SiESFMd+WqyixefUy+bvf3v+VO/GQKQOoHv hWnTIA78h1zqPO4bjgNd0Dom4uPUVQ1Hl24ZVERk7PeObKwSsHLDO4wth5Ruqkt2nkoN 2xwEpEvw93hKtvjNAt42lch8mZwQv27aeZCo1lAOi6kD4o1njz2Z9u5WRrN77gb4iZZ8 sRUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003233; x=1714608033; 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=zvuJFJYhzHrJsCquoz1CbcaBtEBeZ6rJJCBGiMse0Jg=; b=hL9dSy3TAA2G8wDjUIVFXjFt0x+1Hg45JzfhQ4ABmddJxp5N7AlZXBo7NyJ85eF7ah Y19Cv6Fm7UO8C/kpmfAgv5kePHTns+Y+Mr0X/98cO6YytFxyOK5sIaF6J2z07iGssARp e/CUd0t+g0tD+t4m/5ZGDOIgsyK9fBY0uBitMFv8eXWg4h0B3IHyu8vHdY3mF4TiN7zi 1m002NSG42IFPL2zGtmdB1DDnnx7bxIul4Q9yqHiIS8QCACNVvKCOLs0kMMBA0Nx+SzV gptkFxVyRASNDK1iMoCUCnF/FnqobCMo8aD3O+U4I6SeBCYnG0F6NQG+bqN9eYJnEfeu IqeQ== X-Gm-Message-State: AOJu0YxowR5P8HmYTEleY6w4ZGQNP4LZqESF7Vi6+O1vWPTphW6u4koj 6JIPSzBVm1iY357DMT3sB0FsZDtmfVVQSuja1iYECCz8Paxv4ueZbdK+Trf3XYcB0mK3CC/JXQO U X-Received: by 2002:a17:90b:4d8d:b0:2af:c3ea:8122 with SMTP id oj13-20020a17090b4d8d00b002afc3ea8122mr587497pjb.7.1714003232116; Wed, 24 Apr 2024 17:00:32 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/45] target/hppa: Use CF_BP_PAGE instead of cpu_breakpoint_test Date: Wed, 24 Apr 2024 16:59:44 -0700 Message-Id: <20240425000023.1002026-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The generic tcg driver will have already checked for breakpoints. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ceba7a98e5..dfdcb3e23c 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -673,8 +673,9 @@ static bool use_goto_tb(DisasContext *ctx, uint64_t bofs, uint64_t nofs) executing a TB that merely branches to the next TB. */ static bool use_nullify_skip(DisasContext *ctx) { - return (((ctx->iaoq_b ^ ctx->iaoq_f) & TARGET_PAGE_MASK) == 0 - && !cpu_breakpoint_test(ctx->cs, ctx->iaoq_b, BP_ANY)); + return (!(tb_cflags(ctx->base.tb) & CF_BP_PAGE) + && ctx->iaoq_b != -1 + && is_same_page(&ctx->base, ctx->iaoq_b)); } static void gen_goto_tb(DisasContext *ctx, int which, From patchwork Wed Apr 24 23:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791752 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115412wrq; Wed, 24 Apr 2024 17:01:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjzi3U4iOqZ26gEqiQQzwk8GmyM773cm71mv/eS5fTiF+jGFAeJ/4j0DobkUDME0NMGBdVZw7HFHm0mNk2UGvY X-Google-Smtp-Source: AGHT+IFqFGfqDBIeNQFc7oWpxp9O6lKYWcs7Do8RyyCBBRxcJQQeFug8aj4DjsV+Cmaz+Z3ZkwAc X-Received: by 2002:a05:6808:2288:b0:3c7:4e26:f0de with SMTP id bo8-20020a056808228800b003c74e26f0demr5105180oib.24.1714003313435; Wed, 24 Apr 2024 17:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003313; cv=none; d=google.com; s=arc-20160816; b=k0o4Go9kLhchzrZBn6KbZSGyhpnKf2tmtY5Nz3wP9hNkHyDEshwYvPdpzwlEJmtTVg IkQQlhSnxYfDf7yX32xxTMa0rJAdQt/UTEiAAj31dPG2z+ZwP2fwHCpPlz3rOjEt3STS G3rfy1FDbqmnTeK4nqOmZpHohrVgRcs1Z+W4oX/k+bLWQFj7z/3PFw04axCPWVVApqMC QKN9JQnw7bT9nV1xSLoOhFoZmEma22UMW3hD8rAHmqOGR0x8k+oPO4QBVoVPxgEdYy+/ EurZIlvO32M2jkdwfQdwOwJZnqYAZvzIivH816BwkuDQCiNscdQ+EhvB74IBkmd8dcxz zSMA== 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=HEk6ePzdOD91iD1Fiz0j8oXWLMklE2R7qPe+xWaLhBM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=IQQZuCxV8yh/BgG0jnEdAFeUGtwdhiHxePuOZ2uryIeD5p0i0U7fBlBMivVGwl4ZS9 Jo4UVo6DeAlAIEKFCYEgpNG7Zes/c1xsjnUn6DbofRYYaK4OtxSsroxB6l7hqutkep58 09PUhH3RjCp0yYjgdrebPcmi9WzzUSPqT4vkms7AsmR5fN+kqy4Dio3tK961IkqH2k6c Pj+uW8rZTmcpAzW4fDz9ZufZtNkwS3Z6ZdFPT90Cno+fOmIcDoUff5g2ogcsthGABLh3 1m0BfCkGbwc9oOmyFxoYNMZnNq+AS7N7voNmmDfdt5xCgWb5se53agfUsiCHB2XifJKQ 5mMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TGuM1eYE; 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 d1-20020a05622a15c100b00436debf1989si16103907qty.279.2024.04.24.17.01.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:01:53 -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=TGuM1eYE; 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 1rzmXx-0008I5-Mh; Wed, 24 Apr 2024 20:01:05 -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 1rzmXW-0008AO-U3 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:44 -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 1rzmXT-0006Ap-Ga for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:38 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1e5715a9ebdso3122205ad.2 for ; Wed, 24 Apr 2024 17:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003233; x=1714608033; 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=HEk6ePzdOD91iD1Fiz0j8oXWLMklE2R7qPe+xWaLhBM=; b=TGuM1eYElqbhUqq171sVwRisyHb1sb+MgRiAZz70Oe2yXhuvlXKh8NsUih3MbJvn0u lSMuVDKMPg7i+rFn+Z98Z92cCLd7KnKvZ8oAoawphfRen5y2wOY8Iwozzz6zdmnFKGSI CT2uRgZzmYUBZJUq/MdkRbPtR80PsazhZhbImbF8BP4pXoyFtMr7ni4c10mhxG2xh6Ks DijZpyUwQhq2sJTm6Z9FQtmsNtQgdbsS/ru/VZzvEaxy6oXLRYCdvZDcq7HfL7gKp6eC 8bOhWb9p2azh+J7qVdmkFYi10gTY7CG5752pAYJTa6PkKBgBvy8i2NWk3hLSR7V5WgCB XWbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003233; x=1714608033; 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=HEk6ePzdOD91iD1Fiz0j8oXWLMklE2R7qPe+xWaLhBM=; b=P2CI3juW8zmsuQ6vA4RuwwmnGnlfRFj4zQ8YlSHp9SmcUGLIh+9Q4yXiHjrBEDOPnP lD5AvVuEPUW3tVRm9e9kEZR8ySEp2OqPWQc3X+QBoYOUVveNNV6SYDxJ6UrmuHlN7qMC L3IJkIrYoIimMeiIalllZ1WHAL/qMP9G7OMdwCNOYSSfNYKZRfdoSnjpWPWODQIqBK5n hEGhhJ2s3VFcHw2HvBaiz2XrRq+o4UoBUu2dBI6yW0wMp4i7kiVzhKX9Q883AsE/GoAX faVk9Pi6TuMG3taQZTY6X0jn7IGMWDD3hrH7VQQLif3N2DK6aZkQUB0anRq5x/cUvBEk lp5A== X-Gm-Message-State: AOJu0Yxk7YoALAWH+HgNSziH3mYf6DxHKhBAwQU2z9dtx1xaU1+znMaf +b+pKAXAJbGZs93YPKRVcE2+apvoRoy4aB88pGLl/TAbCIyitwqsi+0EnZ1EjfLBot6n9gDTYH+ m X-Received: by 2002:a17:903:41d0:b0:1e4:6243:8543 with SMTP id u16-20020a17090341d000b001e462438543mr4985568ple.5.1714003232982; Wed, 24 Apr 2024 17:00:32 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/45] target/hppa: Add install_iaq_entries Date: Wed, 24 Apr 2024 16:59:45 -0700 Message-Id: <20240425000023.1002026-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Instead of two separate cpu_iaoq_entry calls, use one call to update both IAQ_Front and IAQ_Back. Simplify with an argument combination that automatically handles a simple increment from Front to Back. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 64 +++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index dfdcb3e23c..cad33e7aa6 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -616,6 +616,23 @@ static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest, } } +static void install_iaq_entries(DisasContext *ctx, uint64_t bi, TCGv_i64 bv, + uint64_t ni, TCGv_i64 nv) +{ + copy_iaoq_entry(ctx, cpu_iaoq_f, bi, bv); + + /* Allow ni variable, with nv null, to indicate a trivial advance. */ + if (ni != -1 || nv) { + copy_iaoq_entry(ctx, cpu_iaoq_b, ni, nv); + } else if (bi != -1) { + copy_iaoq_entry(ctx, cpu_iaoq_b, bi + 4, NULL); + } else { + tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_f, 4); + tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, + gva_offset_mask(ctx->tb_flags)); + } +} + static inline uint64_t iaoq_dest(DisasContext *ctx, int64_t disp) { return ctx->iaoq_f + disp + 8; @@ -628,8 +645,7 @@ static void gen_excp_1(int exception) static void gen_excp(DisasContext *ctx, int exception) { - copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_f, cpu_iaoq_f); - copy_iaoq_entry(ctx, cpu_iaoq_b, ctx->iaoq_b, cpu_iaoq_b); + install_iaq_entries(ctx, ctx->iaoq_f, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); nullify_save(ctx); gen_excp_1(exception); ctx->base.is_jmp = DISAS_NORETURN; @@ -683,12 +699,10 @@ static void gen_goto_tb(DisasContext *ctx, int which, { if (use_goto_tb(ctx, b, n)) { tcg_gen_goto_tb(which); - copy_iaoq_entry(ctx, cpu_iaoq_f, b, NULL); - copy_iaoq_entry(ctx, cpu_iaoq_b, n, NULL); + install_iaq_entries(ctx, b, NULL, n, NULL); tcg_gen_exit_tb(ctx->base.tb, which); } else { - copy_iaoq_entry(ctx, cpu_iaoq_f, b, cpu_iaoq_b); - copy_iaoq_entry(ctx, cpu_iaoq_b, n, ctx->iaoq_n_var); + install_iaq_entries(ctx, b, cpu_iaoq_b, n, ctx->iaoq_n_var); tcg_gen_lookup_and_goto_ptr(); } } @@ -1882,9 +1896,7 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, } if (is_n) { if (use_nullify_skip(ctx)) { - copy_iaoq_entry(ctx, cpu_iaoq_f, -1, next); - tcg_gen_addi_i64(next, next, 4); - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, next); + install_iaq_entries(ctx, -1, next, -1, NULL); nullify_set(ctx, 0); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; return true; @@ -1899,14 +1911,10 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, nullify_over(ctx); if (is_n && use_nullify_skip(ctx)) { - copy_iaoq_entry(ctx, cpu_iaoq_f, -1, dest); - next = tcg_temp_new_i64(); - tcg_gen_addi_i64(next, dest, 4); - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, next); + install_iaq_entries(ctx, -1, dest, -1, NULL); nullify_set(ctx, 0); } else { - copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, dest); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, dest); nullify_set(ctx, is_n); } if (link != 0) { @@ -1997,9 +2005,7 @@ static void do_page_zero(DisasContext *ctx) tcg_gen_st_i64(cpu_gr[26], tcg_env, offsetof(CPUHPPAState, cr[27])); tmp = tcg_temp_new_i64(); tcg_gen_ori_i64(tmp, cpu_gr[31], 3); - copy_iaoq_entry(ctx, cpu_iaoq_f, -1, tmp); - tcg_gen_addi_i64(tmp, tmp, 4); - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, tmp); + install_iaq_entries(ctx, -1, tmp, -1, NULL); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; break; @@ -2743,8 +2749,8 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf_d *a) nullify_over(ctx); /* Advance the instruction queue. */ - copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); - copy_iaoq_entry(ctx, cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, + ctx->iaoq_n, ctx->iaoq_n_var); nullify_set(ctx, 0); /* Tell the qemu main loop to halt until this cpu has work. */ @@ -3897,18 +3903,15 @@ static bool trans_be(DisasContext *ctx, arg_be *a) tcg_gen_mov_i64(cpu_sr[0], cpu_iasq_b); } if (a->n && use_nullify_skip(ctx)) { - copy_iaoq_entry(ctx, cpu_iaoq_f, -1, tmp); - tcg_gen_addi_i64(tmp, tmp, 4); - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, tmp); + install_iaq_entries(ctx, -1, tmp, -1, NULL); tcg_gen_mov_i64(cpu_iasq_f, new_spc); tcg_gen_mov_i64(cpu_iasq_b, cpu_iasq_f); nullify_set(ctx, 0); } else { - copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, tmp); if (ctx->iaoq_b == -1) { tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); } - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, tmp); tcg_gen_mov_i64(cpu_iasq_b, new_spc); nullify_set(ctx, a->n); } @@ -4017,11 +4020,10 @@ static bool trans_bve(DisasContext *ctx, arg_bve *a) nullify_over(ctx); dest = do_ibranch_priv(ctx, load_gpr(ctx, a->b)); - copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, dest); if (ctx->iaoq_b == -1) { tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); } - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, dest); tcg_gen_mov_i64(cpu_iasq_b, space_select(ctx, 0, dest)); if (a->l) { copy_iaoq_entry(ctx, cpu_gr[a->l], ctx->iaoq_n, ctx->iaoq_n_var); @@ -4720,8 +4722,8 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) case DISAS_IAQ_N_STALE: case DISAS_IAQ_N_STALE_EXIT: if (ctx->iaoq_f == -1) { - copy_iaoq_entry(ctx, cpu_iaoq_f, -1, cpu_iaoq_b); - copy_iaoq_entry(ctx, cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var); + install_iaq_entries(ctx, -1, cpu_iaoq_b, + ctx->iaoq_n, ctx->iaoq_n_var); #ifndef CONFIG_USER_ONLY tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); #endif @@ -4750,8 +4752,8 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) case DISAS_TOO_MANY: case DISAS_IAQ_N_STALE: case DISAS_IAQ_N_STALE_EXIT: - copy_iaoq_entry(ctx, cpu_iaoq_f, ctx->iaoq_f, cpu_iaoq_f); - copy_iaoq_entry(ctx, cpu_iaoq_b, ctx->iaoq_b, cpu_iaoq_b); + install_iaq_entries(ctx, ctx->iaoq_f, cpu_iaoq_f, + ctx->iaoq_b, cpu_iaoq_b); nullify_save(ctx); /* FALLTHRU */ case DISAS_IAQ_N_UPDATED: From patchwork Wed Apr 24 23:59:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791747 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115212wrq; Wed, 24 Apr 2024 17:01:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWvDOZCGH1aQmxEirWp6rzkWt8V36EyYnIl5JdLEc7FtvRYn6oNLFC8DEFkKmiJH8i7lRUsO3Whs2L58Rhv1UcB X-Google-Smtp-Source: AGHT+IGh36LE/+hSuPQBFztpIBI1Y2VIS4qBpHK3i4i6g2GbC2j8UitnWmxk8HhcxU+On3tpoaHj X-Received: by 2002:a05:622a:58a:b0:43a:43c8:63cd with SMTP id c10-20020a05622a058a00b0043a43c863cdmr641907qtb.5.1714003291731; Wed, 24 Apr 2024 17:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003291; cv=none; d=google.com; s=arc-20160816; b=cnVrF40fuu/nLZNB1+yMZgRIhzy/Mw+omppivG2Pa7a63sbKmfJd48g3hQ8JQfTg02 FF+XKT1OEeGGJA3tcc0zmVQYwhBczXoeLXtFzQGHIgGLcIkwYkJoARC4DSIPsBYwklmT SfaAzI4CmYxxkrA/nk3vIUxI8gx8C9iHt9HXBClZSsaP6ZjBVFfbOwDkpZ9IeWAx67R7 TbSbzjkF2Irih0TuhW9wm1ERwR/ED61eGCXu4Fjfmc0y6VtDnD6XYdVEyldnsZAFZl5k pPCg9NeG+C6FCGc5CR4RP9gAmQXjoxNeUyeXPcj0w6RB1rBmXwLIDVWdMjADMA5klhT7 bxvg== 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=IYeP6b8MmHZVDWhGv2pjfTgnSIDzPsYfhG3pp0jo1l8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=h5xtzj+2kNJYgG9NweoQL8VelumXlogDM/4/eCL/hVYFYUmVWzWQQF1ASklqN9gcPz 4bDlQW4OGBIIP8ZeDNKwfpnifXVdReA9JAFGvxup7KuEDrgAEgD6ONZqoTKlwaFzhjso fBoRbqBbFNiykNWsI84ZA7y/cHxHuv0uK+1wa5QSNYWxEnO+7Rr828YIlv86JEo61Q7y /1qr1CBcaB9lKD//Qe1HtGbONUXwgfWQ9KowsFpiLMDVHKCNeJSbdg1i3gm/eL7bSsgg UcfSX1FWDlc+risj24j78P/R/FwZBDOtp9gGkAj6IvvwMaHxw48suc2w0pQpPcDxmFqX ATKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yVKd6IiJ; 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 h16-20020a05620a21d000b0078ec5578fb3si16485181qka.122.2024.04.24.17.01.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:01:31 -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=yVKd6IiJ; 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 1rzmXx-0008Ia-T3; Wed, 24 Apr 2024 20:01: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 1rzmXY-0008AY-2e for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:45 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXU-0006BA-JI for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:38 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e65b29f703so3493095ad.3 for ; Wed, 24 Apr 2024 17:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003234; x=1714608034; 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=IYeP6b8MmHZVDWhGv2pjfTgnSIDzPsYfhG3pp0jo1l8=; b=yVKd6IiJ4WLPh8JbNIhaign1XAlfQNSu2aZE2QI3692m99Ti08I05AuSITWJiclf6K UvmsD51Ltx7z2Fv/IP0CJ1FMSlQlTu4LCGT2iJhtcTpo01XNPDWj0qd8A8yw9uLSR35h bQsKOmjSKcM+fQiFaVtxuIYA6crOZUkSzcgyTO3CEOuDzVR9NEJCyFeibrmsRAjMBHNI S9I8sNCQL6eMsa5984DEmFNJ3S6d7W37jRSg6r04TITGaARZ4/kXTwNmtYQNSOu57F5+ K49ffYZe5ftXdRrk2/yRG4IavyKZ2KIkZxA/WUkfZSwMEvt2a3MdbVE+HqPphpY/FRGX ggyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003234; x=1714608034; 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=IYeP6b8MmHZVDWhGv2pjfTgnSIDzPsYfhG3pp0jo1l8=; b=nM/9rOqjVfAB/oNXaKHyQOIbAiCpJd0QKzQs/DVlLV+o92lMoDop3kdlW0cmVEoF50 CludbvIxNtQKSka0P1YAPmVIszbpbgIuveKkWs8P9H7toHd/H6Az3YEYzRGyRpJRK5vk ga4JBH9bGKNz8qSGnzRq/D9Ha0b+XW1+SIR8e8CpkfrX4OMAq9EeLnO/ZH06mDt5ZKUE 2N5px0cz9sFslsTAcHIqe837TbUAT7w1s1PKWKq3Qb9rpHuV8Ey0xgYTUM+Lyjf3fCj4 a/giJX2A29+ts6Zc4u5U3ZhMWTyyTOEDgaZeGerI0muoF3d8U3/Et+6cseni0vodpAAO QmGg== X-Gm-Message-State: AOJu0YwWTpkkvstC5Dr1Kic7tbfPKmWt8OjccpLtZvc/+J6nOhXL8H0z J4zfYyGKt4SEbkMFvrG8qn8b9NjXO2UboYXRuuBFeo0LDTdvrNVeP8rTlYhN16gZ/HMzi92e75i s X-Received: by 2002:a17:902:7488:b0:1e2:a91c:9836 with SMTP id h8-20020a170902748800b001e2a91c9836mr3972979pll.33.1714003233839; Wed, 24 Apr 2024 17:00:33 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/45] target/hppa: Add install_link Date: Wed, 24 Apr 2024 16:59:46 -0700 Message-Id: <20240425000023.1002026-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 Add a common routine for writing the return address. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 54 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index cad33e7aa6..195a0e7e79 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -633,6 +633,23 @@ static void install_iaq_entries(DisasContext *ctx, uint64_t bi, TCGv_i64 bv, } } +static void install_link(DisasContext *ctx, unsigned link, bool with_sr0) +{ + tcg_debug_assert(ctx->null_cond.c == TCG_COND_NEVER); + if (link) { + if (ctx->iaoq_b == -1) { + tcg_gen_addi_i64(cpu_gr[link], cpu_iaoq_b, 4); + } else { + tcg_gen_movi_i64(cpu_gr[link], ctx->iaoq_b + 4); + } +#ifndef CONFIG_USER_ONLY + if (with_sr0) { + tcg_gen_mov_i64(cpu_sr[0], cpu_iasq_b); + } +#endif + } +} + static inline uint64_t iaoq_dest(DisasContext *ctx, int64_t disp) { return ctx->iaoq_f + disp + 8; @@ -1786,9 +1803,7 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, uint64_t dest = iaoq_dest(ctx, disp); if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { - if (link != 0) { - copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); - } + install_link(ctx, link, false); ctx->iaoq_n = dest; if (is_n) { ctx->null_cond.c = TCG_COND_ALWAYS; @@ -1796,10 +1811,7 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, } else { nullify_over(ctx); - if (link != 0) { - copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); - } - + install_link(ctx, link, false); if (is_n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); gen_goto_tb(ctx, 0, dest, dest + 4); @@ -1891,9 +1903,7 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, next = tcg_temp_new_i64(); tcg_gen_mov_i64(next, dest); - if (link != 0) { - copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); - } + install_link(ctx, link, false); if (is_n) { if (use_nullify_skip(ctx)) { install_iaq_entries(ctx, -1, next, -1, NULL); @@ -1910,16 +1920,17 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, nullify_over(ctx); + next = tcg_temp_new_i64(); + tcg_gen_mov_i64(next, dest); + + install_link(ctx, link, false); if (is_n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, dest, -1, NULL); + install_iaq_entries(ctx, -1, next, -1, NULL); nullify_set(ctx, 0); } else { - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, dest); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, next); nullify_set(ctx, is_n); } - if (link != 0) { - copy_iaoq_entry(ctx, cpu_gr[link], ctx->iaoq_n, ctx->iaoq_n_var); - } tcg_gen_lookup_and_goto_ptr(); ctx->base.is_jmp = DISAS_NORETURN; @@ -3898,10 +3909,7 @@ static bool trans_be(DisasContext *ctx, arg_be *a) nullify_over(ctx); load_spr(ctx, new_spc, a->sp); - if (a->l) { - copy_iaoq_entry(ctx, cpu_gr[31], ctx->iaoq_n, ctx->iaoq_n_var); - tcg_gen_mov_i64(cpu_sr[0], cpu_iasq_b); - } + install_link(ctx, a->l, true); if (a->n && use_nullify_skip(ctx)) { install_iaq_entries(ctx, -1, tmp, -1, NULL); tcg_gen_mov_i64(cpu_iasq_f, new_spc); @@ -4018,16 +4026,16 @@ static bool trans_bve(DisasContext *ctx, arg_bve *a) return do_ibranch(ctx, dest, a->l, a->n); #else nullify_over(ctx); - dest = do_ibranch_priv(ctx, load_gpr(ctx, a->b)); + dest = tcg_temp_new_i64(); + tcg_gen_mov_i64(dest, load_gpr(ctx, a->b)); + dest = do_ibranch_priv(ctx, dest); + install_link(ctx, a->l, false); install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, dest); if (ctx->iaoq_b == -1) { tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); } tcg_gen_mov_i64(cpu_iasq_b, space_select(ctx, 0, dest)); - if (a->l) { - copy_iaoq_entry(ctx, cpu_gr[a->l], ctx->iaoq_n, ctx->iaoq_n_var); - } nullify_set(ctx, a->n); tcg_gen_lookup_and_goto_ptr(); ctx->base.is_jmp = DISAS_NORETURN; From patchwork Wed Apr 24 23:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791757 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1116133wrq; Wed, 24 Apr 2024 17:03:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVYXP1feS3MFHGzaNo4VJBg+QbJ7qx4sdADrVWQn4bPSLNmffPDqRWU7RcXSzGpf+RIi627ohPI7NkwkF+zv3TF X-Google-Smtp-Source: AGHT+IFY5gAnnt2L5ja9dQ0aWepYL9jXytpage/QR2oCYqQHThaE+d1p7Yj0729Kji7u8ZBXpwgw X-Received: by 2002:a05:620a:1991:b0:790:9655:c5e5 with SMTP id bm17-20020a05620a199100b007909655c5e5mr2324369qkb.31.1714003395733; Wed, 24 Apr 2024 17:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003395; cv=none; d=google.com; s=arc-20160816; b=pVTSEXBn82GVQzohwocbSClIbFLYh0QNwE/9HhIjrc+qwi4Dh8wz/iwtK0yoytge5F dfET7HMPevPRMAyomXrPTi3MXkIslFoIg8Y8i7mjt5KnvB+xk3cPshXTlVT0C9TUK+1p 8K/URnoiiVAeixqx9xr5yJdrUhAyZ3myztGZ4mrZy8PVMEUSqD3mofGRWBF2d7V/sJpS 74ommI/QBXw1HwcCN4b6oKieOuRxQYqElyi9RDROFtK545F3lC4AZmCeqR9kNJiM8wMW OxWuIfywlfSiHZ8H4G1kFiTxi+j0xeHiFiXnIkE8CV2Z1yXeWjEiedgGjEXxXQHXBtTy poeQ== 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=oF8t7cQPLARGajCa4VkThGHVsE7qiWEOEtD6odytNQQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=qYP0JXOGp7DR67FqID2ZkO8uLYLSgk8f6WADYRZMZ2F7S2sKCqWmO8Hng0M/5d1dlY pwlKWI6hpRN9hnDQq+fSqt3lrSVEEepTbQQ3Kw4w4h5wtgarCKJAAi/nxQYFYi2AjE0h /dDEAeJOXUN/H0XEWRAyc14zKy0P6KYtCiLC2deJkS1qNQJj+0d4GDecSm42hPbjUg4X ed3qggH3auAOTvgwSZmbhtJY1uCbMvY5I8NHDw81z7anVXnMWBfk1ZalMpfmPbw5/klu WQ4EUg2VP8HAt+lmFSf18UyD2EcCi9aawKBMGhK2Jrjx64USJIvmv0dupdVnSH/P4soK Gtpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gCjuLkBk; 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 j29-20020a05620a0a5d00b0078f1530f4dfsi14679210qka.24.2024.04.24.17.03.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:03:15 -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=gCjuLkBk; 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 1rzmYD-0008Or-Nn; Wed, 24 Apr 2024 20:01:22 -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 1rzmXZ-0008Ad-Gs for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:49 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXU-0006BI-VM for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:39 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2ab88634cfaso396050a91.0 for ; Wed, 24 Apr 2024 17:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003235; x=1714608035; 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=oF8t7cQPLARGajCa4VkThGHVsE7qiWEOEtD6odytNQQ=; b=gCjuLkBkx7pIGDwqcboPjPDXZCsWoVcwzWbeKgmhfx4KZ+wHSXTd5VgxSFbH2kzIix eQgZWJOufQAk9H2lsp4bX1nA/k9tGf2noDEmHdoKXVBG9w8Ck8uQW/rDUFC7ZTOYYsc3 SSVMEp2GfNrH+zv3kHcEPfHNL+4Dx2/irvTd67rqiLeQrXOcwxtKLLXC2G8ucMUBEdnV zw8vZDNovEX6lke9bhRLJjx75MmBgl1CfGhfZDdQ5uyZeGQk2PVANTF3dYyNox7TD9EA exiYHS0xnOYAsMJdefI5PbJP//I4uZu7lNLbk/nvG5cmQsyIiO1xSeJqxJdZqeNn4z1/ 9w9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003235; x=1714608035; 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=oF8t7cQPLARGajCa4VkThGHVsE7qiWEOEtD6odytNQQ=; b=KDdfQf7B2Sz4sFt9Epxi+VHke9jEtfqAmezGjr+dlm+y7Hk4udUwsrO9PT9VZehY5T 6cJ7IgmS8rWk0vP3pddxr0kk6SWF/OJ9JKuyG2A7FeF1yPTIYXp/S8NImt9vpwsvND5U A1GVl+Iz50qXAwct2Sc6WYF/Rsak2WywKdZO3PKh3KqJpgLBh9QrTXMP70RmtlIzyS3t a3M2SE2eLQTib1BOep/q/fTfUY75aOw2nvrEy8CqG+g0CCRpOlUzBSv7p7jUuCLn105z xiqnrEfgr4Kgl+vF+Jt9ap4fHxpE42KNGWnmQicAiuZT37WFGxm6tCzeac5/nSubvZ2y Nynw== X-Gm-Message-State: AOJu0YwAm6O4uEHJQEDrR4RgHMODxtNnPHUGaYZ8IyMuSQZXAOZK4oJS nREZbjR2xIdeNKKRFN0ZK/SJTdtgBJtNOwCez3iBnJ0tCyoy9cPGgpmViZ6caVmt+Qce7W5wi55 z X-Received: by 2002:a17:90a:4a03:b0:2a6:c395:1b95 with SMTP id e3-20020a17090a4a0300b002a6c3951b95mr4225371pjh.11.1714003234891; Wed, 24 Apr 2024 17:00:34 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 09/45] target/hppa: Delay computation of IAQ_Next Date: Wed, 24 Apr 2024 16:59:47 -0700 Message-Id: <20240425000023.1002026-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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 We no longer have to allocate a temp and perform an addition before translation of the rest of the insn. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 195a0e7e79..ac181180a6 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1805,6 +1805,7 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { install_link(ctx, link, false); ctx->iaoq_n = dest; + ctx->iaoq_n_var = NULL; if (is_n) { ctx->null_cond.c = TCG_COND_ALWAYS; } @@ -1861,11 +1862,6 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, ctx->null_lab = NULL; } nullify_set(ctx, n); - if (ctx->iaoq_n == -1) { - /* The temporary iaoq_n_var died at the branch above. - Regenerate it here instead of saving it. */ - tcg_gen_addi_i64(ctx->iaoq_n_var, cpu_iaoq_b, 4); - } gen_goto_tb(ctx, 0, ctx->iaoq_b, ctx->iaoq_n); } @@ -4629,8 +4625,6 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->iaoq_f = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; ctx->iaoq_b = (diff ? ctx->iaoq_f + diff : -1); #endif - ctx->iaoq_n = -1; - ctx->iaoq_n_var = NULL; ctx->zero = tcg_constant_i64(0); @@ -4682,14 +4676,8 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) /* Set up the IA queue for the next insn. This will be overwritten by a branch. */ - if (ctx->iaoq_b == -1) { - ctx->iaoq_n = -1; - ctx->iaoq_n_var = tcg_temp_new_i64(); - tcg_gen_addi_i64(ctx->iaoq_n_var, cpu_iaoq_b, 4); - } else { - ctx->iaoq_n = ctx->iaoq_b + 4; - ctx->iaoq_n_var = NULL; - } + ctx->iaoq_n_var = NULL; + ctx->iaoq_n = ctx->iaoq_b == -1 ? -1 : ctx->iaoq_b + 4; if (unlikely(ctx->null_cond.c == TCG_COND_ALWAYS)) { ctx->null_cond.c = TCG_COND_NEVER; @@ -4740,7 +4728,13 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) ? DISAS_EXIT : DISAS_IAQ_N_UPDATED); } else if (ctx->iaoq_b == -1) { - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, ctx->iaoq_n_var); + if (ctx->iaoq_n_var) { + copy_iaoq_entry(ctx, cpu_iaoq_b, -1, ctx->iaoq_n_var); + } else { + tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_b, 4); + tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, + gva_offset_mask(ctx->tb_flags)); + } } break; From patchwork Wed Apr 24 23:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791781 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119144wrq; Wed, 24 Apr 2024 17:10:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWHvMgIiQ0X3krAFqohFSSku7qAJ7BrWXilX4KEg6gTzKJvDy43eGkhcLLOzECixROFEjmjHgs8f6NsnFVjDn7t X-Google-Smtp-Source: AGHT+IGz0pjMYcHA+htOYg4oksZs7WG8UaytynZXFuhn9M37g3pAChkzbaqrjH1ijIKJCVXuglz5 X-Received: by 2002:a05:622a:1210:b0:436:4532:334a with SMTP id y16-20020a05622a121000b004364532334amr4507824qtx.44.1714003835417; Wed, 24 Apr 2024 17:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003835; cv=none; d=google.com; s=arc-20160816; b=TNF+tPl/hwFkoHms9nhKRkLkn6ltVE9Yf0Ut8f0kQke9/qUD/9zc/93ooBUFIj87wJ yI8K8dppTRg4cR5ukW4pInCBqpwaRBYyRgas06xRRDjX2XG6lQ07TZutGbfNf+kjhEOG 1TNT2R47e6DL05oWdS7DR3TQLB+JDYtxssgFlcCcGsE/m07Vjifqq8xSm7EjuQMnZ+ls RJ2IPv42HJXDbb9mqfXkud1xADi3kOwKJi5IvAHku2dwdJqnZ0gA2L2hbA4M5I4WqS/8 B5Rhd+D0KdL/B45zL20z2MqdalLLFiUtAkTu8S97RWVotGhON09xOFRvbHM2uCG8VbCk UE1A== 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=n/r2YLWc+BBa+Umbvi1fDfG0Z/QeFXTc8hx5u3dy+3g=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=aYJuLt/YPfFpb24g7jfyVXZGgGqm2IVDkkVm2VvElDCgsA2D+vj0TQWHhN9DuNp44A 2wHUmueeGt/1rIYya9tN5VChKwCyT84jHrZgZkMGevYgv3IVTGD/7Xp1ndFaD8Wt/gaO 4mKXkYocpcuV2GMS1hOzKngfvVC1c4gkuyOaVIoG1osQe8vKQunMHkNM4AhlW4J9lINb w+cRH2LuWXRlFhcvvlE+6ZJ1kputM1Rse73e84RzLrgvIMnlIK8Mb8hLaJ+C4rXmMBSu jT54glhxjBZ71PJyV4bo1YOJQw2D9549Z/zBGdto3i0WmWB6N5fxHmTCtGsNVpDGz1tC 6FDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ylWKKaqY; 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 c7-20020ac85a87000000b004365925c116si16456240qtc.376.2024.04.24.17.10.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10:35 -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=ylWKKaqY; 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 1rzmYH-0008QF-Iq; Wed, 24 Apr 2024 20:01:25 -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 1rzmXa-0008Ae-0N for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:49 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXW-0006Bb-L4 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:39 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-6001399f22bso319001a12.0 for ; Wed, 24 Apr 2024 17:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003236; x=1714608036; 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=n/r2YLWc+BBa+Umbvi1fDfG0Z/QeFXTc8hx5u3dy+3g=; b=ylWKKaqYp9yiUC6uzijN6bZWjb5OMLsMD3XOphZ021TQ+P93ZUhold6YEj7C6zeqVe adR4zQkZ1FtwGMos0MHqlAWiIqsmbC+Q5tWXfK6L/n+MnfKWtYzse6D/XqMrGWsfxMRf 91nEkJH4rIvaghmIOrLKaXI1arFKI/0TQVhwMWyl1RAvDk1wqot0CbyzoIgYBt46/APg Y5/wD5Q4+7dwaGmehwoOF+5XCv1M2Bx/cJjFmAgWBQfOnQnYo0kaVvcIUWSokEHQyAZg 9XT5Rj+kyJEyS6WN3USg2dnAeYkj9rmybKZ6oOKbxeQ8m8Phe5JUR7H3vuVAomzMKtbq IF6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003236; x=1714608036; 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=n/r2YLWc+BBa+Umbvi1fDfG0Z/QeFXTc8hx5u3dy+3g=; b=U3uGk4Qj1kVqN+Mt2DTXo8TJGUe6pnU9Yw9M6F73uCwwFaSW3bOiaH13tZD2fdpGej BC+iIiQj71oCubGxHGi8Ncc43WTV5prGnRe0N5LkFugiSbkhYpdM5+w8c6CLMClnwfB4 RXgJLnmFR02ZRaEzTNL/frTrZ4UixQP4YWRU07bMitD677pICtRAUgAqbRBp3QZOmtuz YH3DB5+sxNb0I1+UPs2pMikLquruSnSFX+/ax8u4TmYOomxXti12loqjlpAhyMnxwDk1 fgkymmTgW+jjb1wMD8RXbCjs5jph7GnTY4z9Ttkyrd85lzUrope8tIuaMjDHmYLWTwGt oJfA== X-Gm-Message-State: AOJu0YzqO6ad+GbnJ0Zl1oEQgZzjtDNq7PGR/nXzVWJvLC+QqMsAO8GE ca5Ar3nAhtf4gWlbyIFUJUAtww/aGwHB6njWI206mxtmMVhDyEWqE/L+BJUgw3DSeN1TIB34jea n X-Received: by 2002:a05:6a20:8423:b0:1ad:31e2:56c with SMTP id c35-20020a056a20842300b001ad31e2056cmr5095535pzd.8.1714003235869; Wed, 24 Apr 2024 17:00:35 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/45] target/hppa: Skip nullified insns in unconditional dbranch path Date: Wed, 24 Apr 2024 16:59:48 -0700 Message-Id: <20240425000023.1002026-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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/hppa/translate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ac181180a6..6a73b1d409 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1804,11 +1804,17 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { install_link(ctx, link, false); - ctx->iaoq_n = dest; - ctx->iaoq_n_var = NULL; if (is_n) { + if (use_nullify_skip(ctx)) { + nullify_set(ctx, 0); + gen_goto_tb(ctx, 0, dest, dest + 4); + ctx->base.is_jmp = DISAS_NORETURN; + return true; + } ctx->null_cond.c = TCG_COND_ALWAYS; } + ctx->iaoq_n = dest; + ctx->iaoq_n_var = NULL; } else { nullify_over(ctx); From patchwork Wed Apr 24 23:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791771 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118469wrq; Wed, 24 Apr 2024 17:08:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVR2/ZscDLxSdxgSfQ+kRfw3l0BgRtco5B+RzYmW86tcmn9/6184Qf7ZJwMbczS8aulxwmNyBzHKRheoipqZU0E X-Google-Smtp-Source: AGHT+IHvZNKl17cH6hRgPWUUs7lfUtpCiZlTBasby2RhAS/iX1kjrOnyj6crFwzChMzTPvzzUDYI X-Received: by 2002:a05:6358:79f:b0:183:9ea4:74a9 with SMTP id n31-20020a056358079f00b001839ea474a9mr3981637rwj.15.1714003728402; Wed, 24 Apr 2024 17:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003728; cv=none; d=google.com; s=arc-20160816; b=O89t737a6erkFGb2/nnaLGYFpHUcAwt9S7Ybo8rJHgyP0i2/CqTECMZTIspKhAbe18 p/ZvzgMLUsR61wj/cMvrKCXp8L34ljVaXf4jbL7R9BL/l3nB6xJ3XFh4rylHXEDGDl3L 2HHoACpGWLjF53eSryoaHeMpKNQCro7Rqt/1yKRDqRU3uQe6TqMQkOi/SeJbYqkTB7WM WdWYaFo0XH5Cg77Cf1uiWTWhC0/+6HImpf7QBvPbtRIjEUq7OqrgjYkiWy7UVws4cwgu NZ3TveJoq1uqT7r623D7Pg4/XG4KgAae1CIUD+ikkJGILKDwV83syoR3JJNWUmP+TKw/ g59g== 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=tPC7wSbqYey/nztPRCYsOGiA7aZBGXEi4HjvhSZ7eFQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tC83GE7whlsc93TgXzDCawQhwGp/wybDwcRgtKrXpywmnpNPryGQKoQe1ceAPa66Y9 VRPnkJ8bLptsbtMdX2tjAMKj5bbbU/pvH42cUHYDC+lATida2MpizA+CshUTL+f2Szwn PaiiwrluZMwcS37Nd8xTQAzsaozEoSl8Jy+hK847HwBPfHV6D7rxK7hSru2r88y/HRUY b4br3M6WcHKA7FLKQQN79sVOqXKLCho4vSl9rclLatelGC2rlSniULdbVoY2S2LxJmX4 IRSVczIx0pDV/dSebFMVKDGp5L0qmnUQbsfrLC4EyJ91tCo9K6odU+kiBsa/illL0TIm MjxQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n3fwOiNz; 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 v4-20020ac85784000000b00434e54824e5si15971583qta.648.2024.04.24.17.08.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:48 -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=n3fwOiNz; 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 1rzmYH-0008QG-Ie; Wed, 24 Apr 2024 20:01:25 -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 1rzmXa-0008Af-Bi for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:49 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXW-0006C0-LX for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:40 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso320287a12.3 for ; Wed, 24 Apr 2024 17:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003237; x=1714608037; 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=tPC7wSbqYey/nztPRCYsOGiA7aZBGXEi4HjvhSZ7eFQ=; b=n3fwOiNz4XgKciSYQAQW9/3EZbXn6x6KdyS+1JDM8a2y9ALtjUEymAlvPzF2lIUSiv k9qYvtB8bo2E3k3mDdWpvXNnL4mtuCgrqMqpGmWilNlMD0GJgz+jTJjpREqE7JeISzil OR+fabsBId6GRyWaUEyCiJCJDwhx/k6zDsgi5GEhK05aTX2gszbsi9/LC45xmxhu8iFn 5AqjjE6eYG1cGQtX4Zt1BMQFo4RI9UqCVxS0QnkRqZw9eXXUfa0h4FMwAA7/aN6ywwCe p3GT9rWkXO9lnkPHImxJh4QKkeT5geTpER/Bd+v4At5CRJyk1eNeX8pdg0mwvSwpVVVB zFBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003237; x=1714608037; 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=tPC7wSbqYey/nztPRCYsOGiA7aZBGXEi4HjvhSZ7eFQ=; b=sg2MMKs79E9trrm6709JW94HA8GOGCRj2hMEpoF5qQQwPfgUmviaCQg6qxAcWuA+YS 2s3cYOx4G4OqkNZOy2K/9aLz2bXDgZbhrjXVvn50NYiX78lQN9euS8a4amMSM2MMDLnU IZsvUXPgfgJyEOPBiNyytB0vdMUnMhurLEyN1Ol5AEAVcdyh/shGWgBuY5vKUx6TOumo 26kwwZum2FYohsNX0vhlXcR4gtZkX9Ya6JGBq/oG2MJfUiVGzhfl2FvZvHiJRdMDdt+e VdCp1mDB4fms8S2Pbe7oy8AfEoQdpbYR3hAdIjVtK+a57CB3kv3ZDUQ6SOXVoepumiAJ XXHg== X-Gm-Message-State: AOJu0Yz010BjfwxwVEhkvFtVXvMtNcduOfRuK4W3KTMVMkORYkcUgdJz E+XreWDOrWEfV9GjjMCgEWs9zLp4T9rZNqMN+Sdhn8f4haRverSKeoD5n/iHC2XxPc7EMLNnnS+ z X-Received: by 2002:a17:90b:1e0e:b0:2a2:ea20:2074 with SMTP id pg14-20020a17090b1e0e00b002a2ea202074mr4537364pjb.23.1714003236750; Wed, 24 Apr 2024 17:00:36 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/45] target/hppa: Simplify TB end Date: Wed, 24 Apr 2024 16:59:49 -0700 Message-Id: <20240425000023.1002026-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 Minimize the amount of code in hppa_tr_translate_insn advancing the insn queue for the next insn. Move the goto_tb path to hppa_tr_tb_stop. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 109 +++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 6a73b1d409..138250b550 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4698,54 +4698,31 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) } } - /* Advance the insn queue. Note that this check also detects - a priority change within the instruction queue. */ - if (ret == DISAS_NEXT && ctx->iaoq_b != ctx->iaoq_f + 4) { - if (use_goto_tb(ctx, ctx->iaoq_b, ctx->iaoq_n) - && (ctx->null_cond.c == TCG_COND_NEVER - || ctx->null_cond.c == TCG_COND_ALWAYS)) { - nullify_set(ctx, ctx->null_cond.c == TCG_COND_ALWAYS); - gen_goto_tb(ctx, 0, ctx->iaoq_b, ctx->iaoq_n); - ctx->base.is_jmp = ret = DISAS_NORETURN; - } else { - ctx->base.is_jmp = ret = DISAS_IAQ_N_STALE; - } + /* If the TranslationBlock must end, do so. */ + ctx->base.pc_next += 4; + if (ret != DISAS_NEXT) { + return; } + /* Note this also detects a priority change. */ + if (ctx->iaoq_b != ctx->iaoq_f + 4) { + ctx->base.is_jmp = DISAS_IAQ_N_STALE; + return; + } + + /* + * Advance the insn queue. + * The only exit now is DISAS_TOO_MANY from the translator loop. + */ ctx->iaoq_f = ctx->iaoq_b; ctx->iaoq_b = ctx->iaoq_n; - ctx->base.pc_next += 4; - - switch (ret) { - case DISAS_NORETURN: - case DISAS_IAQ_N_UPDATED: - break; - - case DISAS_NEXT: - case DISAS_IAQ_N_STALE: - case DISAS_IAQ_N_STALE_EXIT: - if (ctx->iaoq_f == -1) { - install_iaq_entries(ctx, -1, cpu_iaoq_b, - ctx->iaoq_n, ctx->iaoq_n_var); -#ifndef CONFIG_USER_ONLY - tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); -#endif - nullify_save(ctx); - ctx->base.is_jmp = (ret == DISAS_IAQ_N_STALE_EXIT - ? DISAS_EXIT - : DISAS_IAQ_N_UPDATED); - } else if (ctx->iaoq_b == -1) { - if (ctx->iaoq_n_var) { - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, ctx->iaoq_n_var); - } else { - tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_b, 4); - tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, - gva_offset_mask(ctx->tb_flags)); - } + if (ctx->iaoq_b == -1) { + if (ctx->iaoq_n_var) { + copy_iaoq_entry(ctx, cpu_iaoq_b, -1, ctx->iaoq_n_var); + } else { + tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_b, 4); + tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, + gva_offset_mask(ctx->tb_flags)); } - break; - - default: - g_assert_not_reached(); } } @@ -4753,23 +4730,51 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); DisasJumpType is_jmp = ctx->base.is_jmp; + uint64_t fi, bi; + TCGv_i64 fv, bv; + TCGv_i64 fs; + + /* Assume the insn queue has not been advanced. */ + fi = ctx->iaoq_b; + fv = cpu_iaoq_b; + fs = fi == -1 ? cpu_iasq_b : NULL; + bi = ctx->iaoq_n; + bv = ctx->iaoq_n_var; switch (is_jmp) { case DISAS_NORETURN: break; case DISAS_TOO_MANY: - case DISAS_IAQ_N_STALE: - case DISAS_IAQ_N_STALE_EXIT: - install_iaq_entries(ctx, ctx->iaoq_f, cpu_iaoq_f, - ctx->iaoq_b, cpu_iaoq_b); - nullify_save(ctx); + /* The insn queue has not been advanced. */ + bi = fi; + bv = fv; + fi = ctx->iaoq_f; + fv = NULL; + fs = NULL; /* FALLTHRU */ - case DISAS_IAQ_N_UPDATED: - if (is_jmp != DISAS_IAQ_N_STALE_EXIT) { - tcg_gen_lookup_and_goto_ptr(); + case DISAS_IAQ_N_STALE: + if (use_goto_tb(ctx, fi, bi) + && (ctx->null_cond.c == TCG_COND_NEVER + || ctx->null_cond.c == TCG_COND_ALWAYS)) { + nullify_set(ctx, ctx->null_cond.c == TCG_COND_ALWAYS); + gen_goto_tb(ctx, 0, fi, bi); break; } /* FALLTHRU */ + case DISAS_IAQ_N_STALE_EXIT: + install_iaq_entries(ctx, fi, fv, bi, bv); + if (fs) { + tcg_gen_mov_i64(cpu_iasq_f, fs); + } + nullify_save(ctx); + if (is_jmp == DISAS_IAQ_N_STALE_EXIT) { + tcg_gen_exit_tb(NULL, 0); + break; + } + /* FALLTHRU */ + case DISAS_IAQ_N_UPDATED: + tcg_gen_lookup_and_goto_ptr(); + break; case DISAS_EXIT: tcg_gen_exit_tb(NULL, 0); break; From patchwork Wed Apr 24 23:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791773 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118482wrq; Wed, 24 Apr 2024 17:08:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXMReDUr2Vr2J8UJFfJP9cKgeB9i+kMWgcmjJYQN1B51Rk+DAojqyN+9FThjMt7j1j/AI/auBTVJLFeNHfM1Vl X-Google-Smtp-Source: AGHT+IHg647AZbqd09fHOnZJNw5owAjeKKE0lYfKbE8xiK1ILki11K7yRFFwClEy0Xwl7LWQ6F6j X-Received: by 2002:a0c:fdca:0:b0:6a0:7d91:1adf with SMTP id g10-20020a0cfdca000000b006a07d911adfmr4052952qvs.35.1714003730150; Wed, 24 Apr 2024 17:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003730; cv=none; d=google.com; s=arc-20160816; b=okB3SZfGhtZwgt/X7CiVVNBBqfSjWaHVRz9YpzJM81rMtxgzhPvQFvy4DQYHEXM0rt HQOiuC2J42UHsdk77QprZFlNCOa5fb0znMURCDMhAXnelB62iRWp8cbwgHKWdLQtvL4/ O7lm4aR4Rd7ZfZ3EhQ4syDhtpfKgok9ZmIVJQ+ZWewBxgu5qtXCSc7ntROLfzg5FTGVW DccNJcSmDBPxE9LI24piKPwQHVETTSZvEVVkwXGAxG1Th6cT8i7LY+GZqtXav6VKHFm5 +Mb99z/tMT4yvIADgrmofR4A+4+WEdIMKhyZSeLCxGme+qN+9IKeNvLK1gvwhhy87rQm Bnvg== 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=1R4n87rS3DeEnBoWSAaX+71ppkJFcbZ3XLEos1pPsJ0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=l0Sp0/3F1WdFqpGooVdJUJCUrheykcemi8gR8j1+RH3qtibXx8u47VEj2lszJdM4yD j91C0xDDCYxffWdYalRS9rWLTX4tG+sb+ExzNxbdfdxUfKnieHhVg5dY1kcF/JExFkWQ u5FBMTP0BGbXOULmlUURTNhXlWPQsHox+W8z7NL8EIEot4VrRUFhQu35RdC2Z0jywFna NzFydpWHAGbRfOnGhLNSHUwLRhRPl5ZtkP484zjum7recxr+WfIk/HlfeUQ/V417SXiG XqUbn7l5/y9pAscLH8Uo6MDbxLduOtmpx5ovnEme+LlgUSKnBuUENh/9zXVJt6iQfZGa oX/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j9WFH483; 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 kd12-20020a056214400c00b006a085f71676si7032425qvb.21.2024.04.24.17.08.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:50 -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=j9WFH483; 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 1rzmXz-0008Jg-Ix; Wed, 24 Apr 2024 20:01: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 1rzmXc-0008Ap-46 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:50 -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 1rzmXY-0006E1-Q7 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:43 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1e36b7e7dd2so3448875ad.1 for ; Wed, 24 Apr 2024 17:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003239; x=1714608039; 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=1R4n87rS3DeEnBoWSAaX+71ppkJFcbZ3XLEos1pPsJ0=; b=j9WFH483MA91hjwQ5zLR5SEUdSeoI+r/ny27tyCOxZIeEyT3wiK+YqQnVtYrGjdVa/ /u0rdvJF0mnmemw6GOmQvwJhr8Xpl8lnFvIt6HF8SNoI1gtVu/AgP1UJYZZJAtL3Pgqc i+C/qD8SBOIpimB2SwKlRoTk9wtDeb3Ys3PXH9zgySv//jDnGAlf1rQdPRDTQuVsuuAv q+U9k3+j/j/JvWojEc9/zwxU7qoSwKwhPbAE7ZZM0SFPhmJaAan4rj9Y3bMezeTqptmA OREqDHe/aUi0e8btAeSqYdDg1kDP6FXHtl5SdngGFVVLYG5iqKxyCA4yKAcZlKvKpPB2 MbSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003239; x=1714608039; 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=1R4n87rS3DeEnBoWSAaX+71ppkJFcbZ3XLEos1pPsJ0=; b=UoYmsocikqlUuXjKQ0+ELBC7bphp1yhX5oh10/1K/T9YUMXvo0dz1Qif7FkQNTGiLI h81JSArz/dzTqf9K233xHG7yfWTdusBNmevbmiya5A3bCqQilBP9+vhslRIa6pcFZGic UKcQBQoX3vDLy9CBDEFPqqEOjzv0+/D43YXbXJyo0bjAXeB9nweOtci8o4HsfJSnFMCR GCkjgiHMTvvJcxJcPwQKHmeaTUxn2le7WY9qy40iMZjsLhbb8NugpRzH7iC8DmRTnxmO CxOsNg8G3rRa2yakJKAaUx2HLmrpDzoEaVArLiXWilwFhb++rnhzBiUVDVp+JLMWPS6k k3eg== X-Gm-Message-State: AOJu0YwGsScCzYfr6SvydJpKlc+ksM4LL0eBK9C7bzioR/Qs01zxKMsh rR+Bsjd9wL0MxJgcDQ3igCrnXHoxTFX9SsMbr5WKmlhNPR9znr7iPpI/mtphFDxagJKVMQ7eie+ u X-Received: by 2002:a17:902:daca:b0:1e4:9ad5:7522 with SMTP id q10-20020a170902daca00b001e49ad57522mr4898056plx.21.1714003237578; Wed, 24 Apr 2024 17:00:37 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/45] target/hppa: Add IASQ entries to DisasContext Date: Wed, 24 Apr 2024 16:59:50 -0700 Message-Id: <20240425000023.1002026-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 Add variable to track space changes to IAQ. So far, no such changes are introduced, but the new checks vs ctx->iasq_b may eliminate an unnecessary copy to cpu_iasq_f with e.g. BLR. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 138250b550..43a74dafcf 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -49,6 +49,13 @@ typedef struct DisasContext { uint64_t iaoq_b; uint64_t iaoq_n; TCGv_i64 iaoq_n_var; + /* + * Null when IASQ_Back unchanged from IASQ_Front, + * or cpu_iasq_b, when IASQ_Back has been changed. + */ + TCGv_i64 iasq_b; + /* Null when IASQ_Next unchanged from IASQ_Back, or set by branch. */ + TCGv_i64 iasq_n; DisasCond null_cond; TCGLabel *null_lab; @@ -3915,12 +3922,12 @@ static bool trans_be(DisasContext *ctx, arg_be *a) if (a->n && use_nullify_skip(ctx)) { install_iaq_entries(ctx, -1, tmp, -1, NULL); tcg_gen_mov_i64(cpu_iasq_f, new_spc); - tcg_gen_mov_i64(cpu_iasq_b, cpu_iasq_f); + tcg_gen_mov_i64(cpu_iasq_b, new_spc); nullify_set(ctx, 0); } else { install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, tmp); - if (ctx->iaoq_b == -1) { - tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); + if (ctx->iasq_b) { + tcg_gen_mov_i64(cpu_iasq_f, ctx->iasq_b); } tcg_gen_mov_i64(cpu_iasq_b, new_spc); nullify_set(ctx, a->n); @@ -4034,8 +4041,8 @@ static bool trans_bve(DisasContext *ctx, arg_bve *a) install_link(ctx, a->l, false); install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, dest); - if (ctx->iaoq_b == -1) { - tcg_gen_mov_i64(cpu_iasq_f, cpu_iasq_b); + if (ctx->iasq_b) { + tcg_gen_mov_i64(cpu_iasq_f, ctx->iasq_b); } tcg_gen_mov_i64(cpu_iasq_b, space_select(ctx, 0, dest)); nullify_set(ctx, a->n); @@ -4616,6 +4623,7 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->mmu_idx = MMU_USER_IDX; ctx->iaoq_f = ctx->base.pc_first | ctx->privilege; ctx->iaoq_b = ctx->base.tb->cs_base | ctx->privilege; + ctx->iasq_b = NULL; ctx->unalign = (ctx->tb_flags & TB_FLAG_UNALIGN ? MO_UNALN : MO_ALIGN); #else ctx->privilege = (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; @@ -4630,6 +4638,7 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->iaoq_f = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; ctx->iaoq_b = (diff ? ctx->iaoq_f + diff : -1); + ctx->iasq_b = (diff ? NULL : cpu_iasq_b); #endif ctx->zero = tcg_constant_i64(0); @@ -4682,6 +4691,7 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) /* Set up the IA queue for the next insn. This will be overwritten by a branch. */ + ctx->iasq_n = NULL; ctx->iaoq_n_var = NULL; ctx->iaoq_n = ctx->iaoq_b == -1 ? -1 : ctx->iaoq_b + 4; @@ -4704,7 +4714,7 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) return; } /* Note this also detects a priority change. */ - if (ctx->iaoq_b != ctx->iaoq_f + 4) { + if (ctx->iaoq_b != ctx->iaoq_f + 4 || ctx->iasq_b) { ctx->base.is_jmp = DISAS_IAQ_N_STALE; return; } @@ -4724,6 +4734,10 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) gva_offset_mask(ctx->tb_flags)); } } + if (ctx->iasq_n) { + tcg_gen_mov_i64(cpu_iasq_b, ctx->iasq_n); + ctx->iasq_b = cpu_iasq_b; + } } static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) @@ -4732,14 +4746,15 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) DisasJumpType is_jmp = ctx->base.is_jmp; uint64_t fi, bi; TCGv_i64 fv, bv; - TCGv_i64 fs; + TCGv_i64 fs, bs; /* Assume the insn queue has not been advanced. */ fi = ctx->iaoq_b; fv = cpu_iaoq_b; - fs = fi == -1 ? cpu_iasq_b : NULL; + fs = ctx->iasq_b; bi = ctx->iaoq_n; bv = ctx->iaoq_n_var; + bs = ctx->iasq_n; switch (is_jmp) { case DISAS_NORETURN: @@ -4748,12 +4763,15 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) /* The insn queue has not been advanced. */ bi = fi; bv = fv; + bs = fs; fi = ctx->iaoq_f; fv = NULL; fs = NULL; /* FALLTHRU */ case DISAS_IAQ_N_STALE: - if (use_goto_tb(ctx, fi, bi) + if (fs == NULL + && bs == NULL + && use_goto_tb(ctx, fi, bi) && (ctx->null_cond.c == TCG_COND_NEVER || ctx->null_cond.c == TCG_COND_ALWAYS)) { nullify_set(ctx, ctx->null_cond.c == TCG_COND_ALWAYS); @@ -4766,6 +4784,9 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) if (fs) { tcg_gen_mov_i64(cpu_iasq_f, fs); } + if (bs) { + tcg_gen_mov_i64(cpu_iasq_b, bs); + } nullify_save(ctx); if (is_jmp == DISAS_IAQ_N_STALE_EXIT) { tcg_gen_exit_tb(NULL, 0); From patchwork Wed Apr 24 23:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791759 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1116174wrq; Wed, 24 Apr 2024 17:03:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUuAju30mbWIr1rmylWdOzOJqEeP1q7fMcOyqwjclsOSIaXhtIwpn0ksUeZGHMKk9IoMDx82cZfO+K/bnU3siiI X-Google-Smtp-Source: AGHT+IEA+0Cw/U4EfRmY4Fo0bfAWR8RY15IZ7+rkpP1c1kNy6MnlC+ZdR/lkLXoeAOglE/yoY1dh X-Received: by 2002:ac8:5a8e:0:b0:437:c4ed:cfe0 with SMTP id c14-20020ac85a8e000000b00437c4edcfe0mr5856831qtc.33.1714003399259; Wed, 24 Apr 2024 17:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003399; cv=none; d=google.com; s=arc-20160816; b=e6DlUoIXc5p8E5553s135/tcx1gTPmtCpmuSZwqUuoVMT2BPyEsvmCMT6orYBXCnzl DBSW5MMkCBaHUmasMSbA9Tzf5FJeNOhD2zIN8gYULL65cPlbUuVoXuTO4I6RNM5sfltp dl8x2hWXPSqm3vjXCd87lCiiHmdwrfH+Mx6UBvmz7VHv/Wu+2FUysnVWltJF/j8hbfju VAQJGxovXEuiDwRVgJVfhyMV4UtNw5r1lxgEJ0CjDOU702J0vSXlDFausr3I2UNDr1ze 26u6wXlVgfi26p5qTWW5g4XGLfE/sweXeCPPieynZjSPjjfkhoj9xWiZMThzVp0hbSVC ntUQ== 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=NMh1gjymklr1tDAtllO8vmcq7cYQz/9E3LdP6tKYKzg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=e9NJ5AFI0I1y/8Mm+xRiK7ya+tx4rg0ijSn7EbdxfYXph6y8un5cKGruTALn0vDSnv JG1IjmgX51yLXw/XjuLx3hNHUexuWWyQMWajhRfnNUERTVARlJqWNOBjNcfcZPPeCY2q DLguw3E47eSas6GVpy8YgyxQKwiIBnp4iwZGsxtDDUr3EGbIM97Yma1ir7vYu9wV+Wn5 zGZWzzjLQn6qSUjESUhWvwAZKAl+gL2Qg0k4qS9LeeXDP6wLN/Yi147ixZNAdOzrOz1X PJDiocNwlqGJuONzW8CWYrxrjYQl16FLTMTqd9+7d9Q0HL1hfV3uCA3Dg9tuv0po2CKu wYSQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uWfjLYi7; 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 pe5-20020a05620a850500b0078d6151d4c4si16066203qkn.61.2024.04.24.17.03.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uWfjLYi7; 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 1rzmY9-0008O4-1n; Wed, 24 Apr 2024 20:01:17 -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 1rzmXe-0008Az-47 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:50 -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 1rzmXZ-0006EH-Pm for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:44 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e51398cc4eso3766425ad.2 for ; Wed, 24 Apr 2024 17:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003240; x=1714608040; 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=NMh1gjymklr1tDAtllO8vmcq7cYQz/9E3LdP6tKYKzg=; b=uWfjLYi7wZJbDk6sc+V5/ypmTy7WKPXwXrrG+TgBeFof1vA+KXErLkVhGm3gqVR0WP hZCiILnbN+6/Q86OiGTwjnEb8XUuZtYXJaMIfR7CFwyom3ZAajQBd7Bq+Cxxe9XV4Z6W lsXd4gM2VWfQgJGbC66snf9SWMqaw16R6jPT/L7A1jvSe4tEYgkCLgSKCnA4ZN4dmzsu CErX4FLG4U4CZYwTakZHwR+mVhNEBowExOtXuMrtID2428/NBnSc0X9Z6iBRQSNc297N mbt+0hvKs0AI3XPOXACBtmZh0XlTfhA/3MDMZ2G3C0T/mktgcipIsuz2AC39EpKkjq61 ehmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003240; x=1714608040; 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=NMh1gjymklr1tDAtllO8vmcq7cYQz/9E3LdP6tKYKzg=; b=RBFuaB8EyuogwKkFVaZkQhJ9kIpGCXR8/yVDCDKrYDFlFCs8rOiI3hVEVm3Lz8W3X8 ZTjnFOMfrvP5q6zPA+A1aTsQBpHTS15q3FalOEnf1qMMMqADpOUu4bIe7BfUm/MGpzsT ICaXkfcCCpGgOFkENZf3yyShiV/WfSn4rrQCFKN2OhjVm2kPmMtizKPl7LKinjCu2Yf2 P1QQL+tehpzFSPx/TyljX1tfQlGG+OUC4qyrGwBJcDtgcyRq/zUTjFazEDNmiRgWqltW JB028hcRBoOjbVIXOaxEHvg4gkJ0ja6/KlES8xYmRiEC5+06P8ZtAlWJq8iX3Z+Qlvb9 UyVg== X-Gm-Message-State: AOJu0YxDO4X9yqU5UqiJgsMjdjCWfBpejpEKhsmge8IOXg6re1FPs6ml /9a0sktcYcqQRuKMoNi0N1R/A8xMts1yxSFA7pJgMciCiMjEUEKbvz1mVWOJBlL6N66iycwNYx1 g X-Received: by 2002:a17:902:f54f:b0:1e4:1932:b0a5 with SMTP id h15-20020a170902f54f00b001e41932b0a5mr5591953plf.68.1714003238392; Wed, 24 Apr 2024 17:00:38 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/45] target/hppa: Add space arguments to install_iaq_entries Date: Wed, 24 Apr 2024 16:59:51 -0700 Message-Id: <20240425000023.1002026-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move space assighments to a central location. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 58 +++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 43a74dafcf..6b3b298678 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -623,8 +623,9 @@ static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest, } } -static void install_iaq_entries(DisasContext *ctx, uint64_t bi, TCGv_i64 bv, - uint64_t ni, TCGv_i64 nv) +static void install_iaq_entries(DisasContext *ctx, + uint64_t bi, TCGv_i64 bv, TCGv_i64 bs, + uint64_t ni, TCGv_i64 nv, TCGv_i64 ns) { copy_iaoq_entry(ctx, cpu_iaoq_f, bi, bv); @@ -638,6 +639,12 @@ static void install_iaq_entries(DisasContext *ctx, uint64_t bi, TCGv_i64 bv, tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, gva_offset_mask(ctx->tb_flags)); } + if (bs) { + tcg_gen_mov_i64(cpu_iasq_f, bs); + } + if (ns || bs) { + tcg_gen_mov_i64(cpu_iasq_b, ns ? ns : bs); + } } static void install_link(DisasContext *ctx, unsigned link, bool with_sr0) @@ -669,7 +676,8 @@ static void gen_excp_1(int exception) static void gen_excp(DisasContext *ctx, int exception) { - install_iaq_entries(ctx, ctx->iaoq_f, cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); + install_iaq_entries(ctx, ctx->iaoq_f, cpu_iaoq_f, NULL, + ctx->iaoq_b, cpu_iaoq_b, NULL); nullify_save(ctx); gen_excp_1(exception); ctx->base.is_jmp = DISAS_NORETURN; @@ -723,10 +731,11 @@ static void gen_goto_tb(DisasContext *ctx, int which, { if (use_goto_tb(ctx, b, n)) { tcg_gen_goto_tb(which); - install_iaq_entries(ctx, b, NULL, n, NULL); + install_iaq_entries(ctx, b, NULL, NULL, n, NULL, NULL); tcg_gen_exit_tb(ctx->base.tb, which); } else { - install_iaq_entries(ctx, b, cpu_iaoq_b, n, ctx->iaoq_n_var); + install_iaq_entries(ctx, b, cpu_iaoq_b, ctx->iasq_b, + n, ctx->iaoq_n_var, ctx->iasq_n); tcg_gen_lookup_and_goto_ptr(); } } @@ -1915,7 +1924,7 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, install_link(ctx, link, false); if (is_n) { if (use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, next, -1, NULL); + install_iaq_entries(ctx, -1, next, NULL, -1, NULL, NULL); nullify_set(ctx, 0); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; return true; @@ -1934,10 +1943,11 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, install_link(ctx, link, false); if (is_n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, next, -1, NULL); + install_iaq_entries(ctx, -1, next, NULL, -1, NULL, NULL); nullify_set(ctx, 0); } else { - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, next); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, + -1, next, NULL); nullify_set(ctx, is_n); } @@ -2025,7 +2035,7 @@ static void do_page_zero(DisasContext *ctx) tcg_gen_st_i64(cpu_gr[26], tcg_env, offsetof(CPUHPPAState, cr[27])); tmp = tcg_temp_new_i64(); tcg_gen_ori_i64(tmp, cpu_gr[31], 3); - install_iaq_entries(ctx, -1, tmp, -1, NULL); + install_iaq_entries(ctx, -1, tmp, NULL, -1, NULL, NULL); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; break; @@ -2769,8 +2779,8 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf_d *a) nullify_over(ctx); /* Advance the instruction queue. */ - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, - ctx->iaoq_n, ctx->iaoq_n_var); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, + ctx->iaoq_n, ctx->iaoq_n_var, ctx->iasq_n); nullify_set(ctx, 0); /* Tell the qemu main loop to halt until this cpu has work. */ @@ -3920,16 +3930,11 @@ static bool trans_be(DisasContext *ctx, arg_be *a) load_spr(ctx, new_spc, a->sp); install_link(ctx, a->l, true); if (a->n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, tmp, -1, NULL); - tcg_gen_mov_i64(cpu_iasq_f, new_spc); - tcg_gen_mov_i64(cpu_iasq_b, new_spc); + install_iaq_entries(ctx, -1, tmp, new_spc, -1, NULL, new_spc); nullify_set(ctx, 0); } else { - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, tmp); - if (ctx->iasq_b) { - tcg_gen_mov_i64(cpu_iasq_f, ctx->iasq_b); - } - tcg_gen_mov_i64(cpu_iasq_b, new_spc); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, + -1, tmp, new_spc); nullify_set(ctx, a->n); } tcg_gen_lookup_and_goto_ptr(); @@ -4040,11 +4045,8 @@ static bool trans_bve(DisasContext *ctx, arg_bve *a) dest = do_ibranch_priv(ctx, dest); install_link(ctx, a->l, false); - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, -1, dest); - if (ctx->iasq_b) { - tcg_gen_mov_i64(cpu_iasq_f, ctx->iasq_b); - } - tcg_gen_mov_i64(cpu_iasq_b, space_select(ctx, 0, dest)); + install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, + -1, dest, space_select(ctx, 0, dest)); nullify_set(ctx, a->n); tcg_gen_lookup_and_goto_ptr(); ctx->base.is_jmp = DISAS_NORETURN; @@ -4780,13 +4782,7 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } /* FALLTHRU */ case DISAS_IAQ_N_STALE_EXIT: - install_iaq_entries(ctx, fi, fv, bi, bv); - if (fs) { - tcg_gen_mov_i64(cpu_iasq_f, fs); - } - if (bs) { - tcg_gen_mov_i64(cpu_iasq_b, bs); - } + install_iaq_entries(ctx, fi, fv, fs, bi, bv, bs); nullify_save(ctx); if (is_jmp == DISAS_IAQ_N_STALE_EXIT) { tcg_gen_exit_tb(NULL, 0); From patchwork Wed Apr 24 23:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791782 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119156wrq; Wed, 24 Apr 2024 17:10:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXMGBiKaAT1FJLKMqfHoxEagU2gK/FVTcQgOoDK4G6qpwDbQkZQsEea6JuxXVvSFf8Y6v4fIpfAxaNyq/UDu/b5 X-Google-Smtp-Source: AGHT+IHTNjKszo20G7jCh0sSWFFKLLB1RRmMnlr5NEbyV6FVkePwR3l/a/tmjjkVevIMWX2QocOj X-Received: by 2002:a0c:d7c7:0:b0:6a0:80f0:fa53 with SMTP id g7-20020a0cd7c7000000b006a080f0fa53mr4329200qvj.1.1714003837224; Wed, 24 Apr 2024 17:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003837; cv=none; d=google.com; s=arc-20160816; b=cTvG3EQ6AAnbccXi6vXpfC9DqrJYscgwZ6JsqEzM+UrPfNA6CRfWNj+sW7vwczCAc0 6oLJASbTCIqkIN52ZX6uMcNQBmY++XV0i0VuSWD4IGA3D56CPLNf8zLV5sg4hDGrKKfy DW/OAvqukdrZwiuMbBcmiS51TLOfCZCZXlDHK7tAIuDUdIwn+4oeiT9NGsh+NW940K7M 0XQlDYIftaM9tLZ4RvYHMJRqX2T+z08dJlLrAEGdYcVWLlaHKdopF/F4FjdChFaTRzUt rSgGcbK1+QS2tKVlH5YUnDSymOof4S02kSmGSh4zgAYb88V0VozBhmpj23UiW/mT8Fjd 3fTw== 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=+Sn1JTeEfTZOk+RwEEIDqXZrh/6FLZ4ooVDbCTyJn+s=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=qmwh0eEcOjwGorMQmlKD8vCXGhR8socjZixJ/CYdsc0GSVGpipm2vP18rUJ86Z3KHH 8GXHGvIPbaxaa9qvOqGeVRdBqvpA59BKWmF/fUz4YhQaxnQ8qypYVNGXiu85aadWYsaU GZaLfKmW7CZP8L75AMwpxyypbZ8uwgbNAUyq/hayEAd6g4TJ8eTdIS66JTO+lBMGlYs1 AaWDYGh5vCdt3mO70ffnEySeP4nIitw9H8y5HHxBjKlUnMZezsENIyFXyN9FRZ5OB6k7 TSmyeFw8k6skrnEOKfaohEn31MZ7jg1Qg3fx2aDzKKVWpzChlHIvFPJrQiQLsyDd32wE RCwA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NsH6dk8x; 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 fw7-20020a056214238700b006a07a484bf2si9274989qvb.482.2024.04.24.17.10.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10:37 -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=NsH6dk8x; 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 1rzmY3-0008Lk-Lk; Wed, 24 Apr 2024 20:01:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXe-0008B1-5F for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:50 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXZ-0006E4-A4 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:44 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1e5715a9ebdso3123085ad.2 for ; Wed, 24 Apr 2024 17:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003239; x=1714608039; 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=+Sn1JTeEfTZOk+RwEEIDqXZrh/6FLZ4ooVDbCTyJn+s=; b=NsH6dk8xb/vUOpD5tKVQMNCCXdy+gsbkJ0boeA1UUT9bOkxkrLf2Zf3caAWx9uQBVY WYPr1QWEpvpaFFdn37J96kgczuSrSIoyEqmy6ZuhR+mQRfpelL5BcdJIBmCp82R9d539 +L8GfiQ7Ykhl5cI3T7vIaVhCz0KtCt8JvsDR/1NId/5k8VUmpYo2Myqfhu2l0mHOdaPL MU8ZRg7yZXs5P3Yjg8ecTH8PqOvxnSKsPV7yVSuMEnFh5qgFo9uG1L9P36pBP1LpHqsx TZWGiRYAZVb6WLfkgwi9jK7ZCKHKk9zpL90n/ssP8cTmDD+HCJY0v7z8Qq+0HRMU3fdX zUlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003239; x=1714608039; 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=+Sn1JTeEfTZOk+RwEEIDqXZrh/6FLZ4ooVDbCTyJn+s=; b=iTAWbRWVRyixpeB1To2+CSTOn3NsJPzZlE+t1L/2hbpf8FEB7SKaVrIvN5KZZVgbTm 5i7bYdiIQG8vRatIeWwvhlv0+cxKPPbGJpZaMHd72gDVbatuSTAFvD098XywTdDAT7nO ZdFnSd7syFj9gnqgqM3ucz/RgaVHfrxiIKoImhpdr9HAeACSDjuxG86GH4zUcRpcj0Nl dg5mWfXpGaG4x45e1yvjGuzDP9+iai64DLuvyksMXJTtbhhxIDuxy9cLcTIFWyzhEBV4 QfQuJQ7k0fLzxjcOWBhuD/lcFRZfGNiDUuMOcDOFJlydpXnpjQQBAne+E2pvkKVTO6gs kzHA== X-Gm-Message-State: AOJu0Yy1dkJ8XDQhvYO2QDe51s/QQv6alp2tVRWs4+2EV8u3OQoLup9l EVpTyBj1IMTT38WbaKzsql/z9QmW73I7qICq3UmW04sCOX6sAivn3jhywy5WmJTaQYjKvhwFXwp 6 X-Received: by 2002:a17:902:74c2:b0:1e4:ad9b:f770 with SMTP id f2-20020a17090274c200b001e4ad9bf770mr4024799plt.23.1714003239236; Wed, 24 Apr 2024 17:00:39 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 14/45] target/hppa: Add space argument to do_ibranch Date: Wed, 24 Apr 2024 16:59:52 -0700 Message-Id: <20240425000023.1002026-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 This allows unification of BE, BLR, BV, BVE with a common helper. Since we can now track space with IAQ_Next, we can now let the TranslationBlock continue across the delay slot with BE, BVE. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 76 ++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 50 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 6b3b298678..2ddaefde21 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1912,8 +1912,8 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, /* Emit an unconditional branch to an indirect target. This handles nullification of the branch itself. */ -static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, - unsigned link, bool is_n) +static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, TCGv_i64 dspc, + unsigned link, bool with_sr0, bool is_n) { TCGv_i64 next; @@ -1921,10 +1921,10 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, next = tcg_temp_new_i64(); tcg_gen_mov_i64(next, dest); - install_link(ctx, link, false); + install_link(ctx, link, with_sr0); if (is_n) { if (use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, next, NULL, -1, NULL, NULL); + install_iaq_entries(ctx, -1, next, dspc, -1, NULL, NULL); nullify_set(ctx, 0); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; return true; @@ -1933,6 +1933,7 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, } ctx->iaoq_n = -1; ctx->iaoq_n_var = next; + ctx->iasq_n = dspc; return true; } @@ -1941,13 +1942,13 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, next = tcg_temp_new_i64(); tcg_gen_mov_i64(next, dest); - install_link(ctx, link, false); + install_link(ctx, link, with_sr0); if (is_n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, next, NULL, -1, NULL, NULL); + install_iaq_entries(ctx, -1, next, dspc, -1, NULL, NULL); nullify_set(ctx, 0); } else { install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, - -1, next, NULL); + -1, next, dspc); nullify_set(ctx, is_n); } @@ -3914,33 +3915,18 @@ static bool trans_depi_sar(DisasContext *ctx, arg_depi_sar *a) static bool trans_be(DisasContext *ctx, arg_be *a) { - TCGv_i64 tmp; + TCGv_i64 dest = tcg_temp_new_i64(); + TCGv_i64 space = NULL; - tmp = tcg_temp_new_i64(); - tcg_gen_addi_i64(tmp, load_gpr(ctx, a->b), a->disp); - tmp = do_ibranch_priv(ctx, tmp); + tcg_gen_addi_i64(dest, load_gpr(ctx, a->b), a->disp); + dest = do_ibranch_priv(ctx, dest); -#ifdef CONFIG_USER_ONLY - return do_ibranch(ctx, tmp, a->l, a->n); -#else - TCGv_i64 new_spc = tcg_temp_new_i64(); - - nullify_over(ctx); - - load_spr(ctx, new_spc, a->sp); - install_link(ctx, a->l, true); - if (a->n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, tmp, new_spc, -1, NULL, new_spc); - nullify_set(ctx, 0); - } else { - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, - -1, tmp, new_spc); - nullify_set(ctx, a->n); - } - tcg_gen_lookup_and_goto_ptr(); - ctx->base.is_jmp = DISAS_NORETURN; - return nullify_end(ctx); +#ifndef CONFIG_USER_ONLY + space = tcg_temp_new_i64(); + load_spr(ctx, space, a->sp); #endif + + return do_ibranch(ctx, dest, space, a->l, true, a->n); } static bool trans_bl(DisasContext *ctx, arg_bl *a) @@ -4009,7 +3995,7 @@ static bool trans_blr(DisasContext *ctx, arg_blr *a) tcg_gen_shli_i64(tmp, load_gpr(ctx, a->x), 3); tcg_gen_addi_i64(tmp, tmp, ctx->iaoq_f + 8); /* The computation here never changes privilege level. */ - return do_ibranch(ctx, tmp, a->l, a->n); + return do_ibranch(ctx, tmp, NULL, a->l, false, a->n); } else { /* BLR R0,RX is a good way to load PC+8 into RX. */ return do_dbranch(ctx, 0, a->l, a->n); @@ -4028,30 +4014,20 @@ static bool trans_bv(DisasContext *ctx, arg_bv *a) tcg_gen_add_i64(dest, dest, load_gpr(ctx, a->b)); } dest = do_ibranch_priv(ctx, dest); - return do_ibranch(ctx, dest, 0, a->n); + return do_ibranch(ctx, dest, NULL, 0, false, a->n); } static bool trans_bve(DisasContext *ctx, arg_bve *a) { - TCGv_i64 dest; + TCGv_i64 b = load_gpr(ctx, a->b); + TCGv_i64 dest = do_ibranch_priv(ctx, b); + TCGv_i64 space = NULL; -#ifdef CONFIG_USER_ONLY - dest = do_ibranch_priv(ctx, load_gpr(ctx, a->b)); - return do_ibranch(ctx, dest, a->l, a->n); -#else - nullify_over(ctx); - dest = tcg_temp_new_i64(); - tcg_gen_mov_i64(dest, load_gpr(ctx, a->b)); - dest = do_ibranch_priv(ctx, dest); - - install_link(ctx, a->l, false); - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, - -1, dest, space_select(ctx, 0, dest)); - nullify_set(ctx, a->n); - tcg_gen_lookup_and_goto_ptr(); - ctx->base.is_jmp = DISAS_NORETURN; - return nullify_end(ctx); +#ifndef CONFIG_USER_ONLY + space = space_select(ctx, 0, b); #endif + + return do_ibranch(ctx, dest, space, a->l, false, a->n); } static bool trans_nopbts(DisasContext *ctx, arg_nopbts *a) From patchwork Wed Apr 24 23:59:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791783 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119171wrq; Wed, 24 Apr 2024 17:10:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDsO8+BN0L7x5ass1dWEbX6lW9PCk10m89dCQL4aF2rR4+Vxrq+vQoH4YfDzQxPc77BQIr02gGDE5azsgLnY+E X-Google-Smtp-Source: AGHT+IE1gSk/CbToUj0BQdAcnCrKq694UxhvyMeJsVsyTqUuWQrzzHTtnepoiHvB4GutaaQ8uddz X-Received: by 2002:a05:690c:7403:b0:615:48ee:246a with SMTP id jt3-20020a05690c740300b0061548ee246amr4367261ywb.39.1714003839425; Wed, 24 Apr 2024 17:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003839; cv=none; d=google.com; s=arc-20160816; b=CpzlxdQW4Sy/SeN38hnAh+LZYukQptLbvbNLR+bALJ7hndJVbryNxV4jgjVDkPUrl6 VZqMXyVKaaW7HbGGdrj4yMGGJSmfu1+RfpfIhcOcg1g0Oq/p19HOTSsCJzVSvqvpIuqc Tx5fniUQYmONiET7d3Y8/CcWdA6qVHBxXD7UuQVX8oRBsW7ZccX8RY8DyYSjrEFFc/iD EhTBTyUZzwGvP5SsJOIi5HpFABnrvQuJdMOPxpmz9zKqs52m6e/TEEFxVLajfXJqIh3w dKoN398Kwolp8hpcT2rKjFxc4SYtrgb3v/X10gXopXnY9TfCb1Oo8NxLPGcs2xQYxp+J 7vwQ== 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=+ulGPIrRlnm5P5YmYy3GI1c79AhdRcNeJa8JIKew5Cs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YRHwiIoPiwJxnU06A+Wu8gYxIIq/MkJ9seae/iIUWC8CBewKwYqSmHat5I5vccLqAN B/ZuR4bWEKO/WPN1lt8079HRvnkyQSu85xdyP98glP6ecib1Kd9aIPP25muhXOVlkTuw aXj4Vxqpyt2OfthOadZKw6E0W0KdSmfWy49ot8HPQthUL/+ZXM/XEGFXjR4WDve//pmg 7Wgu/5ta6ONjR2mUmWZcC8vumodB0xAgfLqHH3qRlXGYHDpDqM0WnwHyGNh5OrJFQZ4W AUolhWwHQY+9ZeIOAYv2SdcYLATs7bYZjElomxU7EWzianJaQWKqBoBHjCredg1Xn/2N nqaw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qohjauPO; 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 t23-20020a05622a181700b0043a35295c61si1486567qtc.34.2024.04.24.17.10.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10:39 -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=qohjauPO; 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 1rzmY8-0008Nu-Bl; Wed, 24 Apr 2024 20:01:16 -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 1rzmXe-0008B0-4I for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:50 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXa-0006EI-5r for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:43 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1e86d56b3bcso3745675ad.1 for ; Wed, 24 Apr 2024 17:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003240; x=1714608040; 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=+ulGPIrRlnm5P5YmYy3GI1c79AhdRcNeJa8JIKew5Cs=; b=qohjauPOR4WlkybgTwdCsnrC5R9CjjRhFLsVtf4yQNx1ZI5adH442Z5wHSxtibuGgV x05v+JAgPdvVWvPjrniJOxysUfCrcbwcf526k6RCF/lFgNglu4NT8nSRSjZfNpB4AlHT LCJ4bgoUPzAYn38IMGEK8RjPWBGCJCEEJLcfGCliatK2RKFCKdM9ZnYnsqYvu7mlJWM9 Nf2pL90W5ueGp5vh5rhvVgWHZ4RkijiUY1hv4RG8IT14bqkogCAnB0gfiN2M3HYO7514 78uPqduJfqfdhJG1u9DqQ7sRZYpBvs+FSS3KN/n7NSmPTGwjKEV6MbjOhzh6VzQPuttV wfZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003240; x=1714608040; 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=+ulGPIrRlnm5P5YmYy3GI1c79AhdRcNeJa8JIKew5Cs=; b=osLtbo1MqzIns/PjKP4Z0SqdTZTcnKZR1gmPSc9SmWpl3zPIaKT9m2pocuu5ovmXtt vFAgUMpaDYP6J5D1+qKOmkp/i5vI7kPEV0cpQi2yoZfo/MO2yoVptArIYnVVgT//D7hA HeT+b6Lrnjb7t76RCcYC6SeV5HTcsRD5OfoubfGU/KM427QhJ2R3PKehuIDRgf0fy76+ xOELFd8V5EHbe1PK3PRRziB7Jp1q7t2zPJv9yO6U/Xl/GRFTqccDzBJe1p/uC/c3/ua6 a7lfOazAXz8EUr90fCP6ph7wQBDd4TjqobFCdPgTcCCUBMstB/H/2zhr1Frm4EUHBfhc MQ+A== X-Gm-Message-State: AOJu0Yz5OOdcSHiW4+CuEZjIJc4J4N1OVAdwTvZnn4Xwu0ajWC0pHA0S XmGOeAb5bvisJkaossWSirB9eRYs1DLekITKd+3W0Ng1QhmQoX0b1D0NgvrlGEkP/Eh6EjTHQUf y X-Received: by 2002:a17:903:32c1:b0:1e5:5041:b18a with SMTP id i1-20020a17090332c100b001e55041b18amr5704206plr.40.1714003240213; Wed, 24 Apr 2024 17:00:40 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/45] target/hppa: Use umax in do_ibranch_priv Date: Wed, 24 Apr 2024 16:59:53 -0700 Message-Id: <20240425000023.1002026-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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/hppa/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 2ddaefde21..7e01c21141 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1980,7 +1980,7 @@ static TCGv_i64 do_ibranch_priv(DisasContext *ctx, TCGv_i64 offset) dest = tcg_temp_new_i64(); tcg_gen_andi_i64(dest, offset, -4); tcg_gen_ori_i64(dest, dest, ctx->privilege); - tcg_gen_movcond_i64(TCG_COND_GTU, dest, dest, offset, dest, offset); + tcg_gen_umax_i64(dest, dest, offset); break; } return dest; From patchwork Wed Apr 24 23:59:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791756 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115915wrq; Wed, 24 Apr 2024 17:02:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6y5vFHXQhRCIwtWIQBuGOjE4m8xYCEzuqGBKD7sJVg2qcuxhalH1zgeJgfRmNTp0T83cTFE4jqakCDaJM7GJI X-Google-Smtp-Source: AGHT+IH0y4D9AH4q6cMVA2+UZPBMzLnlUVlg6vddVo6Mf3B1AX4l2TZFfEQQ4/mhiOf7HCGqe7+0 X-Received: by 2002:a05:620a:230:b0:790:9b75:8ce1 with SMTP id u16-20020a05620a023000b007909b758ce1mr261048qkm.4.1714003370294; Wed, 24 Apr 2024 17:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003370; cv=none; d=google.com; s=arc-20160816; b=j56Fld5SuF4K64HwK/sSyaqqNlH3fVUjPzQQfBe2j8UicwC0lY9nRWKfNUqAYrq9PD QU43e8QqM9RGUtrWEoTk1HVcXSbXTi8s0XTHwkeyD7wOebql2ttfYoV60DpP5Ha3kYr+ X48F6T/bpTa1Kic0hxGbbXIIrGuosdoqjJ82puH5Btb+dcods1Z0fdVYrg6s1mKSmSS4 Maj45uDRlBtsoElk8fSsI527tK8I/5MgAuTVkkhlx/7NvNsPrAzQo4UsB/V9FquHoNRH p7wKKti6fJJri7OyKAEWaJNZ2uKSBh4DARMnKbpI+FfcYWVjEjdZw0JLJXnNLEWbM7EK QRkA== 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=ETyNm16Mbl8pyV+lmUKhskc+EtUa8GiG+D+R1+wQrtM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lPOoBr+I12ZgwDxneaj1WX+fIFCxzUhSSZ8X8c2dPD7eOP8xfbNS9NYhdfMaVypaOQ 2yIgUmy6JfL71cKWIeHdxmvJShYeZb5K2Ut+9bVkbiuGew+v99IBSW9lwOjCjQKoygHe xAqTKC206Qt77onfhHrI5xNyOts7cD2lPwQ6ymY1Jbl4eFMKz5qBec+eL/6aAj5B456d FL9wmhJ0Z1k1P4DpyJjrQv3POkWYfGzmeSTOeos6X3ut3Vck0hebj8xgLooMEucQfqoB FEVhmPR5pRjMWCBoc2YaHR9aIntYsdpLLFvzVlWyhpJ5Zcb1leuP8BKC2x1SiMq+jZVh WM1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KIq13KE/"; 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 wi16-20020a05620a571000b0078f1a26962esi13315813qkn.652.2024.04.24.17.02.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:02:50 -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="KIq13KE/"; 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 1rzmY0-0008Ju-42; Wed, 24 Apr 2024 20:01:08 -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 1rzmXf-0008B4-Ft for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:50 -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 1rzmXa-0006Em-Ea for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:44 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e2b137d666so3042815ad.2 for ; Wed, 24 Apr 2024 17:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003241; x=1714608041; 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=ETyNm16Mbl8pyV+lmUKhskc+EtUa8GiG+D+R1+wQrtM=; b=KIq13KE/WMBUKz2d0jqL9tAP+1KxbEB1foMTHiV3GPbVaFGR6SJEyikbakK3MyxPiI vKhAXvjRyZ1Ay6A60K5otjXaLm5Ax+ucboxjOU8fd42npB+NYTgITNSaH2hfvJuhMAXe m2ra52SUF2PXmTUT28LnTzpR4mk4xE902q/EdCXnpvSYrm58CFpN1g310dgB2xB5LfXb jY8irXR3TlZa2F+w3ZenK2uOj0tGWAcNStxxLjzsTx/1ASkHwcLK5IilbMoapIXZLDno TEYDXLggxzsDgaNn+/WTi4MHnz3H/bqFYClINHQLqWLlOIZV3XsgCzuOf+0XjHpsg6Yn lBjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003241; x=1714608041; 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=ETyNm16Mbl8pyV+lmUKhskc+EtUa8GiG+D+R1+wQrtM=; b=vCaejrMEvWAzYXPy9hg+6bbxaNgZndmZ9rdVfYrtRxuqaX3aA8xD2BHuY2DR60cwkT 8kNnbffHIXFjABDxs5OtEMYY9pbkWFmTnKKv0q5yiBAu/iSe3rzCKeiojGQv1Q/xMHPn NqUmEC9AV2OBrexiulMDtCmz8d6jZrdFyt9Ob2lPaH7RhIKCQ4uJqI/3uLxE/XXjVCJJ Y2les1UWKCRVCp3tq44DrmErtZAobgcu0CfgXuto58JsGEQg43f6jHjOjbir+gEh7NVx +U8l6umSsAa74g7K+iRMuNxsinwWfzWkVIwSXkLlTNKiv+3C9qpZ9+3XZc+EQmh+ZHkI 6+sw== X-Gm-Message-State: AOJu0Yy26lThQh0y0s+ltuerm0XcyZZjXpgV3WD7nwYpR/G4OKQUOV+G fWDV5lywTC9ZwqtZMBgRrCrUN6suKQ+miA0f+NS58lu8FcEulExb7u0pZC+2vZCOAb844JwBZI7 2 X-Received: by 2002:a17:902:d2c1:b0:1e7:e7ed:7787 with SMTP id n1-20020a170902d2c100b001e7e7ed7787mr4970299plc.51.1714003241021; Wed, 24 Apr 2024 17:00:41 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/45] target/hppa: Always make a copy in do_ibranch_priv Date: Wed, 24 Apr 2024 16:59:54 -0700 Message-Id: <20240425000023.1002026-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 This simplifies callers, which might otherwise have to make another copy. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 7e01c21141..dd5193cb6a 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1966,18 +1966,17 @@ static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, TCGv_i64 dspc, */ static TCGv_i64 do_ibranch_priv(DisasContext *ctx, TCGv_i64 offset) { - TCGv_i64 dest; + TCGv_i64 dest = tcg_temp_new_i64(); switch (ctx->privilege) { case 0: /* Privilege 0 is maximum and is allowed to decrease. */ - return offset; + tcg_gen_mov_i64(dest, offset); + break; case 3: /* Privilege 3 is minimum and is never allowed to increase. */ - dest = tcg_temp_new_i64(); tcg_gen_ori_i64(dest, offset, 3); break; default: - dest = tcg_temp_new_i64(); tcg_gen_andi_i64(dest, offset, -4); tcg_gen_ori_i64(dest, dest, ctx->privilege); tcg_gen_umax_i64(dest, dest, offset); From patchwork Wed Apr 24 23:59:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791754 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115497wrq; Wed, 24 Apr 2024 17:02:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWpWUo24y0Wl8aem7S+3MPdKMtT2SuH7/6vRHXh4yYLILulP60o663slpm+lR3HoXvI9WN4Hgz0hRNaGazN0sAM X-Google-Smtp-Source: AGHT+IHJEBO1Cy1RMl73/ryTnf+fIVdxO3A/+DEqtUsd5zHgrdj7jvyKz0QUGYzFo8za/EKnaY1w X-Received: by 2002:a05:622a:306:b0:43a:3fdf:eaff with SMTP id q6-20020a05622a030600b0043a3fdfeaffmr844460qtw.51.1714003321354; Wed, 24 Apr 2024 17:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003321; cv=none; d=google.com; s=arc-20160816; b=mNrv1tuTflbn7cK8gADamKPJJb+vgzRc5BRK6I3vd1Kgjc1PIvDs/QyaLfpt/FgNf0 fKlVMmp1vwW3qoVIBCHKf4L8ZydbQrDnb3boXFso3kGXlX6XzW+n54nv8voUJHVZHoym iW/hTk7Tn7mKXQNc1f8LAfmlyks2wnarJ9Qe3ywYg2jMmQPxRxceXPvjk0e/UgPSi5Sz KeEpJGE6BVVeioxfok1WehrU7QWrbIx+UJyG1F/GrVjVw/B6KLpxk85J30CYpZ5xbJx7 WwKvOHOIUaXMg/qcltLlp92qRFBi/2417xVwk5a18XKHqPs1eAug7oTe0Z2nHsF0QaeW teaQ== 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=4yo5eUFmz1IcDDJEMMrGiy92xmplC4MQffE0DBG1K4o=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=c6Qj37HgRUAvGrxD9kYIZO+MvJcjiGrd2eRH0yCMMItQvmCLVmhyyQAWJPmgn+4rc6 Z78Xux2RdmDtngXsaSfQ4EBlDuA6Ns2unx4Q8MVihCwQijoK+2fHr1WksustcwaxMi5Z REv6PHwW5dzchq/jVd9ZlpHwImWxnDImV/a0eoZX0SsZshL526NOorJmXcq65oudLLgw lEA9BRPeEffP4S3/3UK9yRMP4jEywS50SWQHu0lu5KbPR4jtQG1GOMBg3wUWgra/jNbz lFs8EeVc2ttXvz2f6GGNfZ+WktDVliqoUA/JKQZ1eZBZCZyVdTvm2KlzVwcZW355aSGp 8FzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wQLeLrse; 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 er5-20020a05622a5e8500b00431405206f1si14731944qtb.545.2024.04.24.17.02.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:02:01 -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=wQLeLrse; 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 1rzmY9-0008O6-AN; Wed, 24 Apr 2024 20:01:17 -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 1rzmXg-0008B6-Cn for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:49 -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 1rzmXb-0006F2-Lf for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:46 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1e9451d8b71so3826775ad.0 for ; Wed, 24 Apr 2024 17:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003242; x=1714608042; 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=4yo5eUFmz1IcDDJEMMrGiy92xmplC4MQffE0DBG1K4o=; b=wQLeLrsenr6BIj3C/63pL/9gZuP4vo0Iq56CnqAFuxUE8g3Yrrbty/p18zpPTtdBd5 N+4MKIA8AOGuLg4IUEz5XQRBNvl/wUvHGJ8wo4rAEzFgVJPOj+J5zjz564ujVVwjnVYh gLG52ytMaHyhJfchqJYoaqBjeGNHhykowY1LS96OUQ7+3xq/numwnXt+fGKtb2NhjYp7 6qFNVocoem13DtsjvLDcVlbLCJ88dNlYDuQkkR1W36jwpGw8EegnwE5v9pJihIdfFa6V T4mO1IUfuAS6hAIIkVe6k402izL6VmpgqqagzZMdyEaETBmIdCrthHd5iArXWCnN9CTI +0EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003242; x=1714608042; 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=4yo5eUFmz1IcDDJEMMrGiy92xmplC4MQffE0DBG1K4o=; b=rviQHSkFlnDC5t5MNK77d0Ipo03+5Kt9uXSYlzNAbhFDO9+xyJH5oA0QTmmfrfI7xM TawVAuZDlxPEULcnrg17hZbxmIJph6SYU7sF8vq6Q1109ngPqq+D8fq58Z7fmuuhmWeS 9A+KJhEVPo992bBMMCW/JveQgZqnVECOtjPYTPIOYxy6Cvmaivz/nDJuC+fiDNmlUa5F yXwSQ1WGUrZNedv+52Bo7s3j29AXqw6D+spHR0uO7Pbh79GHFF0BxfzSqhWu7Vb6BcAc zU15qB71+U67UcxmzuCtWU0gCikA8A0KZ2wzm+PbPVeq8mJWsIHJi7HlBqtj5K/R8CZS ijaQ== X-Gm-Message-State: AOJu0YzuXYviGir7ffxVn3880jX3Gm9Iz4q6a2POG8UmoEf903qE8auA B6pzFpprAPqnxnjXkJF11Ta+vdbBz9i92zm0bk8eIkg7EnlYyDyXyNJTTqzDojIYzGJVXenL5hj 7 X-Received: by 2002:a17:902:6b44:b0:1e8:b669:e65c with SMTP id g4-20020a1709026b4400b001e8b669e65cmr3907404plt.32.1714003241926; Wed, 24 Apr 2024 17:00:41 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/45] target/hppa: Introduce and use DisasIAQE for branch management Date: Wed, 24 Apr 2024 16:59:55 -0700 Message-Id: <20240425000023.1002026-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Wrap offset and space together in one structure, ensuring that they're copied together as required. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 378 +++++++++++++++++++++------------------- 1 file changed, 198 insertions(+), 180 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index dd5193cb6a..9d3bffb688 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -41,21 +41,23 @@ typedef struct DisasCond { TCGv_i64 a0, a1; } DisasCond; +typedef struct DisasIAQE { + /* IASQ; may be null for no change from TB. */ + TCGv_i64 space; + /* IAOQ base; may be null for immediate absolute address. */ + TCGv_i64 base; + /* IAOQ addend; absolute immedate address if base is null. */ + int64_t disp; +} DisasIAQE; + typedef struct DisasContext { DisasContextBase base; CPUState *cs; - uint64_t iaoq_f; - uint64_t iaoq_b; - uint64_t iaoq_n; - TCGv_i64 iaoq_n_var; - /* - * Null when IASQ_Back unchanged from IASQ_Front, - * or cpu_iasq_b, when IASQ_Back has been changed. - */ - TCGv_i64 iasq_b; - /* Null when IASQ_Next unchanged from IASQ_Back, or set by branch. */ - TCGv_i64 iasq_n; + /* IAQ_Front, IAQ_Back. */ + DisasIAQE iaq_f, iaq_b; + /* IAQ_Next, for jumps, otherwise null for simple advance. */ + DisasIAQE iaq_j, *iaq_n; DisasCond null_cond; TCGLabel *null_lab; @@ -601,49 +603,67 @@ static bool nullify_end(DisasContext *ctx) return true; } +static bool iaqe_variable(const DisasIAQE *e) +{ + return e->base || e->space; +} + +static DisasIAQE iaqe_incr(const DisasIAQE *e, int64_t disp) +{ + return (DisasIAQE){ + .space = e->space, + .base = e->base, + .disp = e->disp + disp, + }; +} + +static DisasIAQE iaqe_branchi(DisasContext *ctx, int64_t disp) +{ + return (DisasIAQE){ + .space = ctx->iaq_b.space, + .disp = ctx->iaq_f.disp + 8 + disp, + }; +} + +static DisasIAQE iaqe_next_absv(DisasContext *ctx, TCGv_i64 var) +{ + return (DisasIAQE){ + .space = ctx->iaq_b.space, + .base = var, + }; +} + static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest, - uint64_t ival, TCGv_i64 vval) + const DisasIAQE *src) { uint64_t mask = gva_offset_mask(ctx->tb_flags); - if (ival != -1) { - tcg_gen_movi_i64(dest, ival & mask); - return; - } - tcg_debug_assert(vval != NULL); - - /* - * We know that the IAOQ is already properly masked. - * This optimization is primarily for "iaoq_f = iaoq_b". - */ - if (vval == cpu_iaoq_f || vval == cpu_iaoq_b) { - tcg_gen_mov_i64(dest, vval); + if (src->base == NULL) { + tcg_gen_movi_i64(dest, src->disp & mask); + } else if (src->disp == 0) { + tcg_gen_andi_i64(dest, src->base, mask); } else { - tcg_gen_andi_i64(dest, vval, mask); + tcg_gen_addi_i64(dest, src->base, src->disp); + tcg_gen_andi_i64(dest, dest, mask); } } -static void install_iaq_entries(DisasContext *ctx, - uint64_t bi, TCGv_i64 bv, TCGv_i64 bs, - uint64_t ni, TCGv_i64 nv, TCGv_i64 ns) +static void install_iaq_entries(DisasContext *ctx, const DisasIAQE *f, + const DisasIAQE *b) { - copy_iaoq_entry(ctx, cpu_iaoq_f, bi, bv); + DisasIAQE b_next; - /* Allow ni variable, with nv null, to indicate a trivial advance. */ - if (ni != -1 || nv) { - copy_iaoq_entry(ctx, cpu_iaoq_b, ni, nv); - } else if (bi != -1) { - copy_iaoq_entry(ctx, cpu_iaoq_b, bi + 4, NULL); - } else { - tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_f, 4); - tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, - gva_offset_mask(ctx->tb_flags)); + if (b == NULL) { + b_next = iaqe_incr(f, 4); + b = &b_next; } - if (bs) { - tcg_gen_mov_i64(cpu_iasq_f, bs); + copy_iaoq_entry(ctx, cpu_iaoq_f, f); + copy_iaoq_entry(ctx, cpu_iaoq_b, b); + if (f->space) { + tcg_gen_mov_i64(cpu_iasq_f, f->space); } - if (ns || bs) { - tcg_gen_mov_i64(cpu_iasq_b, ns ? ns : bs); + if (b->space || f->space) { + tcg_gen_mov_i64(cpu_iasq_b, b->space ? : f->space); } } @@ -651,10 +671,11 @@ static void install_link(DisasContext *ctx, unsigned link, bool with_sr0) { tcg_debug_assert(ctx->null_cond.c == TCG_COND_NEVER); if (link) { - if (ctx->iaoq_b == -1) { - tcg_gen_addi_i64(cpu_gr[link], cpu_iaoq_b, 4); + if (ctx->iaq_b.base) { + tcg_gen_addi_i64(cpu_gr[link], ctx->iaq_b.base, + ctx->iaq_b.disp + 4); } else { - tcg_gen_movi_i64(cpu_gr[link], ctx->iaoq_b + 4); + tcg_gen_movi_i64(cpu_gr[link], ctx->iaq_b.disp + 4); } #ifndef CONFIG_USER_ONLY if (with_sr0) { @@ -664,11 +685,6 @@ static void install_link(DisasContext *ctx, unsigned link, bool with_sr0) } } -static inline uint64_t iaoq_dest(DisasContext *ctx, int64_t disp) -{ - return ctx->iaoq_f + disp + 8; -} - static void gen_excp_1(int exception) { gen_helper_excp(tcg_env, tcg_constant_i32(exception)); @@ -676,8 +692,7 @@ static void gen_excp_1(int exception) static void gen_excp(DisasContext *ctx, int exception) { - install_iaq_entries(ctx, ctx->iaoq_f, cpu_iaoq_f, NULL, - ctx->iaoq_b, cpu_iaoq_b, NULL); + install_iaq_entries(ctx, &ctx->iaq_f, &ctx->iaq_b); nullify_save(ctx); gen_excp_1(exception); ctx->base.is_jmp = DISAS_NORETURN; @@ -709,10 +724,12 @@ static bool gen_illegal(DisasContext *ctx) } while (0) #endif -static bool use_goto_tb(DisasContext *ctx, uint64_t bofs, uint64_t nofs) +static bool use_goto_tb(DisasContext *ctx, const DisasIAQE *f, + const DisasIAQE *b) { - return (bofs != -1 && nofs != -1 && - translator_use_goto_tb(&ctx->base, bofs)); + return (!iaqe_variable(f) && + (b == NULL || !iaqe_variable(b)) && + translator_use_goto_tb(&ctx->base, f->disp)); } /* If the next insn is to be nullified, and it's on the same page, @@ -722,20 +739,19 @@ static bool use_goto_tb(DisasContext *ctx, uint64_t bofs, uint64_t nofs) static bool use_nullify_skip(DisasContext *ctx) { return (!(tb_cflags(ctx->base.tb) & CF_BP_PAGE) - && ctx->iaoq_b != -1 - && is_same_page(&ctx->base, ctx->iaoq_b)); + && !iaqe_variable(&ctx->iaq_b) + && is_same_page(&ctx->base, ctx->iaq_b.disp)); } static void gen_goto_tb(DisasContext *ctx, int which, - uint64_t b, uint64_t n) + const DisasIAQE *f, const DisasIAQE *b) { - if (use_goto_tb(ctx, b, n)) { + if (use_goto_tb(ctx, f, b)) { tcg_gen_goto_tb(which); - install_iaq_entries(ctx, b, NULL, NULL, n, NULL, NULL); + install_iaq_entries(ctx, f, b); tcg_gen_exit_tb(ctx->base.tb, which); } else { - install_iaq_entries(ctx, b, cpu_iaoq_b, ctx->iasq_b, - n, ctx->iaoq_n_var, ctx->iasq_n); + install_iaq_entries(ctx, f, b); tcg_gen_lookup_and_goto_ptr(); } } @@ -1816,37 +1832,35 @@ static bool do_fop_dedd(DisasContext *ctx, unsigned rt, static bool do_dbranch(DisasContext *ctx, int64_t disp, unsigned link, bool is_n) { - uint64_t dest = iaoq_dest(ctx, disp); + ctx->iaq_j = iaqe_branchi(ctx, disp); if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { install_link(ctx, link, false); if (is_n) { if (use_nullify_skip(ctx)) { nullify_set(ctx, 0); - gen_goto_tb(ctx, 0, dest, dest + 4); + gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); ctx->base.is_jmp = DISAS_NORETURN; return true; } ctx->null_cond.c = TCG_COND_ALWAYS; } - ctx->iaoq_n = dest; - ctx->iaoq_n_var = NULL; + ctx->iaq_n = &ctx->iaq_j; } else { nullify_over(ctx); install_link(ctx, link, false); if (is_n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); - gen_goto_tb(ctx, 0, dest, dest + 4); + gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); } else { nullify_set(ctx, is_n); - gen_goto_tb(ctx, 0, ctx->iaoq_b, dest); + gen_goto_tb(ctx, 0, &ctx->iaq_b, &ctx->iaq_j); } - nullify_end(ctx); nullify_set(ctx, 0); - gen_goto_tb(ctx, 1, ctx->iaoq_b, ctx->iaoq_n); + gen_goto_tb(ctx, 1, &ctx->iaq_b, NULL); ctx->base.is_jmp = DISAS_NORETURN; } return true; @@ -1857,7 +1871,7 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, DisasCond *cond) { - uint64_t dest = iaoq_dest(ctx, disp); + DisasIAQE next; TCGLabel *taken = NULL; TCGCond c = cond->c; bool n; @@ -1877,26 +1891,29 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, n = is_n && disp < 0; if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); - gen_goto_tb(ctx, 0, ctx->iaoq_n, ctx->iaoq_n + 4); + next = iaqe_incr(&ctx->iaq_b, 4); + gen_goto_tb(ctx, 0, &next, NULL); } else { if (!n && ctx->null_lab) { gen_set_label(ctx->null_lab); ctx->null_lab = NULL; } nullify_set(ctx, n); - gen_goto_tb(ctx, 0, ctx->iaoq_b, ctx->iaoq_n); + gen_goto_tb(ctx, 0, &ctx->iaq_b, NULL); } gen_set_label(taken); /* Taken: Condition satisfied; nullify on forward branches. */ n = is_n && disp >= 0; + + next = iaqe_branchi(ctx, disp); if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); - gen_goto_tb(ctx, 1, dest, dest + 4); + gen_goto_tb(ctx, 1, &next, NULL); } else { nullify_set(ctx, n); - gen_goto_tb(ctx, 1, ctx->iaoq_b, dest); + gen_goto_tb(ctx, 1, &ctx->iaq_b, &next); } /* Not taken: the branch itself was nullified. */ @@ -1910,45 +1927,36 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, return true; } -/* Emit an unconditional branch to an indirect target. This handles - nullification of the branch itself. */ -static bool do_ibranch(DisasContext *ctx, TCGv_i64 dest, TCGv_i64 dspc, - unsigned link, bool with_sr0, bool is_n) +/* + * Emit an unconditional branch to an indirect target, in ctx->iaq_j. + * This handles nullification of the branch itself. + */ +static bool do_ibranch(DisasContext *ctx, unsigned link, + bool with_sr0, bool is_n) { - TCGv_i64 next; - if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { - next = tcg_temp_new_i64(); - tcg_gen_mov_i64(next, dest); - install_link(ctx, link, with_sr0); if (is_n) { if (use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, next, dspc, -1, NULL, NULL); + install_iaq_entries(ctx, &ctx->iaq_j, NULL); nullify_set(ctx, 0); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; return true; } ctx->null_cond.c = TCG_COND_ALWAYS; } - ctx->iaoq_n = -1; - ctx->iaoq_n_var = next; - ctx->iasq_n = dspc; + ctx->iaq_n = &ctx->iaq_j; return true; } nullify_over(ctx); - next = tcg_temp_new_i64(); - tcg_gen_mov_i64(next, dest); - install_link(ctx, link, with_sr0); if (is_n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, -1, next, dspc, -1, NULL, NULL); + install_iaq_entries(ctx, &ctx->iaq_j, NULL); nullify_set(ctx, 0); } else { - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, - -1, next, dspc); + install_iaq_entries(ctx, &ctx->iaq_b, &ctx->iaq_j); nullify_set(ctx, is_n); } @@ -1995,8 +2003,6 @@ static TCGv_i64 do_ibranch_priv(DisasContext *ctx, TCGv_i64 offset) aforementioned BE. */ static void do_page_zero(DisasContext *ctx) { - TCGv_i64 tmp; - /* If by some means we get here with PSW[N]=1, that implies that the B,GATE instruction would be skipped, and we'd fault on the next insn within the privileged page. */ @@ -2016,11 +2022,11 @@ static void do_page_zero(DisasContext *ctx) non-sequential instruction execution. Normally the PSW[B] bit detects this by disallowing the B,GATE instruction to execute under such conditions. */ - if (ctx->iaoq_b != ctx->iaoq_f + 4) { + if (iaqe_variable(&ctx->iaq_b) || ctx->iaq_b.disp != ctx->iaq_f.disp + 4) { goto do_sigill; } - switch (ctx->iaoq_f & -4) { + switch (ctx->iaq_f.disp & -4) { case 0x00: /* Null pointer call */ gen_excp_1(EXCP_IMP); ctx->base.is_jmp = DISAS_NORETURN; @@ -2032,11 +2038,15 @@ static void do_page_zero(DisasContext *ctx) break; case 0xe0: /* SET_THREAD_POINTER */ - tcg_gen_st_i64(cpu_gr[26], tcg_env, offsetof(CPUHPPAState, cr[27])); - tmp = tcg_temp_new_i64(); - tcg_gen_ori_i64(tmp, cpu_gr[31], 3); - install_iaq_entries(ctx, -1, tmp, NULL, -1, NULL, NULL); - ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; + { + DisasIAQE next = { .base = tcg_temp_new_i64() }; + + tcg_gen_st_i64(cpu_gr[26], tcg_env, + offsetof(CPUHPPAState, cr[27])); + tcg_gen_ori_i64(next.base, cpu_gr[31], 3); + install_iaq_entries(ctx, &next, NULL); + ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; + } break; case 0x100: /* SYSCALL */ @@ -2075,11 +2085,12 @@ static bool trans_sync(DisasContext *ctx, arg_sync *a) static bool trans_mfia(DisasContext *ctx, arg_mfia *a) { - unsigned rt = a->t; - TCGv_i64 tmp = dest_gpr(ctx, rt); - tcg_gen_movi_i64(tmp, ctx->iaoq_f & ~3ULL); - save_gpr(ctx, rt, tmp); + TCGv_i64 dest = dest_gpr(ctx, a->t); + copy_iaoq_entry(ctx, dest, &ctx->iaq_f); + tcg_gen_andi_i64(dest, dest, -4); + + save_gpr(ctx, a->t, dest); cond_free(&ctx->null_cond); return true; } @@ -2779,8 +2790,7 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf_d *a) nullify_over(ctx); /* Advance the instruction queue. */ - install_iaq_entries(ctx, ctx->iaoq_b, cpu_iaoq_b, ctx->iasq_b, - ctx->iaoq_n, ctx->iaoq_n_var, ctx->iasq_n); + install_iaq_entries(ctx, &ctx->iaq_b, NULL); nullify_set(ctx, 0); /* Tell the qemu main loop to halt until this cpu has work. */ @@ -3914,18 +3924,18 @@ static bool trans_depi_sar(DisasContext *ctx, arg_depi_sar *a) static bool trans_be(DisasContext *ctx, arg_be *a) { - TCGv_i64 dest = tcg_temp_new_i64(); - TCGv_i64 space = NULL; - - tcg_gen_addi_i64(dest, load_gpr(ctx, a->b), a->disp); - dest = do_ibranch_priv(ctx, dest); - #ifndef CONFIG_USER_ONLY - space = tcg_temp_new_i64(); - load_spr(ctx, space, a->sp); + ctx->iaq_j.space = tcg_temp_new_i64(); + load_spr(ctx, ctx->iaq_j.space, a->sp); #endif - return do_ibranch(ctx, dest, space, a->l, true, a->n); + ctx->iaq_j.base = tcg_temp_new_i64(); + ctx->iaq_j.disp = 0; + + tcg_gen_addi_i64(ctx->iaq_j.base, load_gpr(ctx, a->b), a->disp); + ctx->iaq_j.base = do_ibranch_priv(ctx, ctx->iaq_j.base); + + return do_ibranch(ctx, a->l, true, a->n); } static bool trans_bl(DisasContext *ctx, arg_bl *a) @@ -3935,7 +3945,7 @@ static bool trans_bl(DisasContext *ctx, arg_bl *a) static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) { - uint64_t dest = iaoq_dest(ctx, a->disp); + int64_t disp = a->disp; nullify_over(ctx); @@ -3950,7 +3960,7 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) * b evil * in which instructions at evil would run with increased privs. */ - if (ctx->iaoq_b == -1 || ctx->iaoq_b != ctx->iaoq_f + 4) { + if (iaqe_variable(&ctx->iaq_b) || ctx->iaq_b.disp != ctx->iaq_f.disp + 4) { return gen_illegal(ctx); } @@ -3968,10 +3978,11 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) } /* No change for non-gateway pages or for priv decrease. */ if (type >= 4 && type - 4 < ctx->privilege) { - dest = deposit64(dest, 0, 2, type - 4); + disp -= ctx->privilege; + disp += type - 4; } } else { - dest &= -4; /* priv = 0 */ + disp -= ctx->privilege; /* priv = 0 */ } #endif @@ -3984,17 +3995,23 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) save_gpr(ctx, a->l, tmp); } - return do_dbranch(ctx, dest - iaoq_dest(ctx, 0), 0, a->n); + return do_dbranch(ctx, disp, 0, a->n); } static bool trans_blr(DisasContext *ctx, arg_blr *a) { if (a->x) { - TCGv_i64 tmp = tcg_temp_new_i64(); - tcg_gen_shli_i64(tmp, load_gpr(ctx, a->x), 3); - tcg_gen_addi_i64(tmp, tmp, ctx->iaoq_f + 8); + DisasIAQE next = iaqe_incr(&ctx->iaq_f, 8); + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + /* The computation here never changes privilege level. */ - return do_ibranch(ctx, tmp, NULL, a->l, false, a->n); + copy_iaoq_entry(ctx, t0, &next); + tcg_gen_shli_i64(t1, load_gpr(ctx, a->x), 3); + tcg_gen_add_i64(t0, t0, t1); + + ctx->iaq_j = iaqe_next_absv(ctx, t0); + return do_ibranch(ctx, a->l, false, a->n); } else { /* BLR R0,RX is a good way to load PC+8 into RX. */ return do_dbranch(ctx, 0, a->l, a->n); @@ -4013,20 +4030,22 @@ static bool trans_bv(DisasContext *ctx, arg_bv *a) tcg_gen_add_i64(dest, dest, load_gpr(ctx, a->b)); } dest = do_ibranch_priv(ctx, dest); - return do_ibranch(ctx, dest, NULL, 0, false, a->n); + ctx->iaq_j = iaqe_next_absv(ctx, dest); + + return do_ibranch(ctx, 0, false, a->n); } static bool trans_bve(DisasContext *ctx, arg_bve *a) { TCGv_i64 b = load_gpr(ctx, a->b); - TCGv_i64 dest = do_ibranch_priv(ctx, b); - TCGv_i64 space = NULL; #ifndef CONFIG_USER_ONLY - space = space_select(ctx, 0, b); + ctx->iaq_j.space = space_select(ctx, 0, b); #endif + ctx->iaq_j.base = do_ibranch_priv(ctx, b); + ctx->iaq_j.disp = 0; - return do_ibranch(ctx, dest, space, a->l, false, a->n); + return do_ibranch(ctx, a->l, false, a->n); } static bool trans_nopbts(DisasContext *ctx, arg_nopbts *a) @@ -4598,9 +4617,8 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) #ifdef CONFIG_USER_ONLY ctx->privilege = MMU_IDX_TO_PRIV(MMU_USER_IDX); ctx->mmu_idx = MMU_USER_IDX; - ctx->iaoq_f = ctx->base.pc_first | ctx->privilege; - ctx->iaoq_b = ctx->base.tb->cs_base | ctx->privilege; - ctx->iasq_b = NULL; + ctx->iaq_f.disp = ctx->base.pc_first | ctx->privilege; + ctx->iaq_b.disp = ctx->base.tb->cs_base | ctx->privilege; ctx->unalign = (ctx->tb_flags & TB_FLAG_UNALIGN ? MO_UNALN : MO_ALIGN); #else ctx->privilege = (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; @@ -4613,9 +4631,13 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) uint64_t iasq_f = cs_base & ~0xffffffffull; int32_t diff = cs_base; - ctx->iaoq_f = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; - ctx->iaoq_b = (diff ? ctx->iaoq_f + diff : -1); - ctx->iasq_b = (diff ? NULL : cpu_iasq_b); + ctx->iaq_f.disp = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; + if (diff) { + ctx->iaq_b.disp = ctx->iaq_f.disp + diff; + } else { + ctx->iaq_b.base = cpu_iaoq_b; + ctx->iaq_b.space = cpu_iasq_b; + } #endif ctx->zero = tcg_constant_i64(0); @@ -4643,7 +4665,10 @@ static void hppa_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); - tcg_gen_insn_start(ctx->iaoq_f, ctx->iaoq_b, 0); + tcg_debug_assert(!iaqe_variable(&ctx->iaq_f)); + tcg_gen_insn_start(ctx->iaq_f.disp, + iaqe_variable(&ctx->iaq_b) ? -1 : ctx->iaq_b.disp, + 0); ctx->insn_start_updated = false; } @@ -4666,11 +4691,12 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) the page permissions for execute. */ uint32_t insn = translator_ldl(env, &ctx->base, ctx->base.pc_next); - /* Set up the IA queue for the next insn. - This will be overwritten by a branch. */ - ctx->iasq_n = NULL; - ctx->iaoq_n_var = NULL; - ctx->iaoq_n = ctx->iaoq_b == -1 ? -1 : ctx->iaoq_b + 4; + /* + * Set up the IA queue for the next insn. + * This will be overwritten by a branch. + */ + ctx->iaq_n = NULL; + memset(&ctx->iaq_j, 0, sizeof(ctx->iaq_j)); if (unlikely(ctx->null_cond.c == TCG_COND_ALWAYS)) { ctx->null_cond.c = TCG_COND_NEVER; @@ -4691,7 +4717,8 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) return; } /* Note this also detects a priority change. */ - if (ctx->iaoq_b != ctx->iaoq_f + 4 || ctx->iasq_b) { + if (iaqe_variable(&ctx->iaq_b) + || ctx->iaq_b.disp != ctx->iaq_f.disp + 4) { ctx->base.is_jmp = DISAS_IAQ_N_STALE; return; } @@ -4700,20 +4727,25 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) * Advance the insn queue. * The only exit now is DISAS_TOO_MANY from the translator loop. */ - ctx->iaoq_f = ctx->iaoq_b; - ctx->iaoq_b = ctx->iaoq_n; - if (ctx->iaoq_b == -1) { - if (ctx->iaoq_n_var) { - copy_iaoq_entry(ctx, cpu_iaoq_b, -1, ctx->iaoq_n_var); - } else { - tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_b, 4); - tcg_gen_andi_i64(cpu_iaoq_b, cpu_iaoq_b, - gva_offset_mask(ctx->tb_flags)); - } + ctx->iaq_f.disp = ctx->iaq_b.disp; + if (!ctx->iaq_n) { + ctx->iaq_b.disp += 4; + return; } - if (ctx->iasq_n) { - tcg_gen_mov_i64(cpu_iasq_b, ctx->iasq_n); - ctx->iasq_b = cpu_iasq_b; + /* + * If IAQ_Next is variable in any way, we need to copy into the + * IAQ_Back globals, in case the next insn raises an exception. + */ + if (ctx->iaq_n->base) { + copy_iaoq_entry(ctx, cpu_iaoq_b, ctx->iaq_n); + ctx->iaq_b.base = cpu_iaoq_b; + ctx->iaq_b.disp = 0; + } else { + ctx->iaq_b.disp = ctx->iaq_n->disp; + } + if (ctx->iaq_n->space) { + tcg_gen_mov_i64(cpu_iasq_b, ctx->iaq_n->space); + ctx->iaq_b.space = cpu_iasq_b; } } @@ -4721,43 +4753,29 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); DisasJumpType is_jmp = ctx->base.is_jmp; - uint64_t fi, bi; - TCGv_i64 fv, bv; - TCGv_i64 fs, bs; - /* Assume the insn queue has not been advanced. */ - fi = ctx->iaoq_b; - fv = cpu_iaoq_b; - fs = ctx->iasq_b; - bi = ctx->iaoq_n; - bv = ctx->iaoq_n_var; - bs = ctx->iasq_n; + DisasIAQE *f = &ctx->iaq_b; + DisasIAQE *b = ctx->iaq_n; switch (is_jmp) { case DISAS_NORETURN: break; case DISAS_TOO_MANY: /* The insn queue has not been advanced. */ - bi = fi; - bv = fv; - bs = fs; - fi = ctx->iaoq_f; - fv = NULL; - fs = NULL; + f = &ctx->iaq_f; + b = &ctx->iaq_b; /* FALLTHRU */ case DISAS_IAQ_N_STALE: - if (fs == NULL - && bs == NULL - && use_goto_tb(ctx, fi, bi) + if (use_goto_tb(ctx, f, b) && (ctx->null_cond.c == TCG_COND_NEVER || ctx->null_cond.c == TCG_COND_ALWAYS)) { nullify_set(ctx, ctx->null_cond.c == TCG_COND_ALWAYS); - gen_goto_tb(ctx, 0, fi, bi); + gen_goto_tb(ctx, 0, f, b); break; } /* FALLTHRU */ case DISAS_IAQ_N_STALE_EXIT: - install_iaq_entries(ctx, fi, fv, fs, bi, bv, bs); + install_iaq_entries(ctx, f, b); nullify_save(ctx); if (is_jmp == DISAS_IAQ_N_STALE_EXIT) { tcg_gen_exit_tb(NULL, 0); @@ -4813,6 +4831,6 @@ static const TranslatorOps hppa_tr_ops = { void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns, vaddr pc, void *host_pc) { - DisasContext ctx; + DisasContext ctx = { }; translator_loop(cs, tb, max_insns, pc, host_pc, &hppa_tr_ops, &ctx.base); } From patchwork Wed Apr 24 23:59:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791755 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115833wrq; Wed, 24 Apr 2024 17:02:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+CR+CSJcvTEnZNRDlX5HFlucNN4aDds+s/mm2jM5dgy2pCdNz/ZJpjWy+Lwqwn9dJn2nVXGVsuVPHI8JAKdFU X-Google-Smtp-Source: AGHT+IHo0cDphGubwVq5Aj0niLLDP50K8lNJXBooDVtzUJ/EHej09l6RJ4hdBfFg0W/ay8crophB X-Received: by 2002:a05:622a:19a3:b0:437:c00f:6a85 with SMTP id u35-20020a05622a19a300b00437c00f6a85mr4975447qtc.29.1714003360862; Wed, 24 Apr 2024 17:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003360; cv=none; d=google.com; s=arc-20160816; b=rQKJ28KA4uXr5t1kPhjKqRfj/poSCeFFOc3jDR1J+OQgWdzJrjZITEgqSMvTUWtitF 21JaFKn0FMzdJsK1npZ10IMeQhbhYMXaGm2T36QXuuvr7q4ic3YgViqgUo8nE0JteTrs m9TWkseyJshnlmsKipgrTMk6nwxh6sXPUvQ7ychq3f2zmZX28irw05WX/CGmiP3Zhitk PbjbdB6OCe2zqieYq2W/yXYaTooQzPQzHO6FK2OIaL5WewxywBA1wAkWoyhAkLmJ2LF+ bPROQk/FceuXLwKNj8pGRcc2bOqvD534AHdADLZn1EfdrnYTFTuPJpaAzQ+SyVo3EjQl seEA== 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=kIfEXtXX+JbLeMH/Uyj+dUGcwoopaLfipcBYLL0xhus=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=IJ9BP3JxHvoGDN7Ty+18TcWIJY+O/LWtPjLO84X4a3wUFqZ8VXuDAYFxAIM/+aEgL2 dC1VPynVq2AgVRrd0KE05ZM/Uv+FMgDbD1DsgehkqQf9lf7+riSR532SkCnUWHH1fCF3 HtL6RgZf1OMcPQCh62jtaJYk6b4MGD6iQLeWnHUOML9rpfijqn5bvft4UZLxSLisbjoi aF0hE6sZOmlv+37PAD8eKNyYXeIJJjkrOVyC5Qi7xS2biavy2Bla1sqTKrcbzun8XdOg eWd6XgVpTu4nUJf48niDemkzu+HbTvf0OE5o7ULxwpaJ2BPAl4hMKc8ZZaii0DWc32lW ycgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jFquBBKX; 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-20020ac85d8a000000b0043670f48cfesi16349885qtx.398.2024.04.24.17.02.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:02:40 -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=jFquBBKX; 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 1rzmY1-0008Jy-1W; Wed, 24 Apr 2024 20:01:09 -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 1rzmXi-0008Cc-DZ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:52 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXc-0006FB-FX for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:48 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1e8bbcbc2b7so3966315ad.0 for ; Wed, 24 Apr 2024 17:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003243; x=1714608043; 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=kIfEXtXX+JbLeMH/Uyj+dUGcwoopaLfipcBYLL0xhus=; b=jFquBBKXXH5WS6J5GQa4bC0BcweCPql1Jz48i/ErqZ1ELbkB0RIffCSz/qabWkj9ar THa5BML0kCr0red51BUTWlV8j7/3wEOfWk5BSifSQUQ7zqdPp6GBEKyEjQ3jk0nwR9qP DQT9o0tvBkKNPLXGJiuhX52F0KxnLOlMyEGnNX8B9iQn/rh/C+SMzks87LO4NIxVrhQa Ole0iAFLA+Y+MKWoaCZy0/7J5PqlPsQ4Svek8PsUxQW5tNWRqooUnan8oDKkv88bezE/ 4ukSi1ekd4CZ8323yoQpMoU261+AiZQ5kNv1QraNBInsdSTa8KcYcwAoiwZRmw4MKxsO TPZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003243; x=1714608043; 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=kIfEXtXX+JbLeMH/Uyj+dUGcwoopaLfipcBYLL0xhus=; b=BmppAsbq+YDl0F8xT9bAmUuYg7eCmyqpYBj4dvzJlMszc1ihqe+nWKM1/J1nRyWy+P LmwR3KeTgGDAPVCyHY3n61ccxUegD4vRfAW6Im/e7MKkP7abbL3TJQx4V6Tx27/Q6fdC l0ueK79jtFtp1IoveFQ2uS0rBA5tcZWyvSWj7RCtZtUc/uOja+Vh9aa83pf9f9zYP+bX NYW6kwVTkHyAVVhnx0JnRisuIIOSJvrCtBTKJUxTFkq84QVqsHgHsspgx4b5ajOdJWSu +/4hT4FNWLWjmohzuhUdtQsL9tYXL5ryRZ23GrfoCgZbI5CTV1KdKhOeLu0XIZE5lDZg eLZw== X-Gm-Message-State: AOJu0YzZ0iyuhrVUIHgMB9PY6pmWFhxfhPAMqAVGhEzjOmZxfyN4Tf02 3/y/z8GmLfWNOUH8fMFC0qEt+OG7HhxjXgAsxwzVtT+Wq8GZ6idpDv9p0EA7K+4QqKMawaT+3SG S X-Received: by 2002:a17:903:11d1:b0:1e2:3cbe:adcc with SMTP id q17-20020a17090311d100b001e23cbeadccmr5633914plh.49.1714003242801; Wed, 24 Apr 2024 17:00:42 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 18/45] target/hppa: Use displacements in DisasIAQE Date: Wed, 24 Apr 2024 16:59:56 -0700 Message-Id: <20240425000023.1002026-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 This is a first step in enabling CF_PCREL, but for now we regenerate the absolute address before writeback. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 43 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 9d3bffb688..dd3921dbf9 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -44,9 +44,9 @@ typedef struct DisasCond { typedef struct DisasIAQE { /* IASQ; may be null for no change from TB. */ TCGv_i64 space; - /* IAOQ base; may be null for immediate absolute address. */ + /* IAOQ base; may be null for relative address. */ TCGv_i64 base; - /* IAOQ addend; absolute immedate address if base is null. */ + /* IAOQ addend; if base is null, relative to ctx->iaoq_first. */ int64_t disp; } DisasIAQE; @@ -59,6 +59,9 @@ typedef struct DisasContext { /* IAQ_Next, for jumps, otherwise null for simple advance. */ DisasIAQE iaq_j, *iaq_n; + /* IAOQ_Front at entry to TB. */ + uint64_t iaoq_first; + DisasCond null_cond; TCGLabel *null_lab; @@ -639,7 +642,7 @@ static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest, uint64_t mask = gva_offset_mask(ctx->tb_flags); if (src->base == NULL) { - tcg_gen_movi_i64(dest, src->disp & mask); + tcg_gen_movi_i64(dest, (ctx->iaoq_first + src->disp) & mask); } else if (src->disp == 0) { tcg_gen_andi_i64(dest, src->base, mask); } else { @@ -671,12 +674,8 @@ static void install_link(DisasContext *ctx, unsigned link, bool with_sr0) { tcg_debug_assert(ctx->null_cond.c == TCG_COND_NEVER); if (link) { - if (ctx->iaq_b.base) { - tcg_gen_addi_i64(cpu_gr[link], ctx->iaq_b.base, - ctx->iaq_b.disp + 4); - } else { - tcg_gen_movi_i64(cpu_gr[link], ctx->iaq_b.disp + 4); - } + DisasIAQE next = iaqe_incr(&ctx->iaq_b, 4); + copy_iaoq_entry(ctx, cpu_gr[link], &next); #ifndef CONFIG_USER_ONLY if (with_sr0) { tcg_gen_mov_i64(cpu_sr[0], cpu_iasq_b); @@ -729,7 +728,7 @@ static bool use_goto_tb(DisasContext *ctx, const DisasIAQE *f, { return (!iaqe_variable(f) && (b == NULL || !iaqe_variable(b)) && - translator_use_goto_tb(&ctx->base, f->disp)); + translator_use_goto_tb(&ctx->base, ctx->iaoq_first + f->disp)); } /* If the next insn is to be nullified, and it's on the same page, @@ -740,7 +739,8 @@ static bool use_nullify_skip(DisasContext *ctx) { return (!(tb_cflags(ctx->base.tb) & CF_BP_PAGE) && !iaqe_variable(&ctx->iaq_b) - && is_same_page(&ctx->base, ctx->iaq_b.disp)); + && (((ctx->iaoq_first + ctx->iaq_b.disp) ^ ctx->iaoq_first) + & TARGET_PAGE_MASK) == 0); } static void gen_goto_tb(DisasContext *ctx, int which, @@ -2003,6 +2003,8 @@ static TCGv_i64 do_ibranch_priv(DisasContext *ctx, TCGv_i64 offset) aforementioned BE. */ static void do_page_zero(DisasContext *ctx) { + assert(ctx->iaq_f.disp == 0); + /* If by some means we get here with PSW[N]=1, that implies that the B,GATE instruction would be skipped, and we'd fault on the next insn within the privileged page. */ @@ -2022,11 +2024,11 @@ static void do_page_zero(DisasContext *ctx) non-sequential instruction execution. Normally the PSW[B] bit detects this by disallowing the B,GATE instruction to execute under such conditions. */ - if (iaqe_variable(&ctx->iaq_b) || ctx->iaq_b.disp != ctx->iaq_f.disp + 4) { + if (iaqe_variable(&ctx->iaq_b) || ctx->iaq_b.disp != 4) { goto do_sigill; } - switch (ctx->iaq_f.disp & -4) { + switch (ctx->base.pc_first) { case 0x00: /* Null pointer call */ gen_excp_1(EXCP_IMP); ctx->base.is_jmp = DISAS_NORETURN; @@ -4617,8 +4619,8 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) #ifdef CONFIG_USER_ONLY ctx->privilege = MMU_IDX_TO_PRIV(MMU_USER_IDX); ctx->mmu_idx = MMU_USER_IDX; - ctx->iaq_f.disp = ctx->base.pc_first | ctx->privilege; - ctx->iaq_b.disp = ctx->base.tb->cs_base | ctx->privilege; + ctx->iaoq_first = ctx->base.pc_first | ctx->privilege; + ctx->iaq_b.disp = ctx->base.tb->cs_base - ctx->base.pc_first; ctx->unalign = (ctx->tb_flags & TB_FLAG_UNALIGN ? MO_UNALN : MO_ALIGN); #else ctx->privilege = (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; @@ -4631,9 +4633,10 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) uint64_t iasq_f = cs_base & ~0xffffffffull; int32_t diff = cs_base; - ctx->iaq_f.disp = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; + ctx->iaoq_first = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; + if (diff) { - ctx->iaq_b.disp = ctx->iaq_f.disp + diff; + ctx->iaq_b.disp = diff; } else { ctx->iaq_b.base = cpu_iaoq_b; ctx->iaq_b.space = cpu_iasq_b; @@ -4666,9 +4669,9 @@ static void hppa_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) DisasContext *ctx = container_of(dcbase, DisasContext, base); tcg_debug_assert(!iaqe_variable(&ctx->iaq_f)); - tcg_gen_insn_start(ctx->iaq_f.disp, - iaqe_variable(&ctx->iaq_b) ? -1 : ctx->iaq_b.disp, - 0); + tcg_gen_insn_start(ctx->iaoq_first + ctx->iaq_f.disp, + (iaqe_variable(&ctx->iaq_b) ? -1 : + ctx->iaoq_first + ctx->iaq_b.disp), 0); ctx->insn_start_updated = false; } From patchwork Wed Apr 24 23:59:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791758 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1116145wrq; Wed, 24 Apr 2024 17:03:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW6enOqunM2lUy+vQeI8dNMETtOJT1AwCiITZrKeaQZIcEJ9FM82o8iNIJyVtcZBkkPQtneKN84Kvhi/8EzIEhI X-Google-Smtp-Source: AGHT+IHTpRL6i6mf7usod100HdmML/pk4gPuQpSa3xZ0iecwBJu/l6lxhAOi6AB3Iq/7F3YPYF98 X-Received: by 2002:a05:620a:1998:b0:790:839c:b7e5 with SMTP id bm24-20020a05620a199800b00790839cb7e5mr2016329qkb.24.1714003397199; Wed, 24 Apr 2024 17:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003397; cv=none; d=google.com; s=arc-20160816; b=v6gRk34CrLbewXTiXx55+2OW+pEaQxUtBxh8Y8S96gHi7NDCHomy0iZeyBGgbu4hZS zLdLVhnTA8kd0F0jPAxbHxV9Jd1yxwoUk91GzgUJOOAKUZ9ABLlgTpP94Ri/24KZA51b hLlR3JAYNbROmZUswJrgfhcdDRRcDMjMSq+5y932T+I4Ro3bvGz99ydaprfZOBvSxCNq zkhDoJFgMLiw+pXtZvLXJeFIMF/TN5v94YUMkH72nBuJJy1QNEwmYrq05kHqcvvB8nSH A35wU+z/r1jjF7Q7s9HXzbVF4Mk3w//wGw1+enePZAp1auTHt+jEkje6JtcsArmzG5Yo T1xw== 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=qDO8sWnQNbivNt7ZCqaE2Z4gUTvny6k2DjDvVhkGNcE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tJtjNStWG0u8LHjByBYXlrkXZqoNAWfOENYmI+isQameG4FLQlH2kYdB6Sk6zwN8EJ gFVHsU7CUEpoJ0RN47XUuRCMkaykMa0V/jcDO+meGoag50PjXDda3yxy2bcJrNo2HAjg MkiGVBf4nB6kV16TbGD73eCtf1CNu/KIhYZqftxEqFjf4jr9Ir0n8rs9Tn4Sy8KPBk6z BsOC8P0XzzN+ZEb7kCzgbQ3uLwHFjZXW8Bc/D04NZ9KRnWk4UsANPcRgtgYFxKXTzNc1 726tOF7kVQ0p+5iZZ9294855RrC2mITSW+3oUgLQXdK5Zz119ZfNsBiCoyDsfve4/6be BEgg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bI6fZUdO; 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 b16-20020a05620a04f000b0078d78c9d23bsi16112079qkh.762.2024.04.24.17.03.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:03:17 -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=bI6fZUdO; 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 1rzmYF-0008PB-5P; Wed, 24 Apr 2024 20:01:23 -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 1rzmXi-0008Cq-TU for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:52 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXd-0006FT-Fk for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:48 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e2c725e234so12375715ad.1 for ; Wed, 24 Apr 2024 17:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003243; x=1714608043; 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=qDO8sWnQNbivNt7ZCqaE2Z4gUTvny6k2DjDvVhkGNcE=; b=bI6fZUdOgULiuZTm1xQJX807RIPe19m2xHRYQ/Z1mdc79+Kmhky3F80z0XgpzsYj/S K8CxPeyRJ/GQgC0tnxFBuiQBhYztmKFd2Fi6D7icrZPWgvY2h0tlTEexP9IuMcgqdkmV YH+K+3Ytnq6y1w/8iZ5FWe+ZuhKqzweusDlqf+XCJIMQBtdCoscmSGY8sgoASuAZHAl6 CUgaWwkcu+D6axH5UTQ6oRMc/JenAMkmACg1skavKKoB1QxPUREkfQJ7Ee/jC6kuvXxr GYqmC0EdvzFSSdHorGLnd8vD5Pj8lO27WX/CBq0gJ6jQMXIRsuP94v+QMbLLUyJLkgJr 7qRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003243; x=1714608043; 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=qDO8sWnQNbivNt7ZCqaE2Z4gUTvny6k2DjDvVhkGNcE=; b=ZMDjTsN5Qjf7WWcuha4KRkdaj/42Gm6ttpvA50Z6XJA+7aInYZKF4rWx8Z+isO/NN6 5RuEc87WLzAQkIEj4b1MeLGe35kzGXNFcI6mHp1qosAlumA4mNUwXbxbGUDNYIaROHox UY90Db2GWTyUStnvgG5VIGHxfa2ZvGHQrSjAf2Ud6DU61zY9OEfu4NPIbEJoWDykeeaK F1LGjg6Tb8U0tPHkl+1mb6V0NdP7zhhIVwg/wZiwtUKleUfhezWeVNKFggoD6CBidRLo IWL70/7wleFRDGZlVVfSZrI/LFwXuZ74qdmusdSpNUo0s4aE2EFo2skY39ph4eagO4vu ixcA== X-Gm-Message-State: AOJu0Yy0x9eMWRahWJFFsqlOL45KPonofOnVVjwmUI0wjoMfAjNmmqd4 gurZhCkGZodePrQE4YLsv8WcZiubHuXNSQW9b61llCk5QW6eCT1VRrvVtR4C9X/rJqvYRIlxVfw n X-Received: by 2002:a17:903:228e:b0:1e5:5c69:fcda with SMTP id b14-20020a170903228e00b001e55c69fcdamr1832469plh.26.1714003243586; Wed, 24 Apr 2024 17:00:43 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 19/45] target/hppa: Rename cond_make_* helpers Date: Wed, 24 Apr 2024 16:59:57 -0700 Message-Id: <20240425000023.1002026-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Use 'v' for a variable that needs copying, 't' for a temp that doesn't need copying, and 'i' for an immediate, and use this naming for both arguments of the comparison. So: cond_make_tmp -> cond_make_tt cond_make_0_tmp -> cond_make_ti cond_make_0 -> cond_make_vi cond_make -> cond_make_vv Pass 0 explictly, rather than implicitly in the function name. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index dd3921dbf9..a1132c884f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -344,32 +344,32 @@ static DisasCond cond_make_n(void) }; } -static DisasCond cond_make_tmp(TCGCond c, TCGv_i64 a0, TCGv_i64 a1) +static DisasCond cond_make_tt(TCGCond c, TCGv_i64 a0, TCGv_i64 a1) { assert (c != TCG_COND_NEVER && c != TCG_COND_ALWAYS); return (DisasCond){ .c = c, .a0 = a0, .a1 = a1 }; } -static DisasCond cond_make_0_tmp(TCGCond c, TCGv_i64 a0) +static DisasCond cond_make_ti(TCGCond c, TCGv_i64 a0, uint64_t imm) { - return cond_make_tmp(c, a0, tcg_constant_i64(0)); + return cond_make_tt(c, a0, tcg_constant_i64(imm)); } -static DisasCond cond_make_0(TCGCond c, TCGv_i64 a0) +static DisasCond cond_make_vi(TCGCond c, TCGv_i64 a0, uint64_t imm) { TCGv_i64 tmp = tcg_temp_new_i64(); tcg_gen_mov_i64(tmp, a0); - return cond_make_0_tmp(c, tmp); + return cond_make_ti(c, tmp, imm); } -static DisasCond cond_make(TCGCond c, TCGv_i64 a0, TCGv_i64 a1) +static DisasCond cond_make_vv(TCGCond c, TCGv_i64 a0, TCGv_i64 a1) { TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); tcg_gen_mov_i64(t0, a0); tcg_gen_mov_i64(t1, a1); - return cond_make_tmp(c, t0, t1); + return cond_make_tt(c, t0, t1); } static void cond_free(DisasCond *cond) @@ -787,7 +787,7 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, tcg_gen_ext32u_i64(tmp, res); res = tmp; } - cond = cond_make_0(TCG_COND_EQ, res); + cond = cond_make_vi(TCG_COND_EQ, res, 0); break; case 2: /* < / >= (N ^ V / !(N ^ V) */ tmp = tcg_temp_new_i64(); @@ -795,7 +795,7 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, if (!d) { tcg_gen_ext32s_i64(tmp, tmp); } - cond = cond_make_0_tmp(TCG_COND_LT, tmp); + cond = cond_make_ti(TCG_COND_LT, tmp, 0); break; case 3: /* <= / > (N ^ V) | Z / !((N ^ V) | Z) */ /* @@ -817,10 +817,10 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, tcg_gen_sari_i64(tmp, tmp, 63); tcg_gen_and_i64(tmp, tmp, res); } - cond = cond_make_0_tmp(TCG_COND_EQ, tmp); + cond = cond_make_ti(TCG_COND_EQ, tmp, 0); break; case 4: /* NUV / UV (!UV / UV) */ - cond = cond_make_0(TCG_COND_EQ, uv); + cond = cond_make_vi(TCG_COND_EQ, uv, 0); break; case 5: /* ZNV / VNZ (!UV | Z / UV & !Z) */ tmp = tcg_temp_new_i64(); @@ -828,7 +828,7 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, if (!d) { tcg_gen_ext32u_i64(tmp, tmp); } - cond = cond_make_0_tmp(TCG_COND_EQ, tmp); + cond = cond_make_ti(TCG_COND_EQ, tmp, 0); break; case 6: /* SV / NSV (V / !V) */ if (!d) { @@ -836,12 +836,12 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, tcg_gen_ext32s_i64(tmp, sv); sv = tmp; } - cond = cond_make_0(TCG_COND_LT, sv); + cond = cond_make_ti(TCG_COND_LT, sv, 0); break; case 7: /* OD / EV */ tmp = tcg_temp_new_i64(); tcg_gen_andi_i64(tmp, res, 1); - cond = cond_make_0_tmp(TCG_COND_NE, tmp); + cond = cond_make_ti(TCG_COND_NE, tmp, 0); break; default: g_assert_not_reached(); @@ -903,9 +903,9 @@ static DisasCond do_sub_cond(DisasContext *ctx, unsigned cf, bool d, tcg_gen_ext32s_i64(t1, in1); tcg_gen_ext32s_i64(t2, in2); } - return cond_make_tmp(tc, t1, t2); + return cond_make_tt(tc, t1, t2); } - return cond_make(tc, in1, in2); + return cond_make_vv(tc, in1, in2); } /* @@ -977,9 +977,9 @@ static DisasCond do_log_cond(DisasContext *ctx, unsigned cf, bool d, } else { tcg_gen_ext32s_i64(tmp, res); } - return cond_make_0_tmp(tc, tmp); + return cond_make_ti(tc, tmp, 0); } - return cond_make_0(tc, res); + return cond_make_vi(tc, res, 0); } /* Similar, but for shift/extract/deposit conditions. */ @@ -1038,7 +1038,7 @@ static DisasCond do_unit_zero_cond(unsigned cf, bool d, TCGv_i64 res) tcg_gen_andc_i64(tmp, tmp, res); tcg_gen_andi_i64(tmp, tmp, sgns); - return cond_make_0_tmp(cf & 1 ? TCG_COND_EQ : TCG_COND_NE, tmp); + return cond_make_ti(cf & 1 ? TCG_COND_EQ : TCG_COND_NE, tmp, 0); } static TCGv_i64 get_carry(DisasContext *ctx, bool d, @@ -1452,7 +1452,7 @@ static void do_unit_addsub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, } tcg_gen_andi_i64(cb, cb, test_cb); - cond = cond_make_0_tmp(cf & 1 ? TCG_COND_EQ : TCG_COND_NE, cb); + cond = cond_make_ti(cf & 1 ? TCG_COND_EQ : TCG_COND_NE, cb, 0); } if (is_tc) { @@ -3541,7 +3541,7 @@ static bool trans_bb_sar(DisasContext *ctx, arg_bb_sar *a) tcg_gen_shl_i64(tmp, tcg_r, tmp); } - cond = cond_make_0_tmp(a->c ? TCG_COND_GE : TCG_COND_LT, tmp); + cond = cond_make_ti(a->c ? TCG_COND_GE : TCG_COND_LT, tmp, 0); return do_cbranch(ctx, a->disp, a->n, &cond); } @@ -3558,7 +3558,7 @@ static bool trans_bb_imm(DisasContext *ctx, arg_bb_imm *a) p = a->p | (a->d ? 0 : 32); tcg_gen_shli_i64(tmp, tcg_r, p); - cond = cond_make_0(a->c ? TCG_COND_GE : TCG_COND_LT, tmp); + cond = cond_make_ti(a->c ? TCG_COND_GE : TCG_COND_LT, tmp, 0); return do_cbranch(ctx, a->disp, a->n, &cond); } @@ -4362,7 +4362,7 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a) switch (a->c) { case 0: /* simple */ tcg_gen_andi_i64(t, t, 0x4000000); - ctx->null_cond = cond_make_0(TCG_COND_NE, t); + ctx->null_cond = cond_make_ti(TCG_COND_NE, t, 0); goto done; case 2: /* rej */ inv = true; @@ -4392,16 +4392,16 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a) if (inv) { TCGv_i64 c = tcg_constant_i64(mask); tcg_gen_or_i64(t, t, c); - ctx->null_cond = cond_make(TCG_COND_EQ, t, c); + ctx->null_cond = cond_make_tt(TCG_COND_EQ, t, c); } else { tcg_gen_andi_i64(t, t, mask); - ctx->null_cond = cond_make_0(TCG_COND_EQ, t); + ctx->null_cond = cond_make_ti(TCG_COND_EQ, t, 0); } } else { unsigned cbit = (a->y ^ 1) - 1; tcg_gen_extract_i64(t, t, 21 - cbit, 1); - ctx->null_cond = cond_make_0(TCG_COND_NE, t); + ctx->null_cond = cond_make_ti(TCG_COND_NE, t, 0); } done: From patchwork Wed Apr 24 23:59:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791750 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115304wrq; Wed, 24 Apr 2024 17:01:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUbbjDI9o8oy60YuMOTe3JWBNlxHQ6Y0IdOzxtmjPM+S1RpxRkaOD+s6KKipwjlrPVbUkrGu2bzNqgIvnpO1Tkz X-Google-Smtp-Source: AGHT+IGcW90B8A2gE4E7vvGFTFXciSnElYajyqaVB63Ki7Jy58Ud85BY/2tfePeCLQ+NM57g0OH9 X-Received: by 2002:a05:622a:1652:b0:43a:43da:f2a8 with SMTP id y18-20020a05622a165200b0043a43daf2a8mr674878qtj.32.1714003300917; Wed, 24 Apr 2024 17:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003300; cv=none; d=google.com; s=arc-20160816; b=FTXCbBbKYVAS7mgjJV4WESxT9Ue5lQ/8DDlwspZVHrkRffYWK14s918TmrzB0h4m+C A49jnXM5Jg0ySP85OVVWEizy0oPWcBzpOcgllV0H/3woGIuU2qO5tAFWikrAa4FwE0wb 4SxT/HJuD1NySMnc14GZGcYvE3gXv0g26hLX6Fg9EQ+LDOCCdL3UdOjg+KbAnl+GjgHR WdhwYiffSyFHO9QrqwZpfrO/dGM1G8df/mn0fydSqic0+aS3ySuSQ2wgU7JPLkvcRyig TS7kk8Z8QEyGJn6hIAxj9cY6MPx/WJ4Hu9empFeZL+CYRO+mIf1C9/Fqk4+FUA971J9K xHRg== 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=sBoMtRpNUhZyyUE2ok4zpDnqVYPF1BDMLN5qK7vk7BM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=RyBKfkqLjPAmhsi5wk/2K7mlyYHYYQhZ00vFHy8qHQt2nodm/KmFhxj6oQndFt3ZN7 AZJzpy1ZTUBxhzHLCFVrblADhV34FTNMy/72rYIzRacoOaBB+rgnBifGZQUcYmGAXWiR c5EIdVZvzpdOhCwc+wRsrD5TewXgAnDTEAsEs1/Y4vv5ou1uuuCPSMz6ct44cOGrL36C qJOcP4fsflW2pEOBIgRuRTzw2YlvRvY3tadYehsgLourFZkZxD/ILO4zXvyGUFVoHmP7 5CkI4gz8x5j+1yTs50Lo5lEHwLF1uSQ5hT/2fj/W2RFA9FU5TNKBBA0x977T2xX0EeeJ pbnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MI+GrggG; 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 g20-20020ac87f54000000b004364eb09046si16321125qtk.345.2024.04.24.17.01.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:01:40 -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=MI+GrggG; 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 1rzmY9-0008O5-9S; Wed, 24 Apr 2024 20:01:17 -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 1rzmXi-0008Cr-Tr for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:52 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXf-0006Fn-89 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:49 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1e8f68f8e0dso2724715ad.3 for ; Wed, 24 Apr 2024 17:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003245; x=1714608045; 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=sBoMtRpNUhZyyUE2ok4zpDnqVYPF1BDMLN5qK7vk7BM=; b=MI+GrggG0FEWCi5hRH95Se/GYnpgmLRb0JWkBleae7nr5pKsR3Jf+efrpHpt/7C3o5 08HVtHtQLM3ElEbXr+HxEpeB07E4IBdkGFapr4whcPFfmFuNY/QGrXl5egHdvPc8jJSb Sa60xREBgywn7/XiHbwiTclwNRCn3TThITvwSkS9K8YG5QJwMddbYMHhQJ8n7Ha/lJV+ /Ytdo/aq1VqbDvKwIICdjWPBirOrGG/ND6jHgzwfMzMYtqvAKRMb1TdzbQPIzP7kv3ih Dg1CH20LOVXVlgmld1gZRgQUDogMljcPJk0Vd8ec/q2dsaHr5HyQ0YdyufYtGCI9LSkG Va8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003245; x=1714608045; 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=sBoMtRpNUhZyyUE2ok4zpDnqVYPF1BDMLN5qK7vk7BM=; b=olUFlvg7Oe5yU+XkKhz0/UrlHOIsEhKGP0ffWTKAoul+Q2t1MlxfYHMT1S+wvUZmT8 7FgfF74dlK08vyXKnOYbshqPqTOQ7z5aLiWzv8nKxKZAtWJQ7ug666Wadb5XUm5Q5RJ+ vFPm2wWYdUcDmgi9MIC+eiBDm0DAFzCL4Bdmn1Q7tUUn6ztgmcXioeWj9L0n9nC0Lft7 RY/i9IXrWV8ql71YdJPWyMXkqAcM1rBIt4NyL8gI+oQGc/EWUjmIbWBupuEHsRqhs12v ZOV+0x9JA06/6ZPxuEnRVfcgo0VcPLXDab1kfe+/6HKFa6yO+athLnUlGR1I4h+3tbA4 g15Q== X-Gm-Message-State: AOJu0YzUizrMNqvb1DOw3YslH9mJf744890Dhp5BAx5JQGY4NA7iANK/ 9vWQMAD1a1CvAtJHuYFFBi0R+mIKc6E9zj9lDgp6b7J4lYCa2Psl9bGdYv26mlRR52XptGGUlkn T X-Received: by 2002:a17:903:2a8b:b0:1e4:cb0e:2988 with SMTP id lv11-20020a1709032a8b00b001e4cb0e2988mr5316445plb.2.1714003245139; Wed, 24 Apr 2024 17:00:45 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 20/45] target/hppa: Use TCG_COND_TST* in do_cond Date: Wed, 24 Apr 2024 16:59:58 -0700 Message-Id: <20240425000023.1002026-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 We can directly test bits of a 32-bit comparison without zero or sign-extending an intermediate result. We can directly test bit 0 for odd/even. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 64 ++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index a1132c884f..85941f191f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -774,28 +774,36 @@ static bool cond_need_cb(int c) static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, TCGv_i64 res, TCGv_i64 uv, TCGv_i64 sv) { + TCGCond sign_cond, zero_cond; + uint64_t sign_imm, zero_imm; DisasCond cond; TCGv_i64 tmp; + if (d) { + /* 64-bit condition. */ + sign_imm = 0; + sign_cond = TCG_COND_LT; + zero_imm = 0; + zero_cond = TCG_COND_EQ; + } else { + /* 32-bit condition. */ + sign_imm = 1ull << 31; + sign_cond = TCG_COND_TSTNE; + zero_imm = UINT32_MAX; + zero_cond = TCG_COND_TSTEQ; + } + switch (cf >> 1) { case 0: /* Never / TR (0 / 1) */ cond = cond_make_f(); break; case 1: /* = / <> (Z / !Z) */ - if (!d) { - tmp = tcg_temp_new_i64(); - tcg_gen_ext32u_i64(tmp, res); - res = tmp; - } - cond = cond_make_vi(TCG_COND_EQ, res, 0); + cond = cond_make_vi(zero_cond, res, zero_imm); break; case 2: /* < / >= (N ^ V / !(N ^ V) */ tmp = tcg_temp_new_i64(); tcg_gen_xor_i64(tmp, res, sv); - if (!d) { - tcg_gen_ext32s_i64(tmp, tmp); - } - cond = cond_make_ti(TCG_COND_LT, tmp, 0); + cond = cond_make_ti(sign_cond, tmp, sign_imm); break; case 3: /* <= / > (N ^ V) | Z / !((N ^ V) | Z) */ /* @@ -803,21 +811,15 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, * (N ^ V) | Z * ((res < 0) ^ (sv < 0)) | !res * ((res ^ sv) < 0) | !res - * (~(res ^ sv) >= 0) | !res - * !(~(res ^ sv) >> 31) | !res - * !(~(res ^ sv) >> 31 & res) + * ((res ^ sv) < 0 ? 1 : !res) + * !((res ^ sv) < 0 ? 0 : res) */ tmp = tcg_temp_new_i64(); - tcg_gen_eqv_i64(tmp, res, sv); - if (!d) { - tcg_gen_sextract_i64(tmp, tmp, 31, 1); - tcg_gen_and_i64(tmp, tmp, res); - tcg_gen_ext32u_i64(tmp, tmp); - } else { - tcg_gen_sari_i64(tmp, tmp, 63); - tcg_gen_and_i64(tmp, tmp, res); - } - cond = cond_make_ti(TCG_COND_EQ, tmp, 0); + tcg_gen_xor_i64(tmp, res, sv); + tcg_gen_movcond_i64(sign_cond, tmp, + tmp, tcg_constant_i64(sign_imm), + ctx->zero, res); + cond = cond_make_ti(zero_cond, tmp, zero_imm); break; case 4: /* NUV / UV (!UV / UV) */ cond = cond_make_vi(TCG_COND_EQ, uv, 0); @@ -825,23 +827,13 @@ static DisasCond do_cond(DisasContext *ctx, unsigned cf, bool d, case 5: /* ZNV / VNZ (!UV | Z / UV & !Z) */ tmp = tcg_temp_new_i64(); tcg_gen_movcond_i64(TCG_COND_EQ, tmp, uv, ctx->zero, ctx->zero, res); - if (!d) { - tcg_gen_ext32u_i64(tmp, tmp); - } - cond = cond_make_ti(TCG_COND_EQ, tmp, 0); + cond = cond_make_ti(zero_cond, tmp, zero_imm); break; case 6: /* SV / NSV (V / !V) */ - if (!d) { - tmp = tcg_temp_new_i64(); - tcg_gen_ext32s_i64(tmp, sv); - sv = tmp; - } - cond = cond_make_ti(TCG_COND_LT, sv, 0); + cond = cond_make_vi(sign_cond, sv, sign_imm); break; case 7: /* OD / EV */ - tmp = tcg_temp_new_i64(); - tcg_gen_andi_i64(tmp, res, 1); - cond = cond_make_ti(TCG_COND_NE, tmp, 0); + cond = cond_make_vi(TCG_COND_TSTNE, res, 1); break; default: g_assert_not_reached(); From patchwork Wed Apr 24 23:59:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791753 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115476wrq; Wed, 24 Apr 2024 17:01:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUX01Dp2+vPPkLqpSR9W24KfM0Fr0k+7ocUQMKbtwwl6b7fRh+HLvPGfUofKfHFRvg26vtJaIUTD5V+X4ooh7hf X-Google-Smtp-Source: AGHT+IFycH020hZqspdgtdR2khfFm0ZrmMB8U+kAYrW2HGyAEtlyzoak8ag/mcLjGlwoP/U4AojZ X-Received: by 2002:a05:620a:2994:b0:790:98f3:8237 with SMTP id r20-20020a05620a299400b0079098f38237mr1186265qkp.5.1714003319121; Wed, 24 Apr 2024 17:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003319; cv=none; d=google.com; s=arc-20160816; b=DvPMKP9zXucJjR0/ZGUV8jFhGrIHAKSslGRYhEiCd5PW3AUn9/CQEZlzydjPJqQWsf 8pYufV5QU9oLhyzJosmnZAB22luAmPexViMRDHbjSOJPhxjOAI75nUf9H+USvcRDLFsj zDsBqXA76e95JeDCy40yca4SMXrvmo/Zvjg5IQJ+3XHubodpFsu2tUlSxir1XyIcL21K 4iiqLlCf9Yju2O8IkFTCXcoOW9tJBGmxSMT48WKWxJ+k5ZqmEr2ybJt/2M7XIb35YCFi uWUnX0DZ1jJj8TQGk386iu4OCCOyDXpga94dc0eS4+qK03TyMSOLVkf9FllhWRRoKLpd 6W7w== 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=Ew8D6ehUvWlq0jHPQbRieoCdY1UW1gXumM2QO3oxkyc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YebqOXromxv9CYOAibftoWFBXweWnSH8emw0Il92DwzJSeveldbMplgZxvy30Bl0IZ K3i4smLQ8Q4R7EhL10ioaaIx/jLr1o0Y/fO+vDgndYVb3D6Gv/y0gPHYT7wic2egi3AG ZSl4Dx735WCHl/BVd/kNljdDcU/6djzu+pi1vSxZGwuStana6OIdMA8WmKwgX6SS1Cbj IiJMsVjFKarM//nA3MFl5KiOgnMNdZQKUs6nTtV13hiDy7QqQaZvnbjk2RskzfVIzLpH VuoBf07G0WDT6Tm2I54epsfXsCNFF8jhbbQFpoRcy+KOzogG0rDlOHOpjTFyo+zabMng TQpQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W9v8YAFu; 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 y11-20020ae9f40b000000b0078d4e0e5ea6si12806094qkl.738.2024.04.24.17.01.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:01:59 -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=W9v8YAFu; 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 1rzmYD-0008Oq-Nw; Wed, 24 Apr 2024 20:01:22 -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 1rzmXk-0008Ea-BU for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:53 -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 1rzmXf-0006Fr-Pm for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:50 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1eab16dcfd8so1568705ad.0 for ; Wed, 24 Apr 2024 17:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003246; x=1714608046; 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=Ew8D6ehUvWlq0jHPQbRieoCdY1UW1gXumM2QO3oxkyc=; b=W9v8YAFu9S36N8jKl0siylA6qWBPZM4RhT2kIu/ERv8zCbcSgIUgNHMSbYWP310wXQ k1qHL9hZdIsb6kOkdYAFCdSsqY63Uw9l/9VXocAla4QRbbAi9KhPV3Zq06xt/rWwHENf S4mSRTWghjeLKoBpw0jHMUCzORsj64mDUbj3MIkKkFlCZfFVE87I2F7+iWHKrmTHr/MV lDSXqfkfSLEh1F8kYYot9AE70DQIWEGMV0PkLt/ql/OXb79R/eMObzP9rmbny0sbXAVg EFOzGwUIGjNhZhNMFZt7xGjT/cF97OzFh++Ase57EOtfwO6QI0ldBjvAOWnXV2rx24U0 Krpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003246; x=1714608046; 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=Ew8D6ehUvWlq0jHPQbRieoCdY1UW1gXumM2QO3oxkyc=; b=hSptfRxu2NWa/C7NiThfuLlF3uzald5d1aTiTiIm4Aq29KfJ6duDM4sFyejLHVZOcS vFjdzl7P9BgbMAE0a26hW3YymJXXyW1FTO8mN/2yD5CQLYMxxn1pOfETrXdkNrAf8Gjp k5bHX8O/uoArGyP7mL+s8Cg05GX6FZmMQJ9ML9ayJ/YrJUZnuXByQ7xIASP05Uv6SFNO wOs4NgfBPgVCMDGEKHeM2E8KBa6+hZ65M5bX1jIoqApuKCAAa0P2rpKKdBxCMhKJdLx5 Wk1AGOIlcdkkmwyvXIf+YoB2/PuGhj3YiTLFM89Fq4pQrNjKz0zPMuxGwQzio2RccLkq QoLQ== X-Gm-Message-State: AOJu0Yzy0AAv5s1PhiTU1fCom6HRzcx+E9cYXwvLQW4RGObGoj55zlNv QvGffSCO5i1ZzZIVnAzu/wBgKoyRw8ZNcfDH/MLltHfzAu8ZOqJ8s8sHftpPzzt233U1Y3R2LzT R X-Received: by 2002:a17:902:da88:b0:1e4:17e4:3a1f with SMTP id j8-20020a170902da8800b001e417e43a1fmr5162028plx.4.1714003246036; Wed, 24 Apr 2024 17:00:46 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 21/45] target/hppa: Use TCG_COND_TST* in do_log_cond Date: Wed, 24 Apr 2024 16:59:59 -0700 Message-Id: <20240425000023.1002026-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We can directly test bits of a 32-bit comparison without zero or sign-extending an intermediate result. We can directly test bit 0 for odd/even. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 78 ++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 85941f191f..1e772bef4d 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -913,65 +913,41 @@ static DisasCond do_log_cond(DisasContext *ctx, unsigned cf, bool d, TCGv_i64 res) { TCGCond tc; - bool ext_uns; + uint64_t imm; - switch (cf) { - case 0: /* never */ - case 9: /* undef, C */ - case 11: /* undef, C & !Z */ - case 12: /* undef, V */ - return cond_make_f(); - - case 1: /* true */ - case 8: /* undef, !C */ - case 10: /* undef, !C | Z */ - case 13: /* undef, !V */ - return cond_make_t(); - - case 2: /* == */ - tc = TCG_COND_EQ; - ext_uns = true; + switch (cf >> 1) { + case 0: /* never / always */ + case 4: /* undef, C */ + case 5: /* undef, C & !Z */ + case 6: /* undef, V */ + return cf & 1 ? cond_make_t() : cond_make_f(); + case 1: /* == / <> */ + tc = d ? TCG_COND_EQ : TCG_COND_TSTEQ; + imm = d ? 0 : UINT32_MAX; break; - case 3: /* <> */ - tc = TCG_COND_NE; - ext_uns = true; + case 2: /* < / >= */ + tc = d ? TCG_COND_LT : TCG_COND_TSTNE; + imm = d ? 0 : 1ull << 31; break; - case 4: /* < */ - tc = TCG_COND_LT; - ext_uns = false; + case 3: /* <= / > */ + tc = cf & 1 ? TCG_COND_GT : TCG_COND_LE; + if (!d) { + TCGv_i64 tmp = tcg_temp_new_i64(); + tcg_gen_ext32s_i64(tmp, res); + return cond_make_ti(tc, tmp, 0); + } + return cond_make_vi(tc, res, 0); + case 7: /* OD / EV */ + tc = TCG_COND_TSTNE; + imm = 1; break; - case 5: /* >= */ - tc = TCG_COND_GE; - ext_uns = false; - break; - case 6: /* <= */ - tc = TCG_COND_LE; - ext_uns = false; - break; - case 7: /* > */ - tc = TCG_COND_GT; - ext_uns = false; - break; - - case 14: /* OD */ - case 15: /* EV */ - return do_cond(ctx, cf, d, res, NULL, NULL); - default: g_assert_not_reached(); } - - if (!d) { - TCGv_i64 tmp = tcg_temp_new_i64(); - - if (ext_uns) { - tcg_gen_ext32u_i64(tmp, res); - } else { - tcg_gen_ext32s_i64(tmp, res); - } - return cond_make_ti(tc, tmp, 0); + if (cf & 1) { + tc = tcg_invert_cond(tc); } - return cond_make_vi(tc, res, 0); + return cond_make_vi(tc, res, imm); } /* Similar, but for shift/extract/deposit conditions. */ From patchwork Thu Apr 25 00:00:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791774 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118493wrq; Wed, 24 Apr 2024 17:08:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXZjocuK42rJlB1AUpOj2Cv+kuPy8Qg/8h6tj3U88JDPb9tjEi79tCAOkf8M+zXSeUI6MMArWGbBzTlTJ72/A4a X-Google-Smtp-Source: AGHT+IEdBXBsgg5jr2dpabbzJyUj+ihv+JTVCTY4/VYJ0XT7owRQARBqodI70Ft+Sp9LvtvgfOmJ X-Received: by 2002:a05:620a:1721:b0:790:96e8:dbc9 with SMTP id az33-20020a05620a172100b0079096e8dbc9mr1957065qkb.39.1714003732299; Wed, 24 Apr 2024 17:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003732; cv=none; d=google.com; s=arc-20160816; b=DF8+klxVK1yGxDQObBysFixHMzn8rsoiQiBmLrcQz+FpO/SSCMdiZcd02pfkyTav6O FsSiZUPUSXS7BjL8h1GWMNBaCg6CNHe6ogV8bCOsPud2N1h5WeFpKa34YDeh+a6gE+NE oO6Cc/07NjdyEAf+dtrEwaKefqSfKRTJnqy4fZfsf/oiup7NE6/amAGsG4H+J+oe+y03 5PIQA+Iix3e+Ixf67OT/8ZuE9J8INaMOqs5W4Dr9byquKuXtA/6/I3dSjNCm4hiXmjF8 vH24zWvvEIPkleDw+g2GAFARnvCkkqS0VGfku1plUL2jKvDJWuWvkr/gcTziweSopi2u pP3w== 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=EEr/CTx0m18MWffmgDo1fGRGoUzQVxqe+gQYA3aCxoc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=0SZV/7jHuBvyR9G/AZ3DUaqoqLOfddfib+nUh5RgllcUWRJcmOpQauG+YhxOdkY3bM KfrRyjWU3lbpli72Tyhp3/n/PqH86j4PcE+vdH2cSWaHGPjx0GaXdctELD8zWH1qiW7+ sU7Y7828nnYRh9G1mVj7PE3/l3MdmM6uY3ivW3V8yvGboZlk3uZtQULqnAQtqbxf3VHi NKkkZ6zVoHaWyqix+9oNBbO4/RgV7pKpzn9Y0XMH2q9oC0y40A9rya57AuF+wup+7P90 6vM7yTmHYeNWSqeZknzCJEc6pZ/w/crSdTX1Kpp9aALX8i9kpNaCDL4QLpPKiY8sXPFV cLfw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hCU4L4zz; 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 b19-20020a05620a089300b00790677b0921si10732239qka.428.2024.04.24.17.08.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08: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=hCU4L4zz; 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 1rzmY5-0008MS-IM; Wed, 24 Apr 2024 20:01:13 -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 1rzmXk-0008Eb-BU for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:53 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXg-0006G5-5r for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:51 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e50a04c317so2386515ad.1 for ; Wed, 24 Apr 2024 17:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003247; x=1714608047; 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=EEr/CTx0m18MWffmgDo1fGRGoUzQVxqe+gQYA3aCxoc=; b=hCU4L4zzDPERd67/JeMoDYuuqpAyOGk5paakVXB5GyiN4Pf2LYAQLo+zVwgpYPmL2W /AZcNc1Gmej1XPW5AdH1nyxbXpqcisjMaG9Ha2hDPSeVnsp0wiuXHf6GRzZlFpqHj1ql tidTMb82t+TDAV0xke+vX+TbPvsJ28B390SK3oNAzThEa2F1G684otayXvvfvt8dL+6r BcLyVOZLsVOGGeqI+jGq1e4McWKfs9M5/tWjOjlBt9HmHAvzaO+x7DmvOmj2l/pCzy4o E/qYtmSFJv6MRHZ3wtJ3maIHL9Su9cBmyT8OhWFq9G7Rd2QQMtcZgI5UrPO6uJzWByZJ l8Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003247; x=1714608047; 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=EEr/CTx0m18MWffmgDo1fGRGoUzQVxqe+gQYA3aCxoc=; b=b4BF3uLN4y0k0OqAn71LCSYu/cU0rMADZkMCNPWoHYwuwUEJUvDxJ7ih/L07qlWC1M TRfdxUTiWBOcHeeaUZvVaL9CAQvvR6hfCTx3NYD3xCievWZ4ergzfkikzzggJpds9rK8 IF/rB/RbjUobmOPQefs72VlKTQ/N82ZathZHDMw5YgYDMHBXlcEKvReaTGddRoK6biz5 jpVn6YLs8Lsz1oFro29kD2DelLnb+D1sdlSB2U4vLARpydzqTAJmx64KOhFwHoi7TuxG Qd/ZBjUa+0SpcbiOz1Jl772V1eOFCpbUgpF6y2v5F4IC7W5yJBLjmVZefA4f/sTEfGy1 7v+Q== X-Gm-Message-State: AOJu0Ywsj3Xie/Sm+Ml2dTgoa5uVRdQk4mnZldWowfaaTgGwTJcxTbpx xANERSGkm/WmVghTr1hH+VGNBKlykaWHvNM09Jpb+crMv4fJCLqocXdh6bVhdgIwPm0EJKsDWvX M X-Received: by 2002:a17:902:d481:b0:1e3:e25c:fa5c with SMTP id c1-20020a170902d48100b001e3e25cfa5cmr4885437plg.67.1714003246850; Wed, 24 Apr 2024 17:00:46 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 22/45] target/hppa: Use TCG_COND_TST* in do_unit_zero_cond Date: Wed, 24 Apr 2024 17:00:00 -0700 Message-Id: <20240425000023.1002026-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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/hppa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 1e772bef4d..de510fddb1 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1004,9 +1004,8 @@ static DisasCond do_unit_zero_cond(unsigned cf, bool d, TCGv_i64 res) tmp = tcg_temp_new_i64(); tcg_gen_subi_i64(tmp, res, ones); tcg_gen_andc_i64(tmp, tmp, res); - tcg_gen_andi_i64(tmp, tmp, sgns); - return cond_make_ti(cf & 1 ? TCG_COND_EQ : TCG_COND_NE, tmp, 0); + return cond_make_ti(cf & 1 ? TCG_COND_TSTEQ : TCG_COND_TSTNE, tmp, sgns); } static TCGv_i64 get_carry(DisasContext *ctx, bool d, From patchwork Thu Apr 25 00:00:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791780 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119138wrq; Wed, 24 Apr 2024 17:10:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXSJFh9+DF0jZRnvtW2Ly+u6KEGQRgUAOecHhfTvxQYcfIrpXcoAOOanYfAGaqMcQ4qT9dA/+RynQ0ntpPsxRJE X-Google-Smtp-Source: AGHT+IH8GA2P2oxwlmKQ3M9tNbqunp2DhqcJfTHnDp0h7TyqKx5UkhdAy4vznuhzLd6gU2s2DipI X-Received: by 2002:a37:c204:0:b0:78d:5d99:953c with SMTP id i4-20020a37c204000000b0078d5d99953cmr4357127qkm.28.1714003834686; Wed, 24 Apr 2024 17:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003834; cv=none; d=google.com; s=arc-20160816; b=VbgDG3MjmAEYxCGr2Ln2EaFK1iiUZp47A0/sAS+YagAn2PbIyqc1JyKteuU0pH7Up2 ejJ2/ig/J0QhFmNauxkWBUyFo22woI64ShWerB3W0Nka/MY991ygDjXk5puKhpcEqy8J Rcgmna6Ixxyif9yEt5oIPi3MjjVzTE3AkSeVCLuQkFn83cB6xWnkoxLgd0nXR8kIkzRQ n3DbGsg0/JdtvGly9CZ55fTn7ey62Grs0i019gsOEmMLPUC6MLyu6GAPn1UtWZ7QGT9R I9Y2mFUWlLuJxQCa27gb8fOhLNlZXsSkMflFpwB/FAIMl7Mvj6rcPpk+elbyVZBavS6V WqwQ== 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=5Ih32sRQyB9qudN1/7n1buQ+bIDLJQ7QnMrQwjmCdFg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YROP4OTM+PyWkXdqdyHtw85nG49IJHsTeomx0gamwlICUQmCHOBKZ5j+EQSCNJdlt3 nGv/Y5ui2Re/lDiy27HWOMXAOkucSDDq3NgS740fBOybMCfn4ydOdIshjfLam4r011al agOink3QDVMc8yE5D5UP13Dm2aM5rzqfGD+otJIp5pJg70tsGWK0VHX71eeX3UXsZnA7 wfkn8csbHT7Q3/MMKvXWgkzP4REs3Zwpx7mOtTlgscLHipse1cYkrB7yd1bd6l2iZd++ 2qn078oLm+TYWgVN7eQs6Ak0c38dT0WaKyy/k1ucMDw2/nv/Zm7/7Havaz1R9EZTWuyS IHpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LByFm94g; 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 v5-20020a05620a0f0500b0078d6339010bsi17417218qkl.724.2024.04.24.17.10.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10:34 -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=LByFm94g; 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 1rzmY6-0008NP-EG; Wed, 24 Apr 2024 20:01:14 -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 1rzmXn-0008Fs-HW for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:57 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXi-0006GP-0m for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:53 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e36b7e7dd2so3449915ad.1 for ; Wed, 24 Apr 2024 17:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003248; x=1714608048; 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=5Ih32sRQyB9qudN1/7n1buQ+bIDLJQ7QnMrQwjmCdFg=; b=LByFm94gTO3yFQwAES1rc9U7DRTooy5RXqh6JIrmb/oJ08tsjtqozf74PFmEazkcTX nyhsAMRds2bBValfgXs78l9XrwdyXdeeNoBGW+ImbY4SMrK5hEbP5cOEGdOJlc5banAG /d/saJviGG7i6NjrY84aFRg969qNUgYYu2WG3OnMoyX2FmyhpM203yUWjKEq9Yztt6fs pYRfn5QJXvgVbX7e0q6LK2y2paBa5yxicE79Z0Xc9KVP9RXbnC0bprbtyKUPpSQG9GOX Ve+8IFhEBhoIrbuTPA+o/wJLPPqAv8T6zu6RAI+i1w4o/hJfXV7/YMEj8GNztvcV7JCq haXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003248; x=1714608048; 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=5Ih32sRQyB9qudN1/7n1buQ+bIDLJQ7QnMrQwjmCdFg=; b=eJgne+AEcO/ZrwGI/682R6BB1pz7xkt63FyAU2TwDHQ8O3nZqNdJGdrQ0b8+Lhmz94 d/YH68fz9epIWf/XUuralt7E9GuyBsV6zcixMqYpP3sfEscml6euTnvOIhilC0vLyhPZ 8G5oFdDiBeLkEZXtaxk224XyevG1LC4ZgFC0kM3+nIh/SN/HYmK/RHzQnxnh7+DWTfWx 8+lzJPPmf95a3O+lJO18S4Dy3uPZ9H6HEfGK4g41MHVrLinPr58OFqxG9ZzJtCP5Is9c kJIvRRaISwmIAa323qVceljYPn5ko6aI7gRHFs6lxW7IVEvV+956aL8mcuD4n3s2fPME nv8g== X-Gm-Message-State: AOJu0YxQp9Ye3P8LVYMY/ZVzIsJt2qwbYMVfxHTpIfXPmK+1dx2sY+2r jMGoWMHT2PrFuv/moESlGqdUo4hsBi7ZE+xFKhJzuUob6trvBnqyWYcHIXwkEAcpWmPt1zAmQDi U X-Received: by 2002:a17:902:e54d:b0:1e2:6165:8086 with SMTP id n13-20020a170902e54d00b001e261658086mr5256569plf.61.1714003247778; Wed, 24 Apr 2024 17:00:47 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 23/45] target/hppa: Use TCG_COND_TST* in do_unit_addsub Date: Wed, 24 Apr 2024 17:00:01 -0700 Message-Id: <20240425000023.1002026-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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/hppa/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index de510fddb1..38697ddfbd 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1418,8 +1418,8 @@ static void do_unit_addsub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, tcg_gen_shri_i64(cb, cb, 1); } - tcg_gen_andi_i64(cb, cb, test_cb); - cond = cond_make_ti(cf & 1 ? TCG_COND_EQ : TCG_COND_NE, cb, 0); + cond = cond_make_ti(cf & 1 ? TCG_COND_TSTEQ : TCG_COND_TSTNE, + cb, test_cb); } if (is_tc) { From patchwork Thu Apr 25 00:00:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791779 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119082wrq; Wed, 24 Apr 2024 17:10:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmtl8FTKaGiS5Ek/nh1G2dMTxU+Hqiw3GdYwV1Fy9MhVFpNHZHhCB8QqSP2uohTGFxLKD6surpOii51BGRmQAi X-Google-Smtp-Source: AGHT+IFFWDnOWtJW8bav3p7Ksn9V1g9suuK32V6W+J+PEF41bOf1uuBy/sngRSbpXc0TNUkQfNOV X-Received: by 2002:a0c:c30f:0:b0:6a0:59e7:3542 with SMTP id f15-20020a0cc30f000000b006a059e73542mr4027893qvi.52.1714003829148; Wed, 24 Apr 2024 17:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003829; cv=none; d=google.com; s=arc-20160816; b=gcoKgHBARbjQbE1xywMtJhC78gj6MHUNFNG2I7x+g1Jg1Sbmbxk010vrFZ8Z+CHkb2 9xZt4NrM9OYIoMrXC6CRblSbIR34MAqAa7Ju4SGIkXGjTF9xVgxHgUXLw9iSB78d5iSZ JsF4omC0rUJurocweODob/ZSAa7eS/sUKSy8GKrVvlZjUo/sowwTsgvcmIqcb8FKQmTe UfSOy2Mlu6Wp/Yr1ZOAhOhKMXQJqo/hUVnyYF/YBW2b7HklbesEvLCShIFpeK2BKeLdO DIa2pVmFdsUZk+HV0nYynsPlUdXWJhKldyN5E4nZl5YWfsXofV2FmZ4IOpaT8klh5tVE ymlw== 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=9Kg1quTAZLERrFqYvUT2qOEYC/gEDF5UQhncM4bnEmk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=OGiV9LvVuDJ4rUgs4s3oW40tHEfI2CfTFynbIau3WSqAeh0R9vjCGhz8EvvEk9/Ds6 sE5n9+9O0zu/Pvrc8KDjXjCMGdu6LwL8uA76qPSqJp6/op4Orjna5EOVVsKGtn8Kusin gi908Ick7+p6mceAefG9bdp9UxPDst7Krcb0/JVue7D5j0kvkEs1oJSxOzkdmdIYNY3U xgBt+9K7NqIHquSuzzz2UP5Z46iCTWfu7z4JoqXxmlsYT95ZWqNEPP/BKb3nO5GLpCaY EbaMOHSQPUKMGXZeBO/rIWmdvvzIxNJ/k1fFFOQjLb63Fi5P4M2ctqARFpo/adTHFy/T dQOA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Mjew6F/j"; 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 im15-20020a056214246f00b006993a35c4a7si16751860qvb.180.2024.04.24.17.10.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10:29 -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="Mjew6F/j"; 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 1rzmY4-0008Lp-2J; Wed, 24 Apr 2024 20:01:13 -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 1rzmXo-0008GB-7n for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:57 -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 1rzmXk-0006Ga-2E for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:54 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1e65b29f703so3494945ad.3 for ; Wed, 24 Apr 2024 17:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003249; x=1714608049; 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=9Kg1quTAZLERrFqYvUT2qOEYC/gEDF5UQhncM4bnEmk=; b=Mjew6F/jQleEEI9BhxpfOxABkg3bwpYazjKcHKHhlYLHlT/D7DNm+Piv7h5vNZgHGr C97B5I1UpUa293rF3yOAJKYcuGXNrAOubZq05klHlKzTF6rLfSZmuEfitSYEYFQx0P09 Qn5bGg24gDIZWou0Aw2BiC12kNEr0aV4akhmrAtqDS2D9oYiitzs8V1KutAYECwyGCJ8 8kAE/FXOQHe5y7+GONy55SYBxqszB+M89s2AljK8/e2rnxwOSjPgYOAK6WUju5PPIeKm iI3fiTydLK8jzzuzjAql04KOUySwOi5BqxhSMlCg4zWssyPJ1S/rDQ08ZY0YgIwGkQVY 4spw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003249; x=1714608049; 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=9Kg1quTAZLERrFqYvUT2qOEYC/gEDF5UQhncM4bnEmk=; b=aNnkjQbz+YVw8WDyWeUdEEuadYUQB37qknT60YJNwNaiLC95pE7TI1oQPVb0hAiCg7 B4GG/wO5R4472thSH2kiRjkd7c5aq/uqjzkYEMZL0mnwvSo0ZFCEWoQ1TA1/s/ggfhLg rRSVEfGHryf2aIhNoIwph/4gH+tVDqREi4ccF4j94pzU8Oy/tD2FNAcFVA3pjq/PMO+g /s2gi9nw4U3dMNgUVniSuGFxCkOoGVbhqtE9SQoRoQfwlqEIKgC86narRPt9q/95ekd6 gOVNlAEySvukvZitDQi0/78tO506vznvDfIASJ7xBpeoA4cvKhBtBq5LfKnMEcfouyo1 5Qqg== X-Gm-Message-State: AOJu0YwjyZxyAV5QW3+F18ChKan9OWDDrB15Ef/fqdlBF+iUaS4SC7Uo EmLttPMv84UrDfPEoNtQLHjiGOrvTgFNqz4C+oBtgC3WmhZhN0zAo0SHr2m70s3ZDtyxYHMX1k0 u X-Received: by 2002:a17:902:da83:b0:1e8:2c8d:b74a with SMTP id j3-20020a170902da8300b001e82c8db74amr5184421plx.10.1714003249045; Wed, 24 Apr 2024 17:00:49 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 24/45] target/hppa: Use TCG_COND_TST* in trans_bb_imm Date: Wed, 24 Apr 2024 17:00:02 -0700 Message-Id: <20240425000023.1002026-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 Signed-off-by: Richard Henderson --- target/hppa/translate.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 38697ddfbd..c996eb9823 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -3514,18 +3514,12 @@ static bool trans_bb_sar(DisasContext *ctx, arg_bb_sar *a) static bool trans_bb_imm(DisasContext *ctx, arg_bb_imm *a) { - TCGv_i64 tmp, tcg_r; DisasCond cond; - int p; + int p = a->p | (a->d ? 0 : 32); nullify_over(ctx); - - tmp = tcg_temp_new_i64(); - tcg_r = load_gpr(ctx, a->r); - p = a->p | (a->d ? 0 : 32); - tcg_gen_shli_i64(tmp, tcg_r, p); - - cond = cond_make_ti(a->c ? TCG_COND_GE : TCG_COND_LT, tmp, 0); + cond = cond_make_vi(a->c ? TCG_COND_TSTEQ : TCG_COND_TSTNE, + load_gpr(ctx, a->r), 1ull << (63 - p)); return do_cbranch(ctx, a->disp, a->n, &cond); } From patchwork Thu Apr 25 00:00:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791751 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1115387wrq; Wed, 24 Apr 2024 17:01:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWyTyP2qpZCM+j3EDZmuEpkK7EKPb4bAFLEixhjPHc6Oq8OLuxmx/uvlTHceo4X4iZvBb1AUTQfkILuCG1XfcTT X-Google-Smtp-Source: AGHT+IEt0ip3+8fk1TlDIyLI3OpLt/8VdxdDiF1QDoc2zOcTyzyv4lLB3kMxHVe+tRNTJCUh25zl X-Received: by 2002:aca:1012:0:b0:3c8:2ce4:6a3e with SMTP id 18-20020aca1012000000b003c82ce46a3emr4204147oiq.48.1714003310463; Wed, 24 Apr 2024 17:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003310; cv=none; d=google.com; s=arc-20160816; b=ReCZAt0rhq+gHzIyMY2DSyxF3bbFeYpGZHE6YrjbG+Hlmgb+mJX7taYnheOVJsAyNQ aD8xyd6uasl9gYn2juiFaJGBFPo6hxzV1udHjUZQII00KLPlp61cTCuZB8tUQUEUMmq6 APlbhCzjJx8mLm4kLJrmUPS/yxPALLNDzq3UWdF7DsYTaZbNet8KaBlAWXxAUmisdjOE 2bQSQPR9mmZfYq5WSVo0Df8qqnsn80USpPK3IZ9LsemIvf2/oYJu1dyLum6RBEZtPQLT yUTgFAqhBJ/lAAlI265rC5S+y0AciC/a+5MWLbHGADuW/VZ2+hg2g4MhOmM/TTwiqrU3 4sHA== 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=CtiaqvwuVu2PCvk8ws+dlqlBGpei7mPxycYtflKdoaA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xCRmVGdB5wzcD3y7+yw/isCvBqpd3GpPzEq4YeQJnyJVIYctj8g89YVlZ63HBpVKIR nWdsfkAr27N5thRHXr/jWDnvoEa8Hztpqpu3i9C+LimiY6XKVxNLafOq3D/YdPLG3Q6o VsNAtUXDh416FT+BcGnsf6MSit+uVeYQbjwMrWUC/qf3uP8xJbDWuW2a5Rh0V0JqNc3K 33mE3NkyqaXeL9qZyZo2uqF+/ZwVxB9KIeABf4MBJi0rV0I6zXjcM92bChpq5Ale0HC7 aDMXNi4IQcHMHxDdMxlxwD75GURccDKqUYpB8oOrDc2uJ9z2jZYEhX3zTisf7PMriojV eiZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vjDc9dgY; 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 l25-20020a0c9799000000b006a05aecd931si13882548qvd.133.2024.04.24.17.01.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:01:50 -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=vjDc9dgY; 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 1rzmYI-0008QK-8p; Wed, 24 Apr 2024 20:01:26 -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 1rzmXo-0008GD-Ju for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:57 -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 1rzmXk-0006Gr-2H for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:54 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1e4f341330fso4000355ad.0 for ; Wed, 24 Apr 2024 17:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003250; x=1714608050; 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=CtiaqvwuVu2PCvk8ws+dlqlBGpei7mPxycYtflKdoaA=; b=vjDc9dgYkt9Syyp8O9u7Xc8u6Fi4OPPp98TicdCcVNL+Prw2O5WzGdyD8/v5iznX2h CAezVcRTS/fOewYOeX/ZnWXGr9/T6BKxyYzMKrA0P/IdsaUjxGARynPz+0DffhilGMiW kIRQ6c7JdxCb+aLv7nC1BVgamaSum7soIqi6Wkkq2N/pXDA4XIRXKR6cqSBENVCmVaf0 iYfAo0jww2wfjlEEwVHCuDZPapc8FmbbgvScaBnQxB6cHTfs66w2mHSgAscZRaScKcpr vXh1Nwup6XanU2BqL8WRAPHr/LD7wM9sJ87aOCcSuGs2gOwLkCB1tgUL0c5KLS7B0j/K aOLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003250; x=1714608050; 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=CtiaqvwuVu2PCvk8ws+dlqlBGpei7mPxycYtflKdoaA=; b=X9OXepqq/S0ruPS2z4tK5g03PcZLxWmdmU/xvv6vEmiQlY9bzq+zV2bA6pCXnadxGN xwaTDdwpuWLKbGQFkZnJP+xaP5izHPWXXBsqsNN8oFeBNR3Kx/pXSUbIbgCMaLgO7X2Z 6jp18HllI3hkCHJeWmo9L/prAi/4lmhMV3Q3BWDH9/XX00Cv6r7C3otZb4Ih91E4zayJ 4tzIfyffDcWSB8xDGpk06xFwwXUQ3wcHo1w0CA1MmSem++EnCAEwoEibljABNWfTuLG6 f7Xy1lu6owiSYjrUkrjXXWpWYRWLDOT5uHoVGwXW/YlyoHw6+G2dptAhqxpg1rZ74EPX 0rGA== X-Gm-Message-State: AOJu0YwKp4Q356B54DBz+qNrddqSh3mYjfkoSWKacfI0RdWDRq2zOUWL 6C87Z87n4GOzwjKBSulqjlFR2f8cqoqPJnxMpgSBFE36YlKTP0RgiVX9yijR45LJvosF34js8A1 G X-Received: by 2002:a17:902:ba93:b0:1e4:7adf:b85d with SMTP id k19-20020a170902ba9300b001e47adfb85dmr3604361pls.17.1714003249957; Wed, 24 Apr 2024 17:00:49 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 25/45] target/hppa: Use registerfields.h for FPSR Date: Wed, 24 Apr 2024 17:00:03 -0700 Message-Id: <20240425000023.1002026-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Define all of the context dependent field definitions. Use FIELD_EX32 and FIELD_DP32 with named fields instead of extract32 and deposit32 with raw constants. Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 25 +++++++++++++++++++++++++ target/hppa/fpu_helper.c | 26 +++++++++++++------------- target/hppa/translate.c | 18 ++++++++---------- 3 files changed, 46 insertions(+), 23 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 01dc8781a5..c0da9e9af6 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -24,6 +24,7 @@ #include "exec/cpu-defs.h" #include "qemu/cpu-float.h" #include "qemu/interval-tree.h" +#include "hw/registerfields.h" /* PA-RISC 1.x processors have a strong memory model. */ /* ??? While we do not yet implement PA-RISC 2.0, those processors have @@ -158,6 +159,30 @@ #define CR_IPSW 22 #define CR_EIRR 23 +FIELD(FPSR, ENA_I, 0, 1) +FIELD(FPSR, ENA_U, 1, 1) +FIELD(FPSR, ENA_O, 2, 1) +FIELD(FPSR, ENA_Z, 3, 1) +FIELD(FPSR, ENA_V, 4, 1) +FIELD(FPSR, ENABLES, 0, 5) +FIELD(FPSR, D, 5, 1) +FIELD(FPSR, T, 6, 1) +FIELD(FPSR, RM, 9, 2) +FIELD(FPSR, CQ, 11, 11) +FIELD(FPSR, CQ0_6, 15, 7) +FIELD(FPSR, CQ0_4, 17, 5) +FIELD(FPSR, CQ0_2, 19, 3) +FIELD(FPSR, CQ0, 21, 1) +FIELD(FPSR, CA, 15, 7) +FIELD(FPSR, CA0, 21, 1) +FIELD(FPSR, C, 26, 1) +FIELD(FPSR, FLG_I, 27, 1) +FIELD(FPSR, FLG_U, 28, 1) +FIELD(FPSR, FLG_O, 29, 1) +FIELD(FPSR, FLG_Z, 30, 1) +FIELD(FPSR, FLG_V, 31, 1) +FIELD(FPSR, FLAGS, 27, 5) + typedef struct HPPATLBEntry { union { IntervalTreeNode itree; diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c index 576f283b04..deaed2b65d 100644 --- a/target/hppa/fpu_helper.c +++ b/target/hppa/fpu_helper.c @@ -30,7 +30,7 @@ void HELPER(loaded_fr0)(CPUHPPAState *env) env->fr0_shadow = shadow; - switch (extract32(shadow, 9, 2)) { + switch (FIELD_EX32(shadow, FPSR, RM)) { default: rm = float_round_nearest_even; break; @@ -46,7 +46,7 @@ void HELPER(loaded_fr0)(CPUHPPAState *env) } set_float_rounding_mode(rm, &env->fp_status); - d = extract32(shadow, 5, 1); + d = FIELD_EX32(shadow, FPSR, D); set_flush_to_zero(d, &env->fp_status); set_flush_inputs_to_zero(d, &env->fp_status); } @@ -57,7 +57,7 @@ void cpu_hppa_loaded_fr0(CPUHPPAState *env) } #define CONVERT_BIT(X, SRC, DST) \ - ((SRC) > (DST) \ + ((unsigned)(SRC) > (unsigned)(DST) \ ? (X) / ((SRC) / (DST)) & (DST) \ : ((X) & (SRC)) * ((DST) / (SRC))) @@ -73,12 +73,12 @@ static void update_fr0_op(CPUHPPAState *env, uintptr_t ra) } set_float_exception_flags(0, &env->fp_status); - hard_exp |= CONVERT_BIT(soft_exp, float_flag_inexact, 1u << 0); - hard_exp |= CONVERT_BIT(soft_exp, float_flag_underflow, 1u << 1); - hard_exp |= CONVERT_BIT(soft_exp, float_flag_overflow, 1u << 2); - hard_exp |= CONVERT_BIT(soft_exp, float_flag_divbyzero, 1u << 3); - hard_exp |= CONVERT_BIT(soft_exp, float_flag_invalid, 1u << 4); - shadow |= hard_exp << (32 - 5); + hard_exp |= CONVERT_BIT(soft_exp, float_flag_inexact, R_FPSR_ENA_I_MASK); + hard_exp |= CONVERT_BIT(soft_exp, float_flag_underflow, R_FPSR_ENA_U_MASK); + hard_exp |= CONVERT_BIT(soft_exp, float_flag_overflow, R_FPSR_ENA_O_MASK); + hard_exp |= CONVERT_BIT(soft_exp, float_flag_divbyzero, R_FPSR_ENA_Z_MASK); + hard_exp |= CONVERT_BIT(soft_exp, float_flag_invalid, R_FPSR_ENA_V_MASK); + shadow |= hard_exp << (R_FPSR_FLAGS_SHIFT - R_FPSR_ENABLES_SHIFT); env->fr0_shadow = shadow; env->fr[0] = (uint64_t)shadow << 32; @@ -378,15 +378,15 @@ static void update_fr0_cmp(CPUHPPAState *env, uint32_t y, if (y) { /* targeted comparison */ /* set fpsr[ca[y - 1]] to current compare */ - shadow = deposit32(shadow, 21 - (y - 1), 1, c); + shadow = deposit32(shadow, R_FPSR_CA0_SHIFT - (y - 1), 1, c); } else { /* queued comparison */ /* shift cq right by one place */ - shadow = deposit32(shadow, 11, 10, extract32(shadow, 12, 10)); + shadow = (shadow & ~R_FPSR_CQ_MASK) | ((shadow >> 1) & R_FPSR_CQ_MASK); /* move fpsr[c] to fpsr[cq[0]] */ - shadow = deposit32(shadow, 21, 1, extract32(shadow, 26, 1)); + shadow = FIELD_DP32(shadow, FPSR, CQ0, FIELD_EX32(shadow, FPSR, C)); /* set fpsr[c] to current compare */ - shadow = deposit32(shadow, 26, 1, c); + shadow = FIELD_DP32(shadow, FPSR, C, c); } env->fr0_shadow = shadow; diff --git a/target/hppa/translate.c b/target/hppa/translate.c index c996eb9823..4b9092b1cf 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4322,29 +4322,28 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a) switch (a->c) { case 0: /* simple */ - tcg_gen_andi_i64(t, t, 0x4000000); - ctx->null_cond = cond_make_ti(TCG_COND_NE, t, 0); - goto done; + mask = R_FPSR_C_MASK; + break; case 2: /* rej */ inv = true; /* fallthru */ case 1: /* acc */ - mask = 0x43ff800; + mask = R_FPSR_C_MASK | R_FPSR_CQ_MASK; break; case 6: /* rej8 */ inv = true; /* fallthru */ case 5: /* acc8 */ - mask = 0x43f8000; + mask = R_FPSR_C_MASK | R_FPSR_CQ0_6_MASK; break; case 9: /* acc6 */ - mask = 0x43e0000; + mask = R_FPSR_C_MASK | R_FPSR_CQ0_4_MASK; break; case 13: /* acc4 */ - mask = 0x4380000; + mask = R_FPSR_C_MASK | R_FPSR_CQ0_2_MASK; break; case 17: /* acc2 */ - mask = 0x4200000; + mask = R_FPSR_C_MASK | R_FPSR_CQ0_MASK; break; default: gen_illegal(ctx); @@ -4361,11 +4360,10 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a) } else { unsigned cbit = (a->y ^ 1) - 1; - tcg_gen_extract_i64(t, t, 21 - cbit, 1); + tcg_gen_extract_i64(t, t, R_FPSR_CA0_SHIFT - cbit, 1); ctx->null_cond = cond_make_ti(TCG_COND_NE, t, 0); } - done: return nullify_end(ctx); } From patchwork Thu Apr 25 00:00:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791767 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118253wrq; Wed, 24 Apr 2024 17:08:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXo5SdQYAVClgfl9k4+86lSTEmCsokdT+WZyX7F6Y3S8PKKawp8yaano0Besyxu/0G/f9W8PGcZifHT8KBywIYC X-Google-Smtp-Source: AGHT+IFAk6KWJP/JOJqTJQkYsIqOy4rPSH/bXA+tlg1kg1zYbW+UHWlles4KHbCak+CyRDcHCLOT X-Received: by 2002:a05:620a:221b:b0:790:888e:4d4d with SMTP id m27-20020a05620a221b00b00790888e4d4dmr4326012qkh.39.1714003699164; Wed, 24 Apr 2024 17:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003699; cv=none; d=google.com; s=arc-20160816; b=Bf9ZEKFxIcoBX/E5YpOj7m9gX47XEHFtgrb5MJriTwqZhpLOX5yqKZoUPH3ZqnAOUS qvzgc8SOuSu/++iaT6SLeIxUAtzURiqDmcfjR9YxUGOoA5tq4GYfm8uQarkwTPKMh1d2 79WYTOxpQwrmkWi1OTmbm/K4jWTKS/yxl9n+B4oiCZO/nyQ1ILWMrwjICra1UvUhuDVA UgZVzpnAZqCd47su4RT6pm9UWemXhEqrIuu4siEwMdDX98VejMMfs+Xkx8qDagpAMF+a EXiOgokaBFl6XY7YoOe+G8IdVIppCl/nWiqm35BieEGXCBR4O/rYbaku88RbN2U0XjGE 0ysw== 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=4k0GmsyyHp6l3HUJNBVWsFzARFivg/eO6L4ms+jh8b8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lov9oMh8shllXOuR8bHxz+jmBwIyn3QZG5IabiviaxaFWo+T0XVIHWD2z+kykg7Kq7 nXr5lbfMwYD8lxMFIOSKCU0v7QWzEx3KQnIFuqRCCF4rRCiXiMJzab2V+kmtLn4Ubxln O+y5F7ACNC2SU6tSZUq0HrZp0i7m27ofDVQJ48dkmDgjk1f29S5vOFA15ZNWkuoAN0rY 4chSoA4PE25xzyVPXw4zUuLKcr9VmVWp3olOdO5FICsuFnACfgmHC1Fb0vlexc1tlMNe QbwWiCO8Rk7Nga+0H6l+mVyn//FKbqWjMgMZ8B2kBkKL2ghb0eo358hubOpx53wqQVR1 n7nA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j4XeJnoD; 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 yf16-20020a05620a3bd000b0078ee017ea1asi15917303qkn.245.2024.04.24.17.08.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j4XeJnoD; 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 1rzmYH-0008QE-J4; Wed, 24 Apr 2024 20:01:25 -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 1rzmXp-0008GN-HS for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:59 -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 1rzmXl-0006H2-4x for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:55 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e5c7d087e1so3726065ad.0 for ; Wed, 24 Apr 2024 17:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003251; x=1714608051; 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=4k0GmsyyHp6l3HUJNBVWsFzARFivg/eO6L4ms+jh8b8=; b=j4XeJnoD6M1UWKM7m0qL3RCEe3oci08ZtWbD4LjBc4nE8ygTkFyJv14+Ze5ZWwVdXs cYS+sfL4dOJlLpELCUYAbdkL1YcckahcJe0NPRQIGB6mQFQ4Q9fK2+6fl91XwiLg/X5a mOZUJslemo4s5zSdv18WV2prDICGvDZjtSsmumgSmxOirvcbKYem/NzYdXQNZvo4XfTB nKK4t/Ve0sI6lFdQxvm5DYhomwpp5ZcnkZRSjipyZhbcVRv5tCL1v3pQYsQqqnLg2iRm zZl+TuWigG2ovqcCtfvkROasAW3kktX3cH0MZ5IBRbFLr7Nya00snmUVOjvWWZYJx/ti 32ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003251; x=1714608051; 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=4k0GmsyyHp6l3HUJNBVWsFzARFivg/eO6L4ms+jh8b8=; b=o6DkeLB5SIfUNwps3CFfAa8Geq03yKL6imbLQdc/j16GYZufbzSZv0KzkvpyYuvAaw QuAO0aTQkHDAOhAqPp0WdmYYLBt05b2dPXO50m9r27mg2JF4LW072n3IAKSgqgD75R3i xORmfXCS5zTbc51dVTEuujXveoOuBdX5AYiy35488f/t2r2vOaLy4DZGO+VfxHQ76Y6a Im7/qV/5sayERRnX43SmonuWfjXL8ZVBRmT0w4fnyZlC/NN6gAIaKw9GdxdnLbZGVKlI OFQaBtj77BFbOWniPFhhjY7THIvwjLgehTU/ilELzW0CQtMU2J5qctA5VN6w4gMmWKKl Lk3g== X-Gm-Message-State: AOJu0YzvwkVGOT2OJYFjdOhzvGRuxAi6f0MgqcRHqFfvyu2sEpPfIB9p SBG3iXNtHF3k8i7Wdv5P+YxsvEkwL/zRQ9SDmttwrCoZByVFLgRHY/DD4uHL6dmia75h5u+bFRH m X-Received: by 2002:a17:903:2b03:b0:1e0:e85b:b9ca with SMTP id mc3-20020a1709032b0300b001e0e85bb9camr5949473plb.21.1714003250919; Wed, 24 Apr 2024 17:00:50 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 26/45] target/hppa: Use TCG_COND_TST* in trans_ftest Date: Wed, 24 Apr 2024 17:00:04 -0700 Message-Id: <20240425000023.1002026-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/hppa/translate.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 4b9092b1cf..b1311e7688 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4309,6 +4309,8 @@ static bool trans_fcmp_d(DisasContext *ctx, arg_fclass2 *a) static bool trans_ftest(DisasContext *ctx, arg_ftest *a) { + TCGCond tc = TCG_COND_TSTNE; + uint32_t mask; TCGv_i64 t; nullify_over(ctx); @@ -4317,21 +4319,18 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a) tcg_gen_ld32u_i64(t, tcg_env, offsetof(CPUHPPAState, fr0_shadow)); if (a->y == 1) { - int mask; - bool inv = false; - switch (a->c) { case 0: /* simple */ mask = R_FPSR_C_MASK; break; case 2: /* rej */ - inv = true; + tc = TCG_COND_TSTEQ; /* fallthru */ case 1: /* acc */ mask = R_FPSR_C_MASK | R_FPSR_CQ_MASK; break; case 6: /* rej8 */ - inv = true; + tc = TCG_COND_TSTEQ; /* fallthru */ case 5: /* acc8 */ mask = R_FPSR_C_MASK | R_FPSR_CQ0_6_MASK; @@ -4349,21 +4348,12 @@ static bool trans_ftest(DisasContext *ctx, arg_ftest *a) gen_illegal(ctx); return true; } - if (inv) { - TCGv_i64 c = tcg_constant_i64(mask); - tcg_gen_or_i64(t, t, c); - ctx->null_cond = cond_make_tt(TCG_COND_EQ, t, c); - } else { - tcg_gen_andi_i64(t, t, mask); - ctx->null_cond = cond_make_ti(TCG_COND_EQ, t, 0); - } } else { unsigned cbit = (a->y ^ 1) - 1; - - tcg_gen_extract_i64(t, t, R_FPSR_CA0_SHIFT - cbit, 1); - ctx->null_cond = cond_make_ti(TCG_COND_NE, t, 0); + mask = R_FPSR_CA0_MASK >> cbit; } + ctx->null_cond = cond_make_ti(tc, t, mask); return nullify_end(ctx); } From patchwork Thu Apr 25 00:00:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791777 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119064wrq; Wed, 24 Apr 2024 17:10:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWk0MUm7Al5kaZG8ojxIoqsifvaAYNN2ImHP9yO0+OsMK4Zx1hWHYt2ffUkpNQTmzR8PB7IfNpbQ0z4g0qPsPGz X-Google-Smtp-Source: AGHT+IGZ61fZUm2n29MEgxxFFM/GaIsLu45o19nXmxpr+1jw25ZoOBbrNiljc7DiaJ4l2N1BPwEr X-Received: by 2002:a05:620a:8419:b0:78f:6bd:15d3 with SMTP id pc25-20020a05620a841900b0078f06bd15d3mr2068035qkn.21.1714003826793; Wed, 24 Apr 2024 17:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003826; cv=none; d=google.com; s=arc-20160816; b=jV7Plf4sniBCmGxJ1jEVbK2C4CjV4U5ZL7rl+RzAbFutAy506GOnMoF2UwS01fwMLN 5gMpoPCItJdzMkmray9LidRBqqTqBVwTXlh8gQ1/Cn0g0rUYSg1RWI/bCUdXWKt50ysj 2dA2HhbnDDmfhKFJvbScRzsXt1XR1Bn/0rn1SHvqgtUDIpAM+iWCAHBLrLh9ruxLBvU9 0NRiqmLbg0J70PJy8oc6AX0g7/Hry6QlqIq0IWoAp+QzAxYGvrI0WD1iGGQ709AXXnud Ij0Ni9xgsSiE+4C14HrDI2f80FidEkJ9S3tx4QnIK2GXq//A6dG62xBtbMPOpCrw1a42 kXOg== 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=NElphlnk4Z3YIuGs04YkM9tIzOkRH6mwVuLwvHi0tB8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=qbK71Cak2mvGrynR/oEf3VtRHhddlPJ+zyA/6ZdiAUpgzePUGJ/cBCjF23ykBSXGNm f8A/qa29hpOsnTymHPaGiD2R25Z7f7tkkpZbg/sDBVBq4FbsAlJne+Qw4uPx/FYmQguB o+dgBoJlelvKFJp7JHf+a6VMykQIgGrQrBJ6iF+HrdqF6KuXKe9wHwtSG7WbCiaw30hR hu6iHuOg0tpsXI5egGn/Pc9Yu4x6fgU1Bn1ROPgx3GEf9Z1zje2Ww4MZZxiNGeDq++LC vYInrsnJvmhLEJ9qJ9COu7z/RaQw/b54fEf+AGJxXHpjODW4u4rpqOCFP3SNCmIch9ru x4Lw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RO2zMKvm; 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 b27-20020a05620a089b00b0078f1be43df0si13721993qka.188.2024.04.24.17.10.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10: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=RO2zMKvm; 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 1rzmY6-0008Ng-Us; Wed, 24 Apr 2024 20:01:14 -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 1rzmXr-0008Gc-6N for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:01 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXm-0006HX-0H for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:56 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e2c725e234so12376375ad.1 for ; Wed, 24 Apr 2024 17:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003252; x=1714608052; 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=NElphlnk4Z3YIuGs04YkM9tIzOkRH6mwVuLwvHi0tB8=; b=RO2zMKvm7Z/8DvuXID/F6UoPRvsfz36xcvFhgr5pfxahJ2v25WZxscO3M8GuOylzks qKZzbKUCtlJOw+v8ekpATMTUXtCPtQkirLM86aOrBPoyPcH8Q+4IV6Iq2ffvNiehuS59 qruWmzfysEwsWRkhYqV60wk0OjfCy69EcIFm1vITI0/rTkZ+GfFxMllLufs/bZ3NXbXl FArjM/zF3+E2/RgBc+ijso1a2ALzKEYyPW2tblwy3+5QNkVyQ0rWkrPcoaF/k3sWrVnf +PmDTjIG9mXIV2a7xz90M8ivh0rI3989OKsFemOdRBQ6ovMQ50UeF00GqxMLIocuZrqJ fsAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003252; x=1714608052; 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=NElphlnk4Z3YIuGs04YkM9tIzOkRH6mwVuLwvHi0tB8=; b=FlCQPEfXSXdyXuiKBhrNFIITcp9rLivjtNJOqQkiIfkyhz8RrF5VdO0c1lpSjWPFpd WxiRaf4iGNca0C3XprZ2zbo59N6jNoF9K0Pykcsid7H+UFcUJC8u0Xi8NA2GzOgLYqJb WoDaa03k+nulnsyqzH6KeToVEkepl0URvVZ28bGM9srrPmM0ZUuqc1CLdE+2ppymBFD8 9y/g2p1Bdts/DywRouZMkLGvyzYwE8NFTCGxO3WriqplpICipsdirAwJ5su8DtBaDNzn jkQu/deV5VQmKZAmDxQoLXjTpr4Ztl77CL3lB/XDM+pTX7GakzGXtwZ9s6ZqBLd+LCUC cKRg== X-Gm-Message-State: AOJu0YzJlE28ahSB/IkDkrHcJeX5MdOw3zn4bd6A3dmnCvAT3DiNnbY/ HTuFa/nqV9uNuLasuuZsBhACRXCfJjEIguRtV3VhDfV9B3wBwkC3q4Yp56xgiTyWYySRROWCAXM 5 X-Received: by 2002:a17:903:41c6:b0:1e8:8aa2:2ded with SMTP id u6-20020a17090341c600b001e88aa22dedmr1900279ple.13.1714003251810; Wed, 24 Apr 2024 17:00:51 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 27/45] target/hppa: Remove cond_free Date: Wed, 24 Apr 2024 17:00:05 -0700 Message-Id: <20240425000023.1002026-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 Now that we do not need to free tcg temporaries, the only thing cond_free does is reset the condition to never. Instead, simply write a new condition over the old, which may be simply cond_make_f() for the never condition. The do_*_cond functions do the right thing with c or cf == 0, so there's no need for a special case anymore. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 102 +++++++++++----------------------------- 1 file changed, 27 insertions(+), 75 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index b1311e7688..5714e2ad25 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -372,21 +372,6 @@ static DisasCond cond_make_vv(TCGCond c, TCGv_i64 a0, TCGv_i64 a1) return cond_make_tt(c, t0, t1); } -static void cond_free(DisasCond *cond) -{ - switch (cond->c) { - default: - cond->a0 = NULL; - cond->a1 = NULL; - /* fallthru */ - case TCG_COND_ALWAYS: - cond->c = TCG_COND_NEVER; - break; - case TCG_COND_NEVER: - break; - } -} - static TCGv_i64 load_gpr(DisasContext *ctx, unsigned reg) { if (reg == 0) { @@ -536,7 +521,7 @@ static void nullify_over(DisasContext *ctx) tcg_gen_brcond_i64(ctx->null_cond.c, ctx->null_cond.a0, ctx->null_cond.a1, ctx->null_lab); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); } } @@ -554,7 +539,7 @@ static void nullify_save(DisasContext *ctx) ctx->null_cond.a0, ctx->null_cond.a1); ctx->psw_n_nonzero = true; } - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); } /* Set a PSW[N] to X. The intention is that this is used immediately @@ -1164,7 +1149,6 @@ static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 orig_in1, save_gpr(ctx, rt, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); ctx->null_cond = cond; } @@ -1261,7 +1245,6 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, save_gpr(ctx, rt, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); ctx->null_cond = cond; } @@ -1316,7 +1299,6 @@ static void do_cmpclr(DisasContext *ctx, unsigned rt, TCGv_i64 in1, save_gpr(ctx, rt, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); ctx->null_cond = cond; } @@ -1331,10 +1313,7 @@ static void do_log(DisasContext *ctx, unsigned rt, TCGv_i64 in1, save_gpr(ctx, rt, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (cf) { - ctx->null_cond = do_log_cond(ctx, cf, d, dest); - } + ctx->null_cond = do_log_cond(ctx, cf, d, dest); } static bool do_log_reg(DisasContext *ctx, arg_rrr_cf_d *a, @@ -1429,7 +1408,6 @@ static void do_unit_addsub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, } save_gpr(ctx, rt, dest); - cond_free(&ctx->null_cond); ctx->null_cond = cond; } @@ -1852,7 +1830,6 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, taken = gen_new_label(); tcg_gen_brcond_i64(c, cond->a0, cond->a1, taken); - cond_free(cond); /* Not taken: Condition not satisfied; nullify on backward branches. */ n = is_n && disp < 0; @@ -2034,7 +2011,7 @@ static void do_page_zero(DisasContext *ctx) static bool trans_nop(DisasContext *ctx, arg_nop *a) { - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2048,7 +2025,7 @@ static bool trans_sync(DisasContext *ctx, arg_sync *a) /* No point in nullifying the memory barrier. */ tcg_gen_mb(TCG_BAR_SC | TCG_MO_ALL); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2060,7 +2037,7 @@ static bool trans_mfia(DisasContext *ctx, arg_mfia *a) tcg_gen_andi_i64(dest, dest, -4); save_gpr(ctx, a->t, dest); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2075,7 +2052,7 @@ static bool trans_mfsp(DisasContext *ctx, arg_mfsp *a) save_gpr(ctx, rt, t0); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2120,7 +2097,7 @@ static bool trans_mfctl(DisasContext *ctx, arg_mfctl *a) save_gpr(ctx, rt, tmp); done: - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2160,7 +2137,7 @@ static bool trans_mtctl(DisasContext *ctx, arg_mtctl *a) tcg_gen_andi_i64(tmp, reg, ctx->is_pa20 ? 63 : 31); save_or_nullify(ctx, cpu_sar, tmp); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2234,7 +2211,7 @@ static bool trans_mtsarcm(DisasContext *ctx, arg_mtsarcm *a) tcg_gen_andi_i64(tmp, tmp, ctx->is_pa20 ? 63 : 31); save_or_nullify(ctx, cpu_sar, tmp); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2251,7 +2228,7 @@ static bool trans_ldsid(DisasContext *ctx, arg_ldsid *a) #endif save_gpr(ctx, a->t, dest); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2413,7 +2390,7 @@ static bool trans_nop_addrx(DisasContext *ctx, arg_ldst *a) tcg_gen_add_i64(dest, src1, src2); save_gpr(ctx, a->b, dest); } - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2655,7 +2632,7 @@ static bool trans_lci(DisasContext *ctx, arg_lci *a) since the entire address space is coherent. */ save_gpr(ctx, a->t, ctx->zero); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -2732,7 +2709,7 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf_d *a) unsigned rt = a->t; if (rt == 0) { /* NOP */ - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } if (r2 == 0) { /* COPY */ @@ -2743,7 +2720,7 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf_d *a) } else { save_gpr(ctx, rt, cpu_gr[r1]); } - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } #ifndef CONFIG_USER_ONLY @@ -2808,11 +2785,7 @@ static bool trans_uxor(DisasContext *ctx, arg_rrr_cf_d *a) tcg_gen_xor_i64(dest, tcg_r1, tcg_r2); save_gpr(ctx, a->t, dest); - cond_free(&ctx->null_cond); - if (a->cf) { - ctx->null_cond = do_unit_zero_cond(a->cf, a->d, dest); - } - + ctx->null_cond = do_unit_zero_cond(a->cf, a->d, dest); return nullify_end(ctx); } @@ -2838,7 +2811,7 @@ static bool do_uaddcm(DisasContext *ctx, arg_rrr_cf_d *a, bool is_tc) tcg_gen_subi_i64(tmp, tmp, 1); } save_gpr(ctx, a->t, tmp); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -3364,7 +3337,7 @@ static bool trans_ldil(DisasContext *ctx, arg_ldil *a) tcg_gen_movi_i64(tcg_rt, a->i); save_gpr(ctx, a->t, tcg_rt); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -3375,7 +3348,7 @@ static bool trans_addil(DisasContext *ctx, arg_addil *a) tcg_gen_addi_i64(tcg_r1, tcg_rt, a->i); save_gpr(ctx, 1, tcg_r1); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -3391,7 +3364,7 @@ static bool trans_ldo(DisasContext *ctx, arg_ldo *a) tcg_gen_addi_i64(tcg_rt, cpu_gr[a->b], a->i); } save_gpr(ctx, a->t, tcg_rt); - cond_free(&ctx->null_cond); + ctx->null_cond = cond_make_f(); return true; } @@ -3617,10 +3590,7 @@ static bool trans_shrp_sar(DisasContext *ctx, arg_shrp_sar *a) save_gpr(ctx, a->t, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); - } + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); return nullify_end(ctx); } @@ -3660,10 +3630,7 @@ static bool trans_shrp_imm(DisasContext *ctx, arg_shrp_imm *a) save_gpr(ctx, a->t, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); - } + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); return nullify_end(ctx); } @@ -3705,10 +3672,7 @@ static bool trans_extr_sar(DisasContext *ctx, arg_extr_sar *a) save_gpr(ctx, a->t, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); - } + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); return nullify_end(ctx); } @@ -3741,10 +3705,7 @@ static bool trans_extr_imm(DisasContext *ctx, arg_extr_imm *a) save_gpr(ctx, a->t, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); - } + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); return nullify_end(ctx); } @@ -3781,10 +3742,7 @@ static bool trans_depi_imm(DisasContext *ctx, arg_depi_imm *a) save_gpr(ctx, a->t, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); - } + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); return nullify_end(ctx); } @@ -3817,10 +3775,7 @@ static bool trans_dep_imm(DisasContext *ctx, arg_dep_imm *a) save_gpr(ctx, a->t, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (a->c) { - ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); - } + ctx->null_cond = do_sed_cond(ctx, a->c, a->d, dest); return nullify_end(ctx); } @@ -3854,10 +3809,7 @@ static bool do_dep_sar(DisasContext *ctx, unsigned rt, unsigned c, save_gpr(ctx, rt, dest); /* Install the new nullification. */ - cond_free(&ctx->null_cond); - if (c) { - ctx->null_cond = do_sed_cond(ctx, c, d, dest); - } + ctx->null_cond = do_sed_cond(ctx, c, d, dest); return nullify_end(ctx); } From patchwork Thu Apr 25 00:00:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791775 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118524wrq; Wed, 24 Apr 2024 17:08:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/iYLqPZobYgwEgWgjYea8hSCumZuqAB0JUWgYwQI++XbBGE8p8PJtW46sF2dC+Rh2+pjIWhj/0DtRNaBvPw3d X-Google-Smtp-Source: AGHT+IGsLz3URvbd4JDChvOPjAePNL58xH3Mdz+9ZrG5FyS667H5fjKhBSurtq51c4vJkbddYJYT X-Received: by 2002:a05:6102:4c4a:b0:47b:9290:f903 with SMTP id jz10-20020a0561024c4a00b0047b9290f903mr3433367vsb.35.1714003735570; Wed, 24 Apr 2024 17:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003735; cv=none; d=google.com; s=arc-20160816; b=tVzXQpm8ycHAVH3IbupBEvlkzzEMi8O172AKGmxwBUU58QjoJmW16pPIQLYiy5M7PQ d0Jlv4DnNSUGzXotoKCtiQ4KkKi/JlsQAsD7v1g7OKkujCEziJ9aeATLFhLc3vvlsVr7 E6LNH43tueYTu55DBtJkaj2D/sRXH0NVvcZboIehbRol1zy2fGL1wFOqVKe+UrEYtFSq gpZy/ZhVzF5Bfemlh+pRBoDkPNHx6FahayX8Nm3tAkxMFDMxkIUVom9rIUNMC13SRVpK kpw8S71ggBtGGkbEauWhgTGCCXJQqu9efTLoEsnUR0WXx6ITg2x7DX/r2coznjSinD6A zOyA== 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=DDHWgjyo2VgO58BUrIJ7Ba+V+lHv8+24gGeXKyuyNL0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=g9k/sfqWmho3U6JGhNBUELZE0zMdBjLz3K/G10i4q6Fum++7d/TK4D40EG5iZjhtY7 b8CSX+weVPWAS6eV1lvUC5AaJH7AU1fGZk53opDNuY9dsrfIlIwSKCA6AQxJ8MPtb+XO hzh+za9e+vfA85Ias9iXLRWjj7Nwsi7luD0WUA1U05FDEqcx2L9gzQUWnY/9gJyVwZaa vr31cO6ziTIwIYlpoE1jUaoib1mE41SLNh4S9ZDdX+jteQOsB8w/Dr5A7lWfeTdbGWPh qtDt2seTBOvTxnBz5vWBs6QSBUT5C4nSW4hTXRIGBZkmorQayJ+cTTmIrhwN4k/uB0uZ BYjQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCit2llK; 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 t8-20020ac85888000000b0043a4b79a579si52254qta.239.2024.04.24.17.08.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:55 -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=YCit2llK; 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 1rzmY6-0008N4-1T; Wed, 24 Apr 2024 20:01:14 -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 1rzmXr-0008Gd-5p for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:01 -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 1rzmXm-0006Hf-Dl for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:56 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1e411e339b8so3317675ad.3 for ; Wed, 24 Apr 2024 17:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003252; x=1714608052; 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=DDHWgjyo2VgO58BUrIJ7Ba+V+lHv8+24gGeXKyuyNL0=; b=YCit2llKLxzQiFLcSNb7ru0TGYXwfrEFFBO5Bq7BXgDo5SeH4o5siqPHZZgI1WK9A8 98v/A6lgK2c5SYWWg5VwLHWmBswnv0lB0A1/RqBoC8zUFmQjWV3AxxUWwq8gguv3fmWw j7BmHkH2D9rvyCwPIklyeLDpUYLR6eQsLw+JDfQ7gBewiUjA7cmviWLckDmGPr1z+FNo G7mVLGUgtNhdiKsU3IrRMLaFtRLpFmJgtIlYc+/dWYZL/JdcCjapB0MNhjeDc+CZAu37 pSqagb9k3FcNfg5RtvZ/Fha3YvCHRkn6zuPHwV5ZGdES0SIs2VnKeXHWL6Yk9jWHAddw 01/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003252; x=1714608052; 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=DDHWgjyo2VgO58BUrIJ7Ba+V+lHv8+24gGeXKyuyNL0=; b=vKHQvgSJsDDZpFXsgsF/Wtl1lL5/+IERMYc5q2ifFdtPbbnN5CAzSp4Y0G2aDSGD/p 7zLc2rlvLNiBhTDtsfVxV+EW5UZyN4EKc5T/PBoSfQYCS/vehTergE3aeC4QEX+pUZ+O SFRhxItLwhYv7RlEYACeN8Q7xwqtr2SJM8KWds4xLrT+OoG/0xJUXXS4vdLE8yoBfVow H2QFimVrib6ph8YnxItF6cUy8gIOCycSgYw/x5bZ9NQBhnrFTxdhVl+91DusmEmxg3qy 23+ekA61s+E1SrzxzxiNoZm/SjBPTzbrB//ps6zc2nrbkVFOE4EUi2c7tyP0TsQRADY/ JwVg== X-Gm-Message-State: AOJu0Ywpiymn5syU6zWpDuSpbYmuWKb5MuDkxTRFiUDuHbxKIwm/RawN 9SYpICoz/yvZ5hZaREmH+rUPUXialUWEhXJul92heXeocOB3qcTY2BNTaHBkXXdo6haHGNbcvld a X-Received: by 2002:a17:902:d2c2:b0:1e2:bdfa:9c15 with SMTP id n2-20020a170902d2c200b001e2bdfa9c15mr5383672plc.41.1714003252613; Wed, 24 Apr 2024 17:00:52 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 28/45] target/hppa: Introduce DisasDelayException Date: Wed, 24 Apr 2024 17:00:06 -0700 Message-Id: <20240425000023.1002026-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Allow an exception to be emitted at the end of the TranslationBlock, leaving only the conditional branch inline. Use it for simple exception instructions like break, which happen to be nullified. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 60 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 5714e2ad25..7a92901e18 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -50,6 +50,17 @@ typedef struct DisasIAQE { int64_t disp; } DisasIAQE; +typedef struct DisasDelayException { + struct DisasDelayException *next; + TCGLabel *lab; + uint32_t insn; + bool set_iir; + int8_t set_n; + uint8_t excp; + /* Saved state at parent insn. */ + DisasIAQE iaq_f, iaq_b; +} DisasDelayException; + typedef struct DisasContext { DisasContextBase base; CPUState *cs; @@ -65,6 +76,7 @@ typedef struct DisasContext { DisasCond null_cond; TCGLabel *null_lab; + DisasDelayException *delay_excp_list; TCGv_i64 zero; uint32_t insn; @@ -682,13 +694,38 @@ static void gen_excp(DisasContext *ctx, int exception) ctx->base.is_jmp = DISAS_NORETURN; } +static DisasDelayException *delay_excp(DisasContext *ctx, uint8_t excp) +{ + DisasDelayException *e = tcg_malloc(sizeof(DisasDelayException)); + + memset(e, 0, sizeof(*e)); + e->next = ctx->delay_excp_list; + ctx->delay_excp_list = e; + + e->lab = gen_new_label(); + e->insn = ctx->insn; + e->set_iir = true; + e->set_n = ctx->psw_n_nonzero ? 0 : -1; + e->excp = excp; + e->iaq_f = ctx->iaq_f; + e->iaq_b = ctx->iaq_b; + + return e; +} + static bool gen_excp_iir(DisasContext *ctx, int exc) { - nullify_over(ctx); - tcg_gen_st_i64(tcg_constant_i64(ctx->insn), - tcg_env, offsetof(CPUHPPAState, cr[CR_IIR])); - gen_excp(ctx, exc); - return nullify_end(ctx); + if (ctx->null_cond.c == TCG_COND_NEVER) { + tcg_gen_st_i64(tcg_constant_i64(ctx->insn), + tcg_env, offsetof(CPUHPPAState, cr[CR_IIR])); + gen_excp(ctx, exc); + } else { + DisasDelayException *e = delay_excp(ctx, exc); + tcg_gen_brcond_i64(tcg_invert_cond(ctx->null_cond.c), + ctx->null_cond.a0, ctx->null_cond.a1, e->lab); + ctx->null_cond = cond_make_f(); + } + return true; } static bool gen_illegal(DisasContext *ctx) @@ -4695,6 +4732,19 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) default: g_assert_not_reached(); } + + for (DisasDelayException *e = ctx->delay_excp_list; e ; e = e->next) { + gen_set_label(e->lab); + if (e->set_n >= 0) { + tcg_gen_movi_i64(cpu_psw_n, e->set_n); + } + if (e->set_iir) { + tcg_gen_st_i64(tcg_constant_i64(e->insn), tcg_env, + offsetof(CPUHPPAState, cr[CR_IIR])); + } + install_iaq_entries(ctx, &e->iaq_f, &e->iaq_b); + gen_excp_1(e->excp); + } } static void hppa_tr_disas_log(const DisasContextBase *dcbase, From patchwork Thu Apr 25 00:00:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791784 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119507wrq; Wed, 24 Apr 2024 17:11:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWq5SQcNIXL1/YdUu9kGQj4PzZdOOwGIOCpgBimqK/aBhd1BB/ckF6Iw3gfacZXCM8DF3jqU6+YDpMrC9cBCCxd X-Google-Smtp-Source: AGHT+IHbuBNcAOXTIlI6uqptlmdyb9ZWgCV4MsgCgluekpgDvBJxLG1WHq9pPjoSvUpZWTkzWMQ2 X-Received: by 2002:a0c:e38a:0:b0:6a0:5652:31e4 with SMTP id a10-20020a0ce38a000000b006a0565231e4mr3953767qvl.54.1714003899772; Wed, 24 Apr 2024 17:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003899; cv=none; d=google.com; s=arc-20160816; b=bIiz40i2YHsA0H7Oo3dSRGnj7mMeViYScD5s4axEQRB5/qI5+kKUYxcdq2HPpynWaM L84O1IHmORWZ+rTOFfr1wS6iEJ++NmKckHi/YdBL1N1TWsqHgOW3Ib9MEATbBWyq2GuR clhfNNYopVQPRAr76Y9o35A77j5QBwh60H7oVqXo9pM/BoVhpeKJ/h7hbRHx1LLLfHqh wiYZsLQ2iQP9iRjND0GpnF4aU/51bYDe0zmkjfHv8FqqeJsx3KkZgAflG7JimpyBx5FH 60nbyVJKN4LurntFwdy3nxbjTNzbdCfMNVDzvPhC92fKLC2pDXvhBfqY5yoxzaKD4Trv MnKg== 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=5wlGs/id23E87HIx9ekP/PHGIDt2Ux5/Yk7Een8ixEg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=b4+4KkG6H7IUv8EqzV+mc7+XzzY2vPYkU0bdffsIJ9gbeguoSxcf8aGarg8r96/iMx yPXDYQjN9i87Hri28QFJEcYD5GJ9HXCAk/JB0AGPljy3yhagmQ/NWMgw7R+HfG5u/WD1 QstTI/Vm/ZkySUNhnZjDQJKNxqAaDHLrgkYayxLeRoj4ciSYcyQd8oJ05TOe77Y8ZNsC c1qf9O8S2fPWbXZYAF6AscH2GlSUTsdmzFIsaVo3R63HHVZRQKW0dIvAWqM/6Gn9b08x AYrNcPdPsoaqhStROWDvZ4cvgeg76xBYs+JBF+mgj9cbZlH2Ir7AOFaUrtDF54RA9eRt FXOw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PvyYCeUc; 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 im4-20020a056214246400b0069b676dab8dsi16497029qvb.316.2024.04.24.17.11.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:11:39 -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=PvyYCeUc; 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 1rzmY3-0008Lo-UQ; Wed, 24 Apr 2024 20:01:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXr-0008Gl-81 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:01 -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 1rzmXm-0006Ho-SQ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:57 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e50a04c317so2386935ad.1 for ; Wed, 24 Apr 2024 17:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003253; x=1714608053; 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=5wlGs/id23E87HIx9ekP/PHGIDt2Ux5/Yk7Een8ixEg=; b=PvyYCeUcAgz47cqA4rXWN0N8o9Z4hwhGEFvBYTKMfiId1BsmS+g9X1+/NtFYc0AE4W zRWexKvUkoyQaw/1PqLpEu5hSsc1m+3X+I6tyBN21Wl5Ud9bd/74XkJeX6HzNFtkb2jg FAzYXYaggcJdl0tv8+DyXbcbo5Klf70MuDqvbwEwQ5xUaXjiRTJaVguh2zEBJutngNGU SSKqgPuaGTlkKcozA+kXfWh7PfhL06kd5Miyzgxyydjew1zZggbBd3J/AtW9B2Ai3NEZ z7CU0MmHBiKibZwqNRqkvSQ9Bg5qRN4pz2YfjDiHfO4u9BSfj8i09dbfUiGEKpDy4wbW L4Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003253; x=1714608053; 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=5wlGs/id23E87HIx9ekP/PHGIDt2Ux5/Yk7Een8ixEg=; b=V9aX89vFc+ww344FQI4FhTHdnHL3byrQ73iO17QRYdDh+j6dmQHrZ++Q4suz0Gdk/G NvlsfvF2La3eRW0RFrRx8TA2cl3KjCmet8GzP/Ju5CJ85VetldfYUmBDtwS+Qnvhe3hu QejOzavbbMXV72NtIEo4cWDD3D4iEsD9qlq2yW5sOSD6QqTgCAEEkNQfb0hczkmE679r 2TLJAqUuPKHcVJLLkBO86QuPW2OFESHlDCEdfD/8WzgA0kvCGx0TUc6van/+hMFLXVOt K4ECG5hk7QS638vAYuYZuJsf8sDcPvu+OS/9/r4wbKRZMuGHYEQ42FGVNSJzoNCf/TNn 8acA== X-Gm-Message-State: AOJu0YxQCLrTEa3msDiyxpMmw0dEEv8G10ikXmTIxhRas5Pf81OAQO/8 /0AZOdec2NiQozXmglGLV6Je5lkTeByzdT6XAVM2d+QCaBVkxuj+HbUQCA2aojnYfRckcCShfIA S X-Received: by 2002:a17:902:ec8a:b0:1e3:e6cb:a33c with SMTP id x10-20020a170902ec8a00b001e3e6cba33cmr4958074plg.65.1714003253530; Wed, 24 Apr 2024 17:00:53 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 29/45] target/hppa: Use delay_excp for conditional traps Date: Wed, 24 Apr 2024 17:00:07 -0700 Message-Id: <20240425000023.1002026-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/hppa/helper.h | 1 - target/hppa/int_helper.c | 2 +- target/hppa/op_helper.c | 7 ------- target/hppa/translate.c | 41 ++++++++++++++++++++++++++++++---------- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/target/hppa/helper.h b/target/hppa/helper.h index 5900fd70bc..3d0d143aed 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -1,6 +1,5 @@ DEF_HELPER_2(excp, noreturn, env, int) DEF_HELPER_FLAGS_2(tsv, TCG_CALL_NO_WG, void, env, tl) -DEF_HELPER_FLAGS_2(tcond, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_FLAGS_3(stby_b, TCG_CALL_NO_WG, void, env, tl, tl) DEF_HELPER_FLAGS_3(stby_b_parallel, TCG_CALL_NO_WG, void, env, tl, tl) diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index a667ee380d..1aa3e88ef1 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -134,13 +134,13 @@ void hppa_cpu_do_interrupt(CPUState *cs) switch (i) { case EXCP_ILL: case EXCP_BREAK: + case EXCP_COND: case EXCP_PRIV_REG: case EXCP_PRIV_OPR: /* IIR set via translate.c. */ break; case EXCP_OVERFLOW: - case EXCP_COND: case EXCP_ASSIST: case EXCP_DTLB_MISS: case EXCP_NA_ITLB_MISS: diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 6cf49f33b7..a8b69fd481 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -49,13 +49,6 @@ void HELPER(tsv)(CPUHPPAState *env, target_ulong cond) } } -void HELPER(tcond)(CPUHPPAState *env, target_ulong cond) -{ - if (unlikely(cond)) { - hppa_dynamic_excp(env, EXCP_COND, GETPC()); - } -} - static void atomic_store_mask32(CPUHPPAState *env, target_ulong addr, uint32_t val, uint32_t mask, uintptr_t ra) { diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 7a92901e18..080a52e5e4 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1115,6 +1115,25 @@ static TCGv_i64 do_sub_sv(DisasContext *ctx, TCGv_i64 res, return sv; } +static void gen_tc(DisasContext *ctx, DisasCond *cond) +{ + DisasDelayException *e; + + switch (cond->c) { + case TCG_COND_NEVER: + break; + case TCG_COND_ALWAYS: + gen_excp_iir(ctx, EXCP_COND); + break; + default: + e = delay_excp(ctx, EXCP_COND); + tcg_gen_brcond_i64(cond->c, cond->a0, cond->a1, e->lab); + /* In the non-trap path, the condition is known false. */ + *cond = cond_make_f(); + break; + } +} + static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 orig_in1, TCGv_i64 in2, unsigned shift, bool is_l, bool is_tsv, bool is_tc, bool is_c, unsigned cf, bool d) @@ -1173,9 +1192,7 @@ static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 orig_in1, /* Emit any conditional trap before any writeback. */ cond = do_cond(ctx, cf, d, dest, uv, sv); if (is_tc) { - tmp = tcg_temp_new_i64(); - tcg_gen_setcond_i64(cond.c, tmp, cond.a0, cond.a1); - gen_helper_tcond(tcg_env, tmp); + gen_tc(ctx, &cond); } /* Write back the result. */ @@ -1194,6 +1211,10 @@ static bool do_add_reg(DisasContext *ctx, arg_rrr_cf_d_sh *a, { TCGv_i64 tcg_r1, tcg_r2; + if (unlikely(is_tc && a->cf == 1)) { + /* Unconditional trap on condition. */ + return gen_excp_iir(ctx, EXCP_COND); + } if (a->cf) { nullify_over(ctx); } @@ -1209,6 +1230,10 @@ static bool do_add_imm(DisasContext *ctx, arg_rri_cf *a, { TCGv_i64 tcg_im, tcg_r2; + if (unlikely(is_tc && a->cf == 1)) { + /* Unconditional trap on condition. */ + return gen_excp_iir(ctx, EXCP_COND); + } if (a->cf) { nullify_over(ctx); } @@ -1223,7 +1248,7 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, TCGv_i64 in2, bool is_tsv, bool is_b, bool is_tc, unsigned cf, bool d) { - TCGv_i64 dest, sv, cb, cb_msb, tmp; + TCGv_i64 dest, sv, cb, cb_msb; unsigned c = cf >> 1; DisasCond cond; @@ -1271,9 +1296,7 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, /* Emit any conditional trap before any writeback. */ if (is_tc) { - tmp = tcg_temp_new_i64(); - tcg_gen_setcond_i64(cond.c, tmp, cond.a0, cond.a1); - gen_helper_tcond(tcg_env, tmp); + gen_tc(ctx, &cond); } /* Write back the result. */ @@ -1439,9 +1462,7 @@ static void do_unit_addsub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, } if (is_tc) { - TCGv_i64 tmp = tcg_temp_new_i64(); - tcg_gen_setcond_i64(cond.c, tmp, cond.a0, cond.a1); - gen_helper_tcond(tcg_env, tmp); + gen_tc(ctx, &cond); } save_gpr(ctx, rt, dest); From patchwork Thu Apr 25 00:00:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791769 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118419wrq; Wed, 24 Apr 2024 17:08:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1O3s1yoP6nLqFSG7sYl4J4Z3mqnT4QidFdTidKg2T0jZDLvN6ILHRHc4bkfmqed+WnlROYtxDBPEWxKeBz7Wj X-Google-Smtp-Source: AGHT+IHfGCE+h/7UuSlrNo4kryRnMMd11zbncx1Dx//DQ35ufirBKtbIeXaMNbwoR325iyxJvdcI X-Received: by 2002:a05:622a:1992:b0:434:ff75:649d with SMTP id u18-20020a05622a199200b00434ff75649dmr4511464qtc.3.1714003722649; Wed, 24 Apr 2024 17:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003722; cv=none; d=google.com; s=arc-20160816; b=YiycMUP/wvcbTJgw+RJwjO5fi88jkn56RSQUD3zAZWpCyr8K1xRb69b4gf9TWZZsCf pfAaiR+fhSnRAl/jsTFfJzgi6ssmgB8PNO/M51OKphz8HQyrX9VDp8sSVltVCteSUyoR eBLHcP7seKlx6vCJuNhdzqlInkudPCu6hZioTgHFNfC46jMKUuZDmUnf7XDee7WlT+Yc ptzZYZ7srRqBeSVflYamArpvzI8NsmYmWdgCSGClaf6X0Oedt+yUswM+0vYZbYnak0bW eYCQE4OKnjtbIU5l30L8FNPlXhXd50hAO6brwt/LX8KIOhICFSuPQQdDlsnzyzbGeSNP rZow== 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=GBEVyO91JxsJKf4oQcLpJPbZqHPDZDlu1iUToY/k/Bk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tU9Wh/AKiLrsMTqUSBjLDiEgNLxOaPmgLiPq6j4fpPvehqldlvxBS0ABgKTc96uYFU +9njKl/JJUPys3+RyfnAf7AvPaNpE2oxYQtgiDDyf4kgaM4gOdsq3XNaKFBTgljNi7lv FkwyRewjKI7/5K94dZETpTzXc8nBDy8i2mkyQI/hJAH4FUX064cmxSgbnoarjb8O2Z+v 1uYEI7G5D3nVPMPwo892tU7VTA71x48Ub5chwZVZoDaGXfM2rfPy3TZg0Tbdb6RKcg0O Se26QSPfBZjiSlIIGOqjbGxvuXZXURukHmMjoUUCsw/ENJYdcMevuOwNbgO2Xl1hoDWB p+3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JJHpycFh; 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 p10-20020a05622a13ca00b0043651b8e6e8si16864856qtk.207.2024.04.24.17.08.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:42 -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=JJHpycFh; 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 1rzmYI-0008QQ-B6; Wed, 24 Apr 2024 20:01:26 -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 1rzmXr-0008H6-AK for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:01 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXo-0006Hw-Dv for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:00:58 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2a2da57ab3aso420587a91.3 for ; Wed, 24 Apr 2024 17:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003254; x=1714608054; 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=GBEVyO91JxsJKf4oQcLpJPbZqHPDZDlu1iUToY/k/Bk=; b=JJHpycFhRYMopTI2pbvSk/HMj27fMpFAhwYqwQOZqICsrrzkLmZGdXh40gjjvnFvRG oJUsRHZyFb1VmuSUBzbWx1Ry3vnbEQNLBqgbdlmIwJ3iEnNbSfWW7Abcg96WrtI2K059 +c5y7msNnDUceT3L3AUXeLOjDGrXuHmQy4r+rfkWEKizIowWgITRT37oMe30Q5nZ1b3Q /HNP2PyW46ggI4qLYpxzGneJTNlyPxYKRZCZllHqMoyAGtLpr4R276o17BNjgWVbuJe4 yIC2sp11ZprU7f9uWYCCFxkaRJXcJpYv7fxumWOJ7eKDWrekhVqUV605rY6BeIC4fY6j pnAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003254; x=1714608054; 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=GBEVyO91JxsJKf4oQcLpJPbZqHPDZDlu1iUToY/k/Bk=; b=wohCwK5IgILkOswAi6gt4k5nHq+MeOr0gDlPaQkJ82I4FAuRfz7Ja/OKqqk/0OZVJp ZooS6pVa04l6Dh47JKk/Xyu2gxV+vlOfggisXzGVoq/k+05hfAp6cqpxpKL9U/YyxL8I gy75EGE+/Xm917zgDaOIKf0zPthqFZEtToFuplOwaliSlB4nhI5ANVnJZx38fpCKOw0W MQ8wSNHqywG1x3e0UVRrLX7QBvUTLpE1uhAT7Ji6TUIAJAWcl3JCuleOMhUJSWsvVfMI mEtGcbMJ6s6UChQXTLv6Uea8rJvrRoVHXz1pNI/8I3FUudSogx6bGe5RcSSby5lCXoIy PjbA== X-Gm-Message-State: AOJu0Yz0JOVJxPqOGIjIwicNs5CV/St0X3YbR3EoYMElKLqpqvGM+msl 2fvk+ovnY0TEMqZ/vDyG2eYU9bwKS2JPygH6/XvtyH2Hf0pZjcHmVM4StFsT8UG+v9YiK1DdGe/ t X-Received: by 2002:a17:90b:1081:b0:2af:58fa:f73b with SMTP id gj1-20020a17090b108100b002af58faf73bmr2745779pjb.48.1714003254526; Wed, 24 Apr 2024 17:00:54 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 30/45] target/hppa: Use delay_excp for conditional trap on overflow Date: Wed, 24 Apr 2024 17:00:08 -0700 Message-Id: <20240425000023.1002026-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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/hppa/helper.h | 1 - target/hppa/int_helper.c | 2 +- target/hppa/op_helper.c | 7 ------- target/hppa/translate.c | 21 +++++++++++++-------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/target/hppa/helper.h b/target/hppa/helper.h index 3d0d143aed..c12b48a04a 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -1,5 +1,4 @@ DEF_HELPER_2(excp, noreturn, env, int) -DEF_HELPER_FLAGS_2(tsv, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_FLAGS_3(stby_b, TCG_CALL_NO_WG, void, env, tl, tl) DEF_HELPER_FLAGS_3(stby_b_parallel, TCG_CALL_NO_WG, void, env, tl, tl) diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index 1aa3e88ef1..97e5f0b9a7 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -134,13 +134,13 @@ void hppa_cpu_do_interrupt(CPUState *cs) switch (i) { case EXCP_ILL: case EXCP_BREAK: + case EXCP_OVERFLOW: case EXCP_COND: case EXCP_PRIV_REG: case EXCP_PRIV_OPR: /* IIR set via translate.c. */ break; - case EXCP_OVERFLOW: case EXCP_ASSIST: case EXCP_DTLB_MISS: case EXCP_NA_ITLB_MISS: diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index a8b69fd481..66cad78a57 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -42,13 +42,6 @@ G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra) cpu_loop_exit_restore(cs, ra); } -void HELPER(tsv)(CPUHPPAState *env, target_ulong cond) -{ - if (unlikely((target_long)cond < 0)) { - hppa_dynamic_excp(env, EXCP_OVERFLOW, GETPC()); - } -} - static void atomic_store_mask32(CPUHPPAState *env, target_ulong addr, uint32_t val, uint32_t mask, uintptr_t ra) { diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 080a52e5e4..5b0304d0d5 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1134,6 +1134,17 @@ static void gen_tc(DisasContext *ctx, DisasCond *cond) } } +static void gen_tsv(DisasContext *ctx, TCGv_i64 *sv, bool d) +{ + DisasCond cond = do_cond(ctx, /* SV */ 12, d, NULL, NULL, *sv); + DisasDelayException *e = delay_excp(ctx, EXCP_OVERFLOW); + + tcg_gen_brcond_i64(cond.c, cond.a0, cond.a1, e->lab); + + /* In the non-trap path, V is known zero. */ + *sv = tcg_constant_i64(0); +} + static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 orig_in1, TCGv_i64 in2, unsigned shift, bool is_l, bool is_tsv, bool is_tc, bool is_c, unsigned cf, bool d) @@ -1176,10 +1187,7 @@ static void do_add(DisasContext *ctx, unsigned rt, TCGv_i64 orig_in1, if (is_tsv || cond_need_sv(c)) { sv = do_add_sv(ctx, dest, in1, in2, orig_in1, shift, d); if (is_tsv) { - if (!d) { - tcg_gen_ext32s_i64(sv, sv); - } - gen_helper_tsv(tcg_env, sv); + gen_tsv(ctx, &sv, d); } } @@ -1280,10 +1288,7 @@ static void do_sub(DisasContext *ctx, unsigned rt, TCGv_i64 in1, if (is_tsv || cond_need_sv(c)) { sv = do_sub_sv(ctx, dest, in1, in2); if (is_tsv) { - if (!d) { - tcg_gen_ext32s_i64(sv, sv); - } - gen_helper_tsv(tcg_env, sv); + gen_tsv(ctx, &sv, d); } } From patchwork Thu Apr 25 00:00:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791764 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1117661wrq; Wed, 24 Apr 2024 17:06:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUw69DPfhHVH4g0UznnjLIXi/xNJ5oOBWGXSbxT4+/xqCbW7+j8sb4eiCgR2wEK+X6TumuL0pX0zzI9rCeEeTAo X-Google-Smtp-Source: AGHT+IFheXM/JUkieTn+dzAfEWg5wLrvT6/mOUXgkZfamkP4LL/fH60rcfyF4HoltfRnMOvSrv+R X-Received: by 2002:a05:622a:1208:b0:439:925b:45cb with SMTP id y8-20020a05622a120800b00439925b45cbmr4382086qtx.67.1714003602261; Wed, 24 Apr 2024 17:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003602; cv=none; d=google.com; s=arc-20160816; b=zrJuFDRBDVCBNEZceEyNP2Hb70tPwVM95SPTnIH+4gk+3DvcZ8nr5z6JiKhhMrkbUz rl9CY5cX2+MKFq9T3FNB45JgpXoYSclTVwRqfaE1ePxfHdwVRrxbwxXLAgKaC/TzDHvQ 8vHuyodmEIJPOkLoDwsm4A3n2D6aLR14BLvLwZAC/O1XyerEpUNWvQNdSWjdGxro5H7q wI44oO/J5y116VmEUqXS7Px6Nd0FGji44PMXyseiSFNM3atXCxo0yml5HNPXwckb8dli /bSDDalO7KZhZhE68eMaYQMz9ANSIH/8/nu+yyZZXIv1NkGg+g30sreABIicevrb3GpK KlNw== 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=iDB+2WIamKrub78NRBJKDqFHni/8UtJD/wODKQi6VUE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=n08ag86tKRsG2SAZkUA6xHl8KfywlT2UOdMye+MtjNvHXDvI6Kw3CdlHsb/jNryVSz vLlCA9SG5cTQc4ltGLn/ZU8Uy4Xm3X8c4XywvJID9TzfmRQyNzrvj/ZG/erqjokR97P8 pQaieQvMEybHUtvGqyq+M42+WKma4HKgPYojisX2smq+ZyCiUSKwk0IX9swBmW0YDKXk D5dWnBPdHjiBh34IZY3LE4aER1ttPC1mw/lp2S6SJU7XTEuL2j15/bYy0iHg/GmwUgO5 f1EadO+vdg4TQc5zRUZNt4XfjS3rbAuO4yubp7JGmuve9z+1t46XBtUi9ufit6babdOy WTeg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XAOSZNP/"; 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 hf25-20020a05622a609900b004366340b380si16200581qtb.270.2024.04.24.17.06.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:06:42 -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="XAOSZNP/"; 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 1rzmYK-0008S9-UJ; Wed, 24 Apr 2024 20:01:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXu-0008HZ-TL for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:03 -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 1rzmXp-0006I9-AY for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:00 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e4f341330fso4001005ad.0 for ; Wed, 24 Apr 2024 17:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003255; x=1714608055; 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=iDB+2WIamKrub78NRBJKDqFHni/8UtJD/wODKQi6VUE=; b=XAOSZNP/PdPwq1HhJ1E00ARW5Oe5PYPIjGZrQcsnjk00er4cBpCLbNNtFnGbb3r5U1 Vt7Ak7jQA38EG90wEQk+M9RHf9La4+YWLUlBJVEPSfBBTeTS6N/i6vJ4iqnhLegGqsag sdy7ikBsXvhgpkeLSgi7wsZKvdDaMycUzx9uQeg7b4PZ26caLh9aw9abDamhza62+3D0 bkdt7wOBHDTJoplavxX78M1sFPnke2vC1/bt+z0y25EaJh7WHjP8tPrxUvgZKMAZK/N0 CCF/oz4BEA0yp5aGma7/DJVkB0ZNxsiK0l6clVR7zVx7q2Nu2V5EyS6O8iyDj8PRfmz6 YvGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003255; x=1714608055; 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=iDB+2WIamKrub78NRBJKDqFHni/8UtJD/wODKQi6VUE=; b=tWK5NusQ8PNAcxw8pRDWcKfDXnCl9H9+oe4JY7h/3B4/0dsUPc9uAEpHlz3/a1o2fd YAhXnW9sX/ikvfxtF70VZSAh+Wu17W2p4JYHkoGyaPWMBoSHzkot/9+m9kcUMVsN8ITq ISUIFuw9tApterHYtxqJbgp5TFY1ILXC66aIZO44q4XhNtAVM39Nmmac57ZNvE22uCUX 8ioS7fHkSYzrEXx3KWcS7lMjm1ooXRszRQrjODYoxoZ9TP/Buek/waZYJRcTXd9vq3Mz 90oq0FA1zkWY8P0nW4jnHzkbKpD3u7IRbjLPdO4EzDBUc/VDfg2Md40yRPr1RFT9Xb3D Gr8A== X-Gm-Message-State: AOJu0YzcYyZscCJcLoDQl3k5svMsWs7q2YYbHhHAhG3jYMzzptPxQCUM vxPGEAANmfQ2OJAOYptPFzvmmdPxCZbRBvs0ySGRSXxX6qaFEJDVr0Co1EvVNLkJqlZuAm1zg4Z 2 X-Received: by 2002:a17:902:ce90:b0:1e4:54d1:a159 with SMTP id f16-20020a170902ce9000b001e454d1a159mr5289968plg.47.1714003255403; Wed, 24 Apr 2024 17:00:55 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 31/45] linux-user/hppa: Force all code addresses to PRIV_USER Date: Wed, 24 Apr 2024 17:00:09 -0700 Message-Id: <20240425000023.1002026-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 The kernel does this along the return path to user mode. Signed-off-by: Richard Henderson --- linux-user/hppa/target_cpu.h | 4 ++-- target/hppa/cpu.h | 3 +++ linux-user/elfload.c | 4 ++-- linux-user/hppa/cpu_loop.c | 14 +++++++------- linux-user/hppa/signal.c | 6 ++++-- target/hppa/cpu.c | 7 +++++-- target/hppa/gdbstub.c | 6 ++++++ target/hppa/translate.c | 4 ++-- 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/linux-user/hppa/target_cpu.h b/linux-user/hppa/target_cpu.h index aacf3e9e02..4b84422a90 100644 --- a/linux-user/hppa/target_cpu.h +++ b/linux-user/hppa/target_cpu.h @@ -28,8 +28,8 @@ static inline void cpu_clone_regs_child(CPUHPPAState *env, target_ulong newsp, /* Indicate child in return value. */ env->gr[28] = 0; /* Return from the syscall. */ - env->iaoq_f = env->gr[31]; - env->iaoq_b = env->gr[31] + 4; + env->iaoq_f = env->gr[31] | PRIV_USER; + env->iaoq_b = env->iaoq_f + 4; } static inline void cpu_clone_regs_parent(CPUHPPAState *env, unsigned flags) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index c0da9e9af6..4514bc63dc 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -48,6 +48,9 @@ #define MMU_IDX_TO_P(MIDX) (((MIDX) - MMU_KERNEL_IDX) & 1) #define PRIV_P_TO_MMU_IDX(PRIV, P) ((PRIV) * 2 + !!(P) + MMU_KERNEL_IDX) +#define PRIV_KERNEL 0 +#define PRIV_USER 3 + #define TARGET_INSN_START_EXTRA_WORDS 2 /* No need to flush MMU_ABS*_IDX */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 60cf55b36c..b551cbcb03 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1963,8 +1963,8 @@ static inline void init_thread(struct target_pt_regs *regs, static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) { - regs->iaoq[0] = infop->entry; - regs->iaoq[1] = infop->entry + 4; + regs->iaoq[0] = infop->entry | PRIV_USER; + regs->iaoq[1] = regs->iaoq[0] + 4; regs->gr[23] = 0; regs->gr[24] = infop->argv; regs->gr[25] = infop->argc; diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index d5232f37fe..bc093b8fe8 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -129,8 +129,8 @@ void cpu_loop(CPUHPPAState *env) default: env->gr[28] = ret; /* We arrived here by faking the gateway page. Return. */ - env->iaoq_f = env->gr[31]; - env->iaoq_b = env->gr[31] + 4; + env->iaoq_f = env->gr[31] | PRIV_USER; + env->iaoq_b = env->iaoq_f + 4; break; case -QEMU_ERESTARTSYS: case -QEMU_ESIGRETURN: @@ -140,8 +140,8 @@ void cpu_loop(CPUHPPAState *env) case EXCP_SYSCALL_LWS: env->gr[21] = hppa_lws(env); /* We arrived here by faking the gateway page. Return. */ - env->iaoq_f = env->gr[31]; - env->iaoq_b = env->gr[31] + 4; + env->iaoq_f = env->gr[31] | PRIV_USER; + env->iaoq_b = env->iaoq_f + 4; break; case EXCP_IMP: force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, env->iaoq_f); @@ -152,9 +152,9 @@ void cpu_loop(CPUHPPAState *env) case EXCP_PRIV_OPR: /* check for glibc ABORT_INSTRUCTION "iitlbp %r0,(%sr0, %r0)" */ if (env->cr[CR_IIR] == 0x04000000) { - force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->iaoq_f); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->iaoq_f); } else { - force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->iaoq_f); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->iaoq_f); } break; case EXCP_PRIV_REG: @@ -170,7 +170,7 @@ void cpu_loop(CPUHPPAState *env) force_sig_fault(TARGET_SIGFPE, 0, env->iaoq_f); break; case EXCP_BREAK: - force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->iaoq_f & ~3); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->iaoq_f); break; case EXCP_DEBUG: force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->iaoq_f); diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 682ba25922..f6f094c960 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -101,7 +101,9 @@ static void restore_sigcontext(CPUArchState *env, struct target_sigcontext *sc) cpu_hppa_loaded_fr0(env); __get_user(env->iaoq_f, &sc->sc_iaoq[0]); + env->iaoq_f |= PRIV_USER; __get_user(env->iaoq_b, &sc->sc_iaoq[1]); + env->iaoq_b |= PRIV_USER; __get_user(env->cr[CR_SAR], &sc->sc_sar); } @@ -162,8 +164,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, unlock_user(fdesc, haddr, 0); haddr = dest; } - env->iaoq_f = haddr; - env->iaoq_b = haddr + 4; + env->iaoq_f = haddr | PRIV_USER; + env->iaoq_b = env->iaoq_f + 4; env->psw_n = 0; return; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 7315567910..8c8c6181de 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -32,6 +32,9 @@ static void hppa_cpu_set_pc(CPUState *cs, vaddr value) { HPPACPU *cpu = HPPA_CPU(cs); +#ifdef CONFIG_USER_ONLY + value |= PRIV_USER; +#endif cpu->env.iaoq_f = value; cpu->env.iaoq_b = value + 4; } @@ -93,8 +96,8 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs, tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL)); #ifdef CONFIG_USER_ONLY - cpu->env.iaoq_f = tb->pc; - cpu->env.iaoq_b = tb->cs_base; + cpu->env.iaoq_f = tb->pc | PRIV_USER; + cpu->env.iaoq_b = tb->cs_base | PRIV_USER; #else /* Recover the IAOQ values from the GVA + PRIV. */ uint32_t priv = (tb->flags >> TB_FLAG_PRIV_SHIFT) & 3; diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c index 4a965b38d7..0daa52f7af 100644 --- a/target/hppa/gdbstub.c +++ b/target/hppa/gdbstub.c @@ -163,12 +163,18 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) env->cr[CR_SAR] = val & (hppa_is_pa20(env) ? 63 : 31); break; case 33: +#ifdef CONFIG_USER_ONLY + val |= PRIV_USER; +#endif env->iaoq_f = val; break; case 34: env->iasq_f = (uint64_t)val << 32; break; case 35: +#ifdef CONFIG_USER_ONLY + val |= PRIV_USER; +#endif env->iaoq_b = val; break; case 36: diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 5b0304d0d5..273691fd6a 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2052,7 +2052,7 @@ static void do_page_zero(DisasContext *ctx) tcg_gen_st_i64(cpu_gr[26], tcg_env, offsetof(CPUHPPAState, cr[27])); - tcg_gen_ori_i64(next.base, cpu_gr[31], 3); + tcg_gen_ori_i64(next.base, cpu_gr[31], PRIV_USER); install_iaq_entries(ctx, &next, NULL); ctx->base.is_jmp = DISAS_IAQ_N_UPDATED; } @@ -4581,7 +4581,7 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->is_pa20 = hppa_is_pa20(cpu_env(cs)); #ifdef CONFIG_USER_ONLY - ctx->privilege = MMU_IDX_TO_PRIV(MMU_USER_IDX); + ctx->privilege = PRIV_USER; ctx->mmu_idx = MMU_USER_IDX; ctx->iaoq_first = ctx->base.pc_first | ctx->privilege; ctx->iaq_b.disp = ctx->base.tb->cs_base - ctx->base.pc_first; From patchwork Thu Apr 25 00:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791768 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118255wrq; Wed, 24 Apr 2024 17:08:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUF8oEGMtWNrJ9qEjMi3IU5namp4wwPtQ74YA2CYGSplA8g2aWXyq4JF9rUcwzZgBoqofatKgebEqchLbd3kV/Y X-Google-Smtp-Source: AGHT+IGT4INetXFzE7WerKG9bFw5ah9PA7u7S1vrLY+gZb7jCekoUCACZx1pENyKV2dpjhd97Pau X-Received: by 2002:a05:690c:6383:b0:61a:b0d9:6d1d with SMTP id hp3-20020a05690c638300b0061ab0d96d1dmr4547581ywb.47.1714003699677; Wed, 24 Apr 2024 17:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003699; cv=none; d=google.com; s=arc-20160816; b=CEw0c0ucGC5Alx2Tait1d2hmKPSbNvrqtkNtJVSAeDSkLoNX0VyWoCCBYAELKWlGga VuTaS+AoKjvs+RmAMeBW3uXnopOotuQQEzcjNZ3OUnpoPoUnCcP8EJTmPMhMt9a6D9cx mZOfO/5QJeI+D7BP0PuV0SipsYfg7Eo2VENVg7NjX16kz0wLrGIFV9rN6uBluyeBlG6q 8YFqCk5ESvoa22fYkTQ/T1UGRgBSQhi/+2tHzbmq/ODOK0HBMxGb41OYw0vIzAVUQtkh Uc6Da/YrU9COCM6HqyDK/TsSHgKPvdUdFKw9c7ghnsZZawVxd4PaC7XVzzu08sCtpI4e R3hg== 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=896AziD89xiuMmVpTfvtSKDrdYS14/szB8aj28YLoDU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bXc3iM0Tqsd8TRF0Gsh1VCXWfx2l/NkbD68P2SnbRT54Sa1EjtUFDmBWjchRH3uB87 rOoHeoaGBVFxqH3c4CgHFpSpzJqeP460+2DfTnm3KyhVpehq1ux+9WQYdRIsO87se9wT /u19MQhjBw+s1tgOZ2BVBAm6Ti8Z8svKfK+iDMTq/lQyr5MygHWhnwuV+VgppXFOAXdz /Ame5JFfWnTwby6SrPAMUrO8h1NHEcQY/zwbGlu5DPqdqqKIPeaTs+bNuExAc3gviKYE UO/oiEx0bvS5M11DM/bC4VFLkxUlMktlqAczsA/ZeE6F2VHNCF0bOfLmZnn+AsGVGl1K jBVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vM969dZz; 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 wm22-20020a05620a581600b007905dea846asi12807040qkn.452.2024.04.24.17.08.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vM969dZz; 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 1rzmYJ-0008RF-67; Wed, 24 Apr 2024 20:01:27 -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 1rzmXv-0008Hg-8Y for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:03 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXp-0006IQ-Sy for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:00 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e51398cc4eso3767685ad.2 for ; Wed, 24 Apr 2024 17:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003256; x=1714608056; 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=896AziD89xiuMmVpTfvtSKDrdYS14/szB8aj28YLoDU=; b=vM969dZzWl2CZHaPyecu9wIAw2sOIS30nskl2danps9tG3pIWlUEFLMlgUonObv/H3 LMczEgn7eNI9GOHI1Z2MRQTjonARVxUPxMeXaR8JcTjdC+9TWlILNI05bXnGkqOzIjQS 6vwVlxI8LmFS/gAJydaKEdM4mEYlC3CznuaUe/fxjExwhM51SZHAsdN9XedRMxuAr4n8 jDnCw65IZ/oIlCOrteXTc7bqYjsLXc5prLDMcn/zYucHL+JFFxLCdkh5K660VS0ZsMxU 7M9p+qelAioNDWtwuUnHlaI+ISQDDd/Zi/49EcIrcTocw1n9PLt9rnZ8MRrk9vU0cLkA KIng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003256; x=1714608056; 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=896AziD89xiuMmVpTfvtSKDrdYS14/szB8aj28YLoDU=; b=gcURgpEEuu1lKlfnDDu3/g4iZGQelnH5dYj0y2WW+VGiO6Ko/FEmT+poI+rjDVjWXS A9FiiIRDnQiOGHeml7bKdBwjFrzTsPPObdU+dWrJGCAV8cy0H+3DOBRxpx45QHknNp3t zATdzTWrZ83HK6uPmx9wKqOYeEfGz3hcOCcl+k8vwRQ+xuVj034w7hQ3d/XFtowZ0ZKN KFQQgCywZBz+ZVkpusJAtXjyRDDvbGgu4RT6FzO/kX1IM6NKWjP91x7jiGe844QBgnfk E0g4u/R7HkbYsqE2xAOzpMRJhMCDDDOjMuwexShxSDrs4T7VSzBDpNSiE7Et3vHJrhqB QcSA== X-Gm-Message-State: AOJu0YxVq3qXQTYG7Fs7UWs5oiZw/etAWXg4AMdRIqBPpg9Iltg2KiOo zLFq7ZeXVUhz9M2nQ+2dUpB3QTr2KAlPjgAPHQ0UHjXDAxs36Xkbfb2TEE8DKlBX8yn5iaN3BG3 l X-Received: by 2002:a17:903:1209:b0:1e4:b4f5:5cfa with SMTP id l9-20020a170903120900b001e4b4f55cfamr4972319plh.27.1714003256432; Wed, 24 Apr 2024 17:00:56 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 32/45] target/hppa: Store full iaoq_f and page bits of iaoq_d in TB Date: Wed, 24 Apr 2024 17:00:10 -0700 Message-Id: <20240425000023.1002026-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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 In preparation for CF_PCREL. store the iaoq_f in 3 parts: high bits in cs_base, middle bits in pc, and low bits in priv. For iaoq_b, set a bit for either of space or page differing, else the page offset. Install iaq entries before goto_tb. The change to not record the full direct branch difference in TB means that we have to store at least iaoq_b before goto_tb. But we since we'll need both updated before goto_tb for CF_PCREL, do that now. Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 2 ++ target/hppa/cpu.c | 72 ++++++++++++++++++----------------------- target/hppa/translate.c | 29 +++++++++-------- 3 files changed, 48 insertions(+), 55 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 4514bc63dc..66cae795bd 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -347,6 +347,8 @@ hwaddr hppa_abs_to_phys_pa2_w1(vaddr addr); #define TB_FLAG_SR_SAME PSW_I #define TB_FLAG_PRIV_SHIFT 8 #define TB_FLAG_UNALIGN 0x400 +#define CS_BASE_DIFFPAGE (1 << 12) +#define CS_BASE_DIFFSPACE (1 << 13) void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, uint64_t *cs_base, uint32_t *pflags); diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 8c8c6181de..003af63e20 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -48,36 +48,43 @@ static vaddr hppa_cpu_get_pc(CPUState *cs) } void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, - uint64_t *cs_base, uint32_t *pflags) + uint64_t *pcsbase, uint32_t *pflags) { uint32_t flags = env->psw_n * PSW_N; + uint64_t cs_base = 0; + + /* + * TB lookup assumes that PC contains the complete virtual address. + * If we leave space+offset separate, we'll get ITLB misses to an + * incomplete virtual address. This also means that we must separate + * out current cpu privilege from the low bits of IAOQ_F. + */ + *pc = hppa_cpu_get_pc(env_cpu(env)); + flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; + + if (hppa_is_pa20(env)) { + cs_base = env->iaoq_f & MAKE_64BIT_MASK(32, 32); + } + + /* + * The only really interesting case is if IAQ_Back is on the same page + * as IAQ_Front, so that we can use goto_tb between the blocks. In all + * other cases, we'll be ending the TranslationBlock with one insn and + * not linking between them. + */ + if (env->iasq_f != env->iasq_b) { + cs_base |= CS_BASE_DIFFSPACE; + } else if ((env->iaoq_f ^ env->iaoq_b) & TARGET_PAGE_MASK) { + cs_base |= CS_BASE_DIFFPAGE; + } else { + cs_base |= env->iaoq_b & ~TARGET_PAGE_MASK; + } - /* TB lookup assumes that PC contains the complete virtual address. - If we leave space+offset separate, we'll get ITLB misses to an - incomplete virtual address. This also means that we must separate - out current cpu privilege from the low bits of IAOQ_F. */ #ifdef CONFIG_USER_ONLY - *pc = env->iaoq_f & -4; - *cs_base = env->iaoq_b & -4; flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; #else /* ??? E, T, H, L, B bits need to be here, when implemented. */ flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); - flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; - - *pc = hppa_cpu_get_pc(env_cpu(env)); - *cs_base = env->iasq_f; - - /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero - low 32-bits of CS_BASE. This will succeed for all direct branches, - which is the primary case we care about -- using goto_tb within a page. - Failure is indicated by a zero difference. */ - if (env->iasq_f == env->iasq_b) { - target_long diff = env->iaoq_b - env->iaoq_f; - if (diff == (int32_t)diff) { - *cs_base |= (uint32_t)diff; - } - } if ((env->sr[4] == env->sr[5]) & (env->sr[4] == env->sr[6]) & (env->sr[4] == env->sr[7])) { @@ -85,6 +92,7 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, } #endif + *pcsbase = cs_base; *pflags = flags; } @@ -93,25 +101,7 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs, { HPPACPU *cpu = HPPA_CPU(cs); - tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL)); - -#ifdef CONFIG_USER_ONLY - cpu->env.iaoq_f = tb->pc | PRIV_USER; - cpu->env.iaoq_b = tb->cs_base | PRIV_USER; -#else - /* Recover the IAOQ values from the GVA + PRIV. */ - uint32_t priv = (tb->flags >> TB_FLAG_PRIV_SHIFT) & 3; - target_ulong cs_base = tb->cs_base; - target_ulong iasq_f = cs_base & ~0xffffffffull; - int32_t diff = cs_base; - - cpu->env.iasq_f = iasq_f; - cpu->env.iaoq_f = (tb->pc & ~iasq_f) + priv; - if (diff) { - cpu->env.iaoq_b = cpu->env.iaoq_f + diff; - } -#endif - + /* IAQ is always up-to-date before goto_tb. */ cpu->env.psw_n = (tb->flags & PSW_N) != 0; } diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 273691fd6a..cc409ffe13 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -768,12 +768,11 @@ static bool use_nullify_skip(DisasContext *ctx) static void gen_goto_tb(DisasContext *ctx, int which, const DisasIAQE *f, const DisasIAQE *b) { + install_iaq_entries(ctx, f, b); if (use_goto_tb(ctx, f, b)) { tcg_gen_goto_tb(which); - install_iaq_entries(ctx, f, b); tcg_gen_exit_tb(ctx->base.tb, which); } else { - install_iaq_entries(ctx, f, b); tcg_gen_lookup_and_goto_ptr(); } } @@ -4574,6 +4573,7 @@ static bool trans_diag_unimp(DisasContext *ctx, arg_diag_unimp *a) static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); + uint64_t cs_base, iaoq_f, iaoq_b; int bound; ctx->cs = cs; @@ -4583,29 +4583,30 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) #ifdef CONFIG_USER_ONLY ctx->privilege = PRIV_USER; ctx->mmu_idx = MMU_USER_IDX; - ctx->iaoq_first = ctx->base.pc_first | ctx->privilege; - ctx->iaq_b.disp = ctx->base.tb->cs_base - ctx->base.pc_first; ctx->unalign = (ctx->tb_flags & TB_FLAG_UNALIGN ? MO_UNALN : MO_ALIGN); #else ctx->privilege = (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; ctx->mmu_idx = (ctx->tb_flags & PSW_D ? PRIV_P_TO_MMU_IDX(ctx->privilege, ctx->tb_flags & PSW_P) : ctx->tb_flags & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX); +#endif /* Recover the IAOQ values from the GVA + PRIV. */ - uint64_t cs_base = ctx->base.tb->cs_base; - uint64_t iasq_f = cs_base & ~0xffffffffull; - int32_t diff = cs_base; + cs_base = ctx->base.tb->cs_base; + iaoq_f = cs_base & MAKE_64BIT_MASK(32, 32); + iaoq_f |= ctx->base.pc_first & MAKE_64BIT_MASK(2, 30); + iaoq_f |= ctx->privilege; + ctx->iaoq_first = iaoq_f; - ctx->iaoq_first = (ctx->base.pc_first & ~iasq_f) + ctx->privilege; - - if (diff) { - ctx->iaq_b.disp = diff; - } else { - ctx->iaq_b.base = cpu_iaoq_b; + if (unlikely(cs_base & CS_BASE_DIFFSPACE)) { ctx->iaq_b.space = cpu_iasq_b; + ctx->iaq_b.base = cpu_iaoq_b; + } else if (unlikely(cs_base & CS_BASE_DIFFPAGE)) { + ctx->iaq_b.base = cpu_iaoq_b; + } else { + iaoq_b = (iaoq_f & TARGET_PAGE_MASK) | (cs_base & ~TARGET_PAGE_MASK); + ctx->iaq_b.disp = iaoq_b - iaoq_f; } -#endif ctx->zero = tcg_constant_i64(0); From patchwork Thu Apr 25 00:00:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791760 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1116190wrq; Wed, 24 Apr 2024 17:03:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXnHBi2x2fRUNXkM1OoXjVBYtz9B4RPRapZQSkG72aUoelte68dS7xxT23PdyxWfkTwO8rjNklvPxIV3TvSaFV5 X-Google-Smtp-Source: AGHT+IE/IB9BvyMp1zMz6V4tj6L1rAh49VzCyEYoxg6edGKis/N7JUyNArih8rvx4CYGIWmLGqhV X-Received: by 2002:a05:6214:1792:b0:6a0:974a:24b0 with SMTP id ct18-20020a056214179200b006a0974a24b0mr2964752qvb.34.1714003401427; Wed, 24 Apr 2024 17:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003401; cv=none; d=google.com; s=arc-20160816; b=az2ahpMPBRWoVqflsOh6yQFdARp4eu7oLm7wUw4jOVgf2PA2rLBrEoI2uwtulKHcM9 4wY8ggXCZgSZxmNzY0prbI2y7+RCU/AmpPf+/8C5FiJimGuQ8O1e3PaQNU5lBG5eHTX0 sntNEJTQ4ZBPeXiduCi2FkfBRc+Eufzl6aYVH2ejNtOmZXkA0sisY5nNh4K9exDiZsUX fRGpkv31nj+F56MVShKIuaQYzb4NW7mPRPJvv7zyOM18GACEQyZMxsqMKys9SBJlrULg A6RBgFVtjV4JnqEvTR3WHUMVytWTHQi6hw536PvgLSopfWwDHgDKO3DO2ZZnLDIayxuv +Rug== 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=RnrM6xlTtlmtawC51lsQAVs42r4HEzE1iyIC+QHuURc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=mnCKTkRxVkyIci6SgffNTGkLzwJj2VoXpxYKU2Xry9QVvHhaWjT3Pa1CYLzvmEvIMr G1hDsFxDRIxaLclUwzX4XS4J2gq5QOMWHvN+/Qsh/gl6mbzeDX0e68eM4kYTxMmpLXr3 xRBaimxZ1gLSSnYA+2aZaGQTmlaaldbzllmZ5xHHBXFER/69Wp76eGuaHotDfizXRgj0 UPI2QyTWDy0ApsGXsw3dEod1PjO01BUS6kdekhnhniebUnI1NAsGjVCd3a+mZ6BvCsoI G65cVCoB9v3KPXO94JqO7oiYAIDoUKQkV2Hhhe1VTsa9B0diUOwwKu+zN3ZTA3i+nbvJ fBGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B5w1n5Q4; 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 c14-20020ad45aee000000b0069b39482a16si16679826qvh.342.2024.04.24.17.03.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:03:21 -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=B5w1n5Q4; 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 1rzmYO-00007S-0m; Wed, 24 Apr 2024 20:01:33 -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 1rzmXw-0008IZ-DJ for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:05 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXr-0006Is-0c for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:01 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e3f17c6491so3355955ad.2 for ; Wed, 24 Apr 2024 17:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003257; x=1714608057; 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=RnrM6xlTtlmtawC51lsQAVs42r4HEzE1iyIC+QHuURc=; b=B5w1n5Q4bUKfTJ7WZfK+zAPQngmi1Zbn5ft/Xnk0T7+wy9TYJawPe87ehjjpI1nMIy dMnGf0lBAvXyKUfQe+H1jGw/jIUzFJznV2laqPyWnwzOs5pEJFtLkOG6R1onJ+00at3f FMwlBx8EXBZYVtCrt3vrfNkxKt5f6BahBsyEMkfm2i8nH7dMb1VwdzONcOkW56e3OtCh Z2rYHfUeuh9smJKhwzARzngc2Lp4ZnWIHrs8rZA/MUtc5haP0BYtaYnkrfdKS1JoPyxg Mffe110c4bKIDdjINNckLK0rBRfY4WgtVl2rPFdfXgmoQbzGz3EwQwfV+wfIRX5NjpH6 IDyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003257; x=1714608057; 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=RnrM6xlTtlmtawC51lsQAVs42r4HEzE1iyIC+QHuURc=; b=ZoM8qfoSvZ1tQj/VyfQVUnlPHcoReO+gb6KlFwwK7gU+Rlw5lcdAPzS0APdIl6g32v 5a2SmxHAYdGuN100tl+7YlF3jrCudVRAowWH8HW/nWu5IWfz6kOTdkR+HH6SrgkA+hv3 1j+CuubzdRb9QrtwrTYsKWFrxMCc99CPQUbtvHXOoNpMXGxtsxPkSQ3MaILAfHpQlsq/ PxlOTdeG580ikT6lvJpxaD+aRPHfsHkWIoQTVqyb9cDQjWESkkYCl2m6sdr9ALvuNXYO EOO1HftvzgNspjX/Hn+yZF4BXIiEe1ODqlXQl3pVDpqzcPbnEUqlBYr6dA/DHS5StLeg m9XA== X-Gm-Message-State: AOJu0YyQcHhJhxlzFGzliajUsrN6YO6IJoLkAmpkjhV9hCnLgJh8TooX 8pHQEz1FQqqoFIm90zJiaJ5EYQWR48su+H419JsR/R7m16Eo9Z304ztE9h/sZWbzZipadM6muY0 / X-Received: by 2002:a17:902:b184:b0:1e8:37ea:d10 with SMTP id s4-20020a170902b18400b001e837ea0d10mr3367321plr.56.1714003257450; Wed, 24 Apr 2024 17:00:57 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 33/45] target/hppa: Do not mask in copy_iaoq_entry Date: Wed, 24 Apr 2024 17:00:11 -0700 Message-Id: <20240425000023.1002026-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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 As with loads and stores, code offsets are kept intact until the full gva is formed. In qemu, this is in cpu_get_tb_cpu_state. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index cc409ffe13..fb5bc12986 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -636,15 +636,10 @@ static DisasIAQE iaqe_next_absv(DisasContext *ctx, TCGv_i64 var) static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest, const DisasIAQE *src) { - uint64_t mask = gva_offset_mask(ctx->tb_flags); - if (src->base == NULL) { - tcg_gen_movi_i64(dest, (ctx->iaoq_first + src->disp) & mask); - } else if (src->disp == 0) { - tcg_gen_andi_i64(dest, src->base, mask); + tcg_gen_movi_i64(dest, ctx->iaoq_first + src->disp); } else { tcg_gen_addi_i64(dest, src->base, src->disp); - tcg_gen_andi_i64(dest, dest, mask); } } From patchwork Thu Apr 25 00:00:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791791 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119677wrq; Wed, 24 Apr 2024 17:12:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzqGARKFVKVEyclWR2B+LB3Pqt0Qxts0aNwZNEOPV7FDTerDBh3lie9YQHbQWbu+taXtvgcNZqsuLcok6O3NeI X-Google-Smtp-Source: AGHT+IH0fPWLfe4Fji/HcbmmB4liZuUyJUTJp/hjEWLPSEBFFfDETjIL5x3ZJgIE/9kSuk6MBPKa X-Received: by 2002:a0c:fb4b:0:b0:6a0:582c:119a with SMTP id b11-20020a0cfb4b000000b006a0582c119amr5124082qvq.1.1714003925586; Wed, 24 Apr 2024 17:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003925; cv=none; d=google.com; s=arc-20160816; b=mg0c+nlnC2f6N/0kfC1JNWmaXva9zuHt4RGnBFQhszxQIFwP2WHOS/xl2NetP1mNTe pJ5Sg70yALK1FKyJXK1lxN0BEubLfSuVJ5leNNDvUzHUjDfezwKXJzvzgNKICQ9Fns8f RRs+8hY0cXSLnId0jWIzCJBgFwvtlynRLAfB8fkya8qNDgAtxSOl260ZK/G8ChdRPynx ZhwrHl1Wyd6A3HwR3ECyi9WJMXmlkX2Bg63MzsvjkU6lsCQmRrKEkfEIwA3dJLKZv80v 3b+qKJAhQRjSFDpXmlnNTh4pGtY0BtDzfKdgeuauJA6zDtQdN6co20AWTVL6JGbtdoa1 +KPQ== 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=5fHOltBHJMUYAs0ifImrgAbY5phtILtBQ88LfAq6uw0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Qeb9Za9nTJkrTIyl0vww+V9xOcK4ePbcfr5ErmSTJ8oubKbMxGOoOFO8OW2eLKp/rB TPXGUVmcIqzLtYdS7l//UocFDwJ9xtJk2kZSNWE23cORfZWWrZZMvWAhE4Hd+fl9k1fx FtnNTCs8vdUDRt1VIJN/CXbmlIAWv6ZMcqymmW+xSjZBeBTo5dwwR1RIX5cv3dbD/Ams XS2Mwg3RNMpD9ZjYPzeW+NgO4H1ucTRuw5zRCCICysdC8NzMpzjjEjHPYMM0hHmKe1xj 9LmWSnNbbIAdhRRosmy3tHjbz/gKVQx1vhPJcpSgDMOb7GSVi+2X1280UUmOwoF1gFOZ PVMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=imfCadOk; 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 gi9-20020a056214248900b0069c185ec102si17064312qvb.364.2024.04.24.17.12.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:12:05 -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=imfCadOk; 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 1rzmYX-0000Uc-Iy; Wed, 24 Apr 2024 20:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXx-0008J1-RG for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:05 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXr-0006Iz-Vq for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:02 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1e65a1370b7so3857815ad.3 for ; Wed, 24 Apr 2024 17:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003258; x=1714608058; 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=5fHOltBHJMUYAs0ifImrgAbY5phtILtBQ88LfAq6uw0=; b=imfCadOka8VI+pky/QJYJPjFV7aZNcrCVn8+Je7XnRVmVO4+5AKspEg+qghnwHEUHY yDUwKMXR0sHPl/hMamT0JVE7unJqojZdeyAAVsDnLJ9z2jnIT8h5tJeV8sYkR3CIxbtT aAjWZ/hOyt08FSmjjTrtuSKCxieP+xWTIThGTBZI4cEI0+4Bc20VWMgss4rI2KhEe33v NXHe4n+r/9agpMuUpujKLmTo37rUfEogH+4LcSmN0F1RwGtfUKzmw3BdwtrfxCNTtNF7 bCyyMBaCUPqmyYVK/KYWNon3wFDiOt+GAGAlaoXu8NjQWrqy7tNY7GcZ+oawOL5pjZIq P3pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003258; x=1714608058; 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=5fHOltBHJMUYAs0ifImrgAbY5phtILtBQ88LfAq6uw0=; b=Z19xhoUVPp0OPLTGwFchHTukM2ErSA/l/X9I8ypFZVvSaarIsE8Zn+avP7uZf98m2E uVAEwueQ6BliKByYDpCieInCotdv7GL1sDKSMtG2lIiM5jjhTSjOM5o3YQKztE/s7i4v CcwFhEHXAT2pZLP72FWinroBa2/uUNYVqfcANw+cmafgTDV7SLEKZhLFg/VebBLb7bhF vltNeRHXHYOtpxbuex2RCOOzsY/RnF7oFF2ARDzoxDjfHap2Qy2efwXFq5Id02hCPgpe lQUdQa16MPxNFawsdTLjZaWbYL9y9tmWiE9OwM3MMYU9TsqNhl7uQaBedM+yGe1nFBYy msqg== X-Gm-Message-State: AOJu0YzBrbE8NS/YT1r6YG8ETaBuUtPXdVMh0FY+RWCrYO/gohJWv2FX 9HtUM2Gn6os+QbKKDJfXhzfbIVmbrQpLaL3/QMfZimJ51Qg8ZM2eKiuNb97DLVfn3bLlkwx+Jzq 0 X-Received: by 2002:a17:902:d486:b0:1e0:2977:9dfc with SMTP id c6-20020a170902d48600b001e029779dfcmr5404892plg.55.1714003258304; Wed, 24 Apr 2024 17:00:58 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 34/45] target/hppa: Improve hppa_cpu_dump_state Date: Wed, 24 Apr 2024 17:00:12 -0700 Message-Id: <20240425000023.1002026-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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 Print both raw IAQ_Front and IAQ_Back as well as the GVAs. Print control registers in system mode. Print floating point register if CPU_DUMP_FPU. Signed-off-by: Richard Henderson --- target/hppa/helper.c | 60 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/target/hppa/helper.c b/target/hppa/helper.c index 9d217d051c..7d22c248fb 100644 --- a/target/hppa/helper.c +++ b/target/hppa/helper.c @@ -102,6 +102,19 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong psw) void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags) { +#ifndef CONFIG_USER_ONLY + static const char cr_name[32][5] = { + "RC", "CR1", "CR2", "CR3", + "CR4", "CR5", "CR6", "CR7", + "PID1", "PID2", "CCR", "SAR", + "PID3", "PID4", "IVA", "EIEM", + "ITMR", "ISQF", "IOQF", "IIR", + "ISR", "IOR", "IPSW", "EIRR", + "TR0", "TR1", "TR2", "TR3", + "TR4", "TR5", "TR6", "TR7", + }; +#endif + CPUHPPAState *env = cpu_env(cs); target_ulong psw = cpu_hppa_get_psw(env); target_ulong psw_cb; @@ -117,11 +130,12 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags) m = UINT32_MAX; } - qemu_fprintf(f, "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx - " IIR %0*" PRIx64 "\n", + qemu_fprintf(f, "IA_F %08" PRIx64 ":%0*" PRIx64 " (" TARGET_FMT_lx ")\n" + "IA_B %08" PRIx64 ":%0*" PRIx64 " (" TARGET_FMT_lx ")\n", + env->iasq_f >> 32, w, m & env->iaoq_f, hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f), - hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b), - w, m & env->cr[CR_IIR]); + env->iasq_b >> 32, w, m & env->iaoq_b, + hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b)); psw_c[0] = (psw & PSW_W ? 'W' : '-'); psw_c[1] = (psw & PSW_E ? 'E' : '-'); @@ -154,12 +168,46 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags) (i & 3) == 3 ? '\n' : ' '); } #ifndef CONFIG_USER_ONLY + for (i = 0; i < 32; i++) { + qemu_fprintf(f, "%-4s %0*" PRIx64 "%c", + cr_name[i], w, m & env->cr[i], + (i & 3) == 3 ? '\n' : ' '); + } + qemu_fprintf(f, "ISQB %0*" PRIx64 " IOQB %0*" PRIx64 "\n", + w, m & env->cr_back[0], w, m & env->cr_back[1]); for (i = 0; i < 8; i++) { qemu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32), (i & 3) == 3 ? '\n' : ' '); } #endif - qemu_fprintf(f, "\n"); - /* ??? FR */ + if (flags & CPU_DUMP_FPU) { + static const char rm[4][4] = { "RN", "RZ", "R+", "R-" }; + char flg[6], ena[6]; + uint32_t fpsr = env->fr0_shadow; + + flg[0] = (fpsr & R_FPSR_FLG_V_MASK ? 'V' : '-'); + flg[1] = (fpsr & R_FPSR_FLG_Z_MASK ? 'Z' : '-'); + flg[2] = (fpsr & R_FPSR_FLG_O_MASK ? 'O' : '-'); + flg[3] = (fpsr & R_FPSR_FLG_U_MASK ? 'U' : '-'); + flg[4] = (fpsr & R_FPSR_FLG_I_MASK ? 'I' : '-'); + flg[5] = '\0'; + + ena[0] = (fpsr & R_FPSR_ENA_V_MASK ? 'V' : '-'); + ena[1] = (fpsr & R_FPSR_ENA_Z_MASK ? 'Z' : '-'); + ena[2] = (fpsr & R_FPSR_ENA_O_MASK ? 'O' : '-'); + ena[3] = (fpsr & R_FPSR_ENA_U_MASK ? 'U' : '-'); + ena[4] = (fpsr & R_FPSR_ENA_I_MASK ? 'I' : '-'); + ena[5] = '\0'; + + qemu_fprintf(f, "FPSR %08x flag %s enable %s %s\n", + fpsr, flg, ena, rm[FIELD_EX32(fpsr, FPSR, RM)]); + + for (i = 0; i < 32; i++) { + qemu_fprintf(f, "FR%02d %016" PRIx64 "%c", + i, env->fr[i], (i & 3) == 3 ? '\n' : ' '); + } + } + + qemu_fprintf(f, "\n"); } From patchwork Thu Apr 25 00:00:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791786 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119608wrq; Wed, 24 Apr 2024 17:11:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVR/owsILm4G2sIRByE/Vs/L4WMzUigDY8u6j5oClLSNSyAAmzS4IfuG77vtSSbjsoewpNuHuVjLYFDrriZgdc2 X-Google-Smtp-Source: AGHT+IFA8vf+g9uBqeU2JTH3eKh//PcL9KZYi8We1VkOELEYZSL5kT0hWjsIAakoAaIcPBtx7EiN X-Received: by 2002:a05:6122:20a3:b0:4d8:7789:dd0d with SMTP id i35-20020a05612220a300b004d87789dd0dmr4512404vkd.15.1714003915917; Wed, 24 Apr 2024 17:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003915; cv=none; d=google.com; s=arc-20160816; b=JB5iZa/P1ZNSDJKeS3/hmj+1DKsEdZ5wvQYzXzI0v06EtsD90RVHeL0o+nBvvBD6hN WOaNclxOV5sP6t/7EP8+Amo8S2EPXjg5T9UaM7gXpc90OZJ+wXlnqdkWKx7Fg8MV0YxB /FU29jU7EFU8cuZqjTEkM826kDFSpZT5baXvv8MO5Qg+8eZG/1JGmTj+eQI2QJnIq4oT RyKsTmFxvgPNY5VJDCpXxmXKEm66egENMy8fZLeO+f8fKfXCjza0TdHILFrcaFpEp97U o1OmCqGT8Z6SyZ4id1mmq7VcGK6ZuM4TGKhg6yiHTqIMXiYnVq/tSNecmRk9NveE4vgN ZI7A== 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=od3C8Is61jrhdrT5iIGSRyg1mQHZLFI1AAa4tyjr1AQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=LxmS+OYFFSUxO8VFkpPcXlxwf7G7VgORIc3eIdEeLrc5LwInu2n0piaYDn2FJTQLCv oUmw5JxES6N/LYVe9fQK/CjPSXK6kBlhUqvVS3sx80mceJ6Oiv47QZVN1BpKlHGEbv89 oX0eLfrpeXQO9ZN7sL+4OGD8MezKlNHMnQU+ruXzqEZ08h7FIOMnewqKGX8dXoTiQ/Uu 1yGrTE79mxAo721E8YoRrewHrqDYqZe5AOQCqZBSE4N8QSv4y3QnYsSSK7+jBvnL4jUY 4QHhYlTIU8r5cy+nAr/Q+Zc6nacbHngm0IC6YY9zoOB0qrg3d1KqlCgG7hVluvxaU3yZ NI3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GLhvnZLs; 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 j29-20020a05620a0a5d00b0078f1530f4dfsi14695655qka.24.2024.04.24.17.11.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:11:55 -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=GLhvnZLs; 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 1rzmYf-0000fd-5i; Wed, 24 Apr 2024 20:01:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXx-0008J2-SD for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:06 -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 1rzmXs-0006JR-MU for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:03 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a78c2e253aso372807a91.3 for ; Wed, 24 Apr 2024 17:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003259; x=1714608059; 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=od3C8Is61jrhdrT5iIGSRyg1mQHZLFI1AAa4tyjr1AQ=; b=GLhvnZLsI/3Z+uNKovnRt+BWaFkiBU+Ql4jGJyV7A9KBoEC3KG9Y6fkFwEF+kzpyEo cLYU94A7ekOeW20ChvbcD6xvQdTJpbjmN+VPpgj/q70egYOHFFr4+0LnVz7xGAxsLaTJ Jx9miizvppgXAMoeu2Z0Su16zAPZ1yIh238+XLaUWFuTtzRZ1xsJAMaHv5t/SQalBxnQ sb6DOY2FnxHxBlGryIdfmP/rINJh9/iCsahg5azPIp56098VHBfcD5HyJd360N3+03W0 +Xtitx3rIGEsz12YdSCHqqDnHlv9lEww+bMZnssUl6oWq8NUZ08+fzf0ZvFQ1820uP/H YQUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003259; x=1714608059; 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=od3C8Is61jrhdrT5iIGSRyg1mQHZLFI1AAa4tyjr1AQ=; b=nI8HnXGl/hoNWe8oz+3TkVy/dITAgBSNU6bZU7oSTsNDuYayXn8vRgRLyNcUJhJ6dG QPMtZBn2w+WswXQu42un50Z1Vrm1dPy/qxvVCZS90c0mfKHQ8LCb1JygYWCoCKHHU7xE aC4V//9nUlm5GBlLlepxAtzLuHKQgIXkrsvDWXYK82iFdfVgAgh6kVRVuY3k18RRr1t9 IEmdP8jLiO16xEYlOLAKJrakH2TGXL+klAn0jfNUNrmXi2YjZLU9qLNhzBagJS2z/eRP t7n0Y6R/SbcQ1hn1QMIOlcel4MPekL+vPQvpmQNdbsWdxlygOxZruvrA4ObXcpS2Gnfp rkBw== X-Gm-Message-State: AOJu0YyDFLf6U/ZsB/xJE4sY7+wFRwopiv3ZC7pJHRoShh5l9sdHZ8w6 b7mkp1kkIyd7zE0bCnBTLY7CiisjXoBf6fijRI2/nC8nUIbYbUr+1DkXTU8xKaevggWHktQQy+d 8 X-Received: by 2002:a17:90a:c244:b0:2af:9e88:d41d with SMTP id d4-20020a17090ac24400b002af9e88d41dmr1791320pjx.23.1714003259102; Wed, 24 Apr 2024 17:00:59 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 35/45] target/hppa: Split PSW X and B into their own field Date: Wed, 24 Apr 2024 17:00:13 -0700 Message-Id: <20240425000023.1002026-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 Generally, both of these bits are cleared at the end of each instruction. By separating these, we will be able to clear both with a single insn, instead of 2 or 3. Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 3 ++- target/hppa/helper.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 66cae795bd..629299653d 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -214,7 +214,8 @@ typedef struct CPUArchState { uint64_t fr[32]; uint64_t sr[8]; /* stored shifted into place for gva */ - target_ulong psw; /* All psw bits except the following: */ + uint32_t psw; /* All psw bits except the following: */ + uint32_t psw_xb; /* X and B, in their normal positions */ target_ulong psw_n; /* boolean */ target_long psw_v; /* in most significant bit */ diff --git a/target/hppa/helper.c b/target/hppa/helper.c index 7d22c248fb..b79ddd8184 100644 --- a/target/hppa/helper.c +++ b/target/hppa/helper.c @@ -54,7 +54,7 @@ target_ulong cpu_hppa_get_psw(CPUHPPAState *env) psw |= env->psw_n * PSW_N; psw |= (env->psw_v < 0) * PSW_V; - psw |= env->psw; + psw |= env->psw | env->psw_xb; return psw; } @@ -76,8 +76,8 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong psw) } psw &= ~reserved; - env->psw = psw & (uint32_t)~(PSW_N | PSW_V | PSW_CB); - + env->psw = psw & (uint32_t)~(PSW_B | PSW_N | PSW_V | PSW_X | PSW_CB); + env->psw_xb = psw & (PSW_X | PSW_B); env->psw_n = (psw / PSW_N) & 1; env->psw_v = -((psw / PSW_V) & 1); From patchwork Thu Apr 25 00:00:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791792 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119695wrq; Wed, 24 Apr 2024 17:12:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWOZTnrJH7fS0ik1fqmZydh2uvE8u7pfwo9mX2se1MYfZrSRQ9yirc5tpj/4QEKb0cB8MxtdldIsUcGXXGV0wub X-Google-Smtp-Source: AGHT+IFoDtJanOgqvhmxS0z8rZ/vfZPTtgx9UD4IG09n3979KuPi3/S0Vknna/d/yUCg2bQ5ccQj X-Received: by 2002:a05:622a:2a16:b0:439:8bae:6ab2 with SMTP id hc22-20020a05622a2a1600b004398bae6ab2mr5264901qtb.17.1714003930623; Wed, 24 Apr 2024 17:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003930; cv=none; d=google.com; s=arc-20160816; b=LV12IMmCOHFAlzZwXUt3iFBxfuFqNoWUKGxKrc5xcR3vh0w2oL8wGtO5RC6zJqBvl+ zpOhHBIOCDYOBkC385WcKraAQCcNZy1pZ9Pa4x8cbwxHfKzELunKEbu5vAhhsXiaC/7m oLUCEZWbtaJCRpzmMNxQiDKLxiWr3kQRBXqRCZqQ7My/aUI09PsngY5JXHipcLA8v+p9 XfTy+m1ZrLF1hIkVBbGUnJoNP8snkui1lqo57EymTkSi2hWZMYny/+U0otKJ8jnpHlSb 6hsalhEI4z/OKh25caACvLHv2jIC4p9Rzk9PgZCL/kGOBzDA0L0iY+7MROXQb12idWyy jk4A== 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=t9rRB1yQ84JakurQq570U1hVIhBDmleLElX5WFKxgDc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=G6SLpPRn4cAc9kOShVC62/lXcSZJewAYdyTKOzusJWrf3lyTsBaOUpYqyPbXs8Xu1q DR8Pxy/qjJ5gzO+abqX9rko6KQTyjWCpgccDCj4eb1dtNDNGmBgjqUW/vPWwXy4HjDWO g/LD2YmN/RvhvK8Lyotgb+xpxbm0WQW7z/Cox5P7bNO38P2mc9ilGeW8BrsLxOyWZfgV mF+1sBzsspm/4K0P7ZV6/vaXhNy24YMOf8UOWSE2iMQDbs164pvdGIl+hcAW7yXg/Jfx EJ1GHiN/OrUACafWFBNKtyMnVFo1bcLHOvNLWIZdW1a4I88FZNz7+UaoFbCxL8VjEwdr 7Lug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PbkFEXFe; 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 m25-20020ae9e019000000b0078edf1f4c40si15622767qkk.197.2024.04.24.17.12.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:12:10 -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=PbkFEXFe; 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 1rzmYn-00014P-1M; Wed, 24 Apr 2024 20:01:57 -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 1rzmXx-0008J5-Uu for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:06 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXu-0006Jg-9W for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:05 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e51398cc4eso3768005ad.2 for ; Wed, 24 Apr 2024 17:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003260; x=1714608060; 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=t9rRB1yQ84JakurQq570U1hVIhBDmleLElX5WFKxgDc=; b=PbkFEXFe8VP8xBBxVwjIi9F5TdNrY7QwPkTwFpsaEuaVvEt+lQCjZz8COgCWTJK7dd cQJDrG+1URIo8wGY7WFNQ8eeGIy+1HczSzOHYviqWXu+fmlOur8pRUKa981YqMRLHD7t cvP8VBnQj+KL6fPYeJAXRfgfaF0pb1AWHxCRuPV9pOrkYq8JW1djqgxWWpGUV+hZ18M1 tlMaJ7buNJDAgVAa+jIJlTO9PMzsH4rUGdUrWHcmSm5TtN1IKt8f2b9eUukATkJ3RyUH NORWtCAc35BpH5o1HrBiW3mDNM9HtaO/fjdGRInP/H0Ffi1OW0RCNqmUPzDk21ORGQNX 4f8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003260; x=1714608060; 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=t9rRB1yQ84JakurQq570U1hVIhBDmleLElX5WFKxgDc=; b=SwioiM2SfS2VdGq+nl5hmFGY0l8Q/T03xOyMolKNM207mMwUkhC+ui2q98j7lrGogl YxTM53SO5ajyD6D6Y5XsVX2M0l/ssW/3aYlC8fZ8h4HeOwourWytNFGGlyzJd1/QKvQi P2wsKD4lz510hsU3elAkRYKe/8XWOkXGOjFuoIU8xE5H0UZahUXzAzVexo+TxUkxW57R zFOWpygH2uUH0nMhK80yNjYH7Jlji97kueKqQ5RdkU7mXL05ltexYeA7a/MlwkbjkBQF 0olKMDVib5Iwc7Eb6P3crKzwyLtX3FEv6MCN9kukiitVTUvUTF01u4ihoex+EzSzJKWn Q8Ug== X-Gm-Message-State: AOJu0YyR3Htjg1gt82HLnRyHZmSFnpsU/HQpTVfdjykQL3xmQWdwt6r2 2jLHGp3m4ygnGreTd4ZlJLZhtCnZC7VoJvak8DQ5MdwsB+Srk6egOXOlQpBvpGMzs0jj/X03Flm Z X-Received: by 2002:a17:902:e5cb:b0:1e2:bbc0:a671 with SMTP id u11-20020a170902e5cb00b001e2bbc0a671mr4808796plf.52.1714003259986; Wed, 24 Apr 2024 17:00:59 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.00.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:00:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 36/45] target/hppa: Manage PSW_X and PSW_B in translator Date: Wed, 24 Apr 2024 17:00:14 -0700 Message-Id: <20240425000023.1002026-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 PSW_X is cleared after every instruction, and only set by RFI. PSW_B is cleared after every non-branch, or branch not taken, and only set by taken branches. We can clear both bits with a single store, at most once per TB. Taken branches set PSW_B, at most once per TB. Signed-off-by: Richard Henderson --- target/hppa/cpu.c | 10 ++++++--- target/hppa/translate.c | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 003af63e20..5f0df0697a 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -50,7 +50,7 @@ static vaddr hppa_cpu_get_pc(CPUState *cs) void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, uint64_t *pcsbase, uint32_t *pflags) { - uint32_t flags = env->psw_n * PSW_N; + uint32_t flags = 0; uint64_t cs_base = 0; /* @@ -80,11 +80,14 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, cs_base |= env->iaoq_b & ~TARGET_PAGE_MASK; } + /* ??? E, T, H, L bits need to be here, when implemented. */ + flags |= env->psw_n * PSW_N; + flags |= env->psw_xb; + flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); + #ifdef CONFIG_USER_ONLY flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; #else - /* ??? E, T, H, L, B bits need to be here, when implemented. */ - flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); if ((env->sr[4] == env->sr[5]) & (env->sr[4] == env->sr[6]) & (env->sr[4] == env->sr[7])) { @@ -103,6 +106,7 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs, /* IAQ is always up-to-date before goto_tb. */ cpu->env.psw_n = (tb->flags & PSW_N) != 0; + cpu->env.psw_xb = tb->flags & (PSW_X | PSW_B); } static void hppa_restore_state_to_opc(CPUState *cs, diff --git a/target/hppa/translate.c b/target/hppa/translate.c index fb5bc12986..a49cf09518 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -83,7 +83,9 @@ typedef struct DisasContext { uint32_t tb_flags; int mmu_idx; int privilege; + uint32_t psw_xb; bool psw_n_nonzero; + bool psw_b_next; bool is_pa20; bool insn_start_updated; @@ -262,6 +264,7 @@ static TCGv_i64 cpu_psw_n; static TCGv_i64 cpu_psw_v; static TCGv_i64 cpu_psw_cb; static TCGv_i64 cpu_psw_cb_msb; +static TCGv_i32 cpu_psw_xb; void hppa_translate_init(void) { @@ -314,6 +317,9 @@ void hppa_translate_init(void) *v->var = tcg_global_mem_new(tcg_env, v->ofs, v->name); } + cpu_psw_xb = tcg_global_mem_new_i32(tcg_env, + offsetof(CPUHPPAState, psw_xb), + "psw_xb"); cpu_iasq_f = tcg_global_mem_new_i64(tcg_env, offsetof(CPUHPPAState, iasq_f), "iasq_f"); @@ -508,6 +514,25 @@ static void load_spr(DisasContext *ctx, TCGv_i64 dest, unsigned reg) #endif } +/* + * Write a value to psw_xb, bearing in mind the known value. + * To be used just before exiting the TB, so do not update the known value. + */ +static void store_psw_xb(DisasContext *ctx, uint32_t xb) +{ + tcg_debug_assert(xb == 0 || xb == PSW_B); + if (ctx->psw_xb != xb) { + tcg_gen_movi_i32(cpu_psw_xb, xb); + } +} + +/* Write a value to psw_xb, and update the known value. */ +static void set_psw_xb(DisasContext *ctx, uint32_t xb) +{ + store_psw_xb(ctx, xb); + ctx->psw_xb = xb; +} + /* Skip over the implementation of an insn that has been nullified. Use this when the insn is too complex for a conditional move. */ static void nullify_over(DisasContext *ctx) @@ -575,6 +600,8 @@ static bool nullify_end(DisasContext *ctx) /* For NEXT, NORETURN, STALE, we can easily continue (or exit). For UPDATED, we cannot update on the nullified path. */ assert(status != DISAS_IAQ_N_UPDATED); + /* Taken branches are handled manually. */ + assert(!ctx->psw_b_next); if (likely(null_lab == NULL)) { /* The current insn wasn't conditional or handled the condition @@ -1841,6 +1868,7 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, if (is_n) { if (use_nullify_skip(ctx)) { nullify_set(ctx, 0); + store_psw_xb(ctx, 0); gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); ctx->base.is_jmp = DISAS_NORETURN; return true; @@ -1848,20 +1876,24 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, ctx->null_cond.c = TCG_COND_ALWAYS; } ctx->iaq_n = &ctx->iaq_j; + ctx->psw_b_next = true; } else { nullify_over(ctx); install_link(ctx, link, false); if (is_n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); + store_psw_xb(ctx, 0); gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); } else { nullify_set(ctx, is_n); + store_psw_xb(ctx, PSW_B); gen_goto_tb(ctx, 0, &ctx->iaq_b, &ctx->iaq_j); } nullify_end(ctx); nullify_set(ctx, 0); + store_psw_xb(ctx, 0); gen_goto_tb(ctx, 1, &ctx->iaq_b, NULL); ctx->base.is_jmp = DISAS_NORETURN; } @@ -1892,6 +1924,7 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, n = is_n && disp < 0; if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); + store_psw_xb(ctx, 0); next = iaqe_incr(&ctx->iaq_b, 4); gen_goto_tb(ctx, 0, &next, NULL); } else { @@ -1900,6 +1933,7 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, ctx->null_lab = NULL; } nullify_set(ctx, n); + store_psw_xb(ctx, 0); gen_goto_tb(ctx, 0, &ctx->iaq_b, NULL); } @@ -1911,9 +1945,11 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, next = iaqe_branchi(ctx, disp); if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); + store_psw_xb(ctx, 0); gen_goto_tb(ctx, 1, &next, NULL); } else { nullify_set(ctx, n); + store_psw_xb(ctx, PSW_B); gen_goto_tb(ctx, 1, &ctx->iaq_b, &next); } @@ -1947,6 +1983,7 @@ static bool do_ibranch(DisasContext *ctx, unsigned link, ctx->null_cond.c = TCG_COND_ALWAYS; } ctx->iaq_n = &ctx->iaq_j; + ctx->psw_b_next = true; return true; } @@ -1956,9 +1993,11 @@ static bool do_ibranch(DisasContext *ctx, unsigned link, if (is_n && use_nullify_skip(ctx)) { install_iaq_entries(ctx, &ctx->iaq_j, NULL); nullify_set(ctx, 0); + store_psw_xb(ctx, 0); } else { install_iaq_entries(ctx, &ctx->iaq_b, &ctx->iaq_j); nullify_set(ctx, is_n); + store_psw_xb(ctx, PSW_B); } tcg_gen_lookup_and_goto_ptr(); @@ -2385,6 +2424,7 @@ static bool trans_halt(DisasContext *ctx, arg_halt *a) { CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); #ifndef CONFIG_USER_ONLY + set_psw_xb(ctx, 0); nullify_over(ctx); gen_helper_halt(tcg_env); ctx->base.is_jmp = DISAS_NORETURN; @@ -2396,6 +2436,7 @@ static bool trans_reset(DisasContext *ctx, arg_reset *a) { CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); #ifndef CONFIG_USER_ONLY + set_psw_xb(ctx, 0); nullify_over(ctx); gen_helper_reset(tcg_env); ctx->base.is_jmp = DISAS_NORETURN; @@ -2790,6 +2831,9 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf_d *a) if ((rt == 10 || rt == 31) && r1 == rt && r2 == rt) { /* PAUSE */ /* No need to check for supervisor, as userland can only pause until the next timer interrupt. */ + + set_psw_xb(ctx, 0); + nullify_over(ctx); /* Advance the instruction queue. */ @@ -4574,6 +4618,7 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->cs = cs; ctx->tb_flags = ctx->base.tb->flags; ctx->is_pa20 = hppa_is_pa20(cpu_env(cs)); + ctx->psw_xb = ctx->tb_flags & (PSW_X | PSW_B); #ifdef CONFIG_USER_ONLY ctx->privilege = PRIV_USER; @@ -4660,6 +4705,7 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) */ ctx->iaq_n = NULL; memset(&ctx->iaq_j, 0, sizeof(ctx->iaq_j)); + ctx->psw_b_next = false; if (unlikely(ctx->null_cond.c == TCG_COND_ALWAYS)) { ctx->null_cond.c = TCG_COND_NEVER; @@ -4672,6 +4718,10 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) ret = ctx->base.is_jmp; assert(ctx->null_lab == NULL); } + + if (ret != DISAS_NORETURN) { + set_psw_xb(ctx, ctx->psw_b_next ? PSW_B : 0); + } } /* If the TranslationBlock must end, do so. */ From patchwork Thu Apr 25 00:00:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791766 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118240wrq; Wed, 24 Apr 2024 17:08:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWVY4NWUVikLf+lT4kkcqrXnjkcl3el6WUP9ZIDpqF5JGEbmvhKJxglxWOgajyGhyYs5E2bV5q2QBFV8E4XUKqw X-Google-Smtp-Source: AGHT+IHMDLEFzWiO0LtcdWqW0rBWrEtFQIvus8bbDcMr5DMPSryeo3oiLHtSN3lZ3BfXe1Kg1IeK X-Received: by 2002:a0c:f002:0:b0:69b:588a:f764 with SMTP id z2-20020a0cf002000000b0069b588af764mr4614341qvk.5.1714003697167; Wed, 24 Apr 2024 17:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003697; cv=none; d=google.com; s=arc-20160816; b=UPBxDQfnSgJ7myT0xbhtM5Jdj3SlaGmA61qmj+zvxwE+NFbJAtdcVTWxnDxElz6M36 cxuuPsRb4+UebQGxRodhhgb08xXlb0br256ipc0emLbOH/FU3FND8c8WqY9xw1IAPoGH L/SzQo2msakGkdWCPlWxjkj7CBWc/qCU2jnmgm7sUxv7050iiDOeSeypRNxsGSG8IDq4 J7s5iGvi+yqbf+PeHxmKxTjsXIF3/g7j1fSoBXcQiOm11OByhU+1otWl2oq0v18dXytG Y4TrgGcOiwIeMc5o4GgnkSNWDT13OgZsh8vlug1W05AXjoOJSXry6gHOZ3L5LNvqP+Eg lVzg== 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=nB3u9roeckcA1AeJ8eQuq7GKVBVSdTSl/FRX2Yw2q30=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=rTzX6Tgvv1hscbMJ0CurXjsGZXNID8xgey46TzHukhaDfW41+i34B9PboPGK4QJB7w IY5tB/QXkpy8k6LUWeIjtnk5ijAbeXWBdB0ltMr/J+VZJzf7/fZBrYIJDQEkS3pPJ5QS ftoUtxIMAIZVg42CCfc6uU1eHCXUpfTNfd7goItRZF5ww9vHfEt1Osx1yCULXYyJno1h x2PT6v7UR3fsVwoyKKwcJNfqasj1R31iqsU5hJZEOwjnJj/Z/9Ijfhjj+2eE3rbE1Tt+ SgP2Z/7HBkINWchazXXFWPQ4hQ/OjRg/ooi7SHGI6Wotx6YHKUwTXAwQo00I+aEG1sly pJfw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cVvXfVXq; 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 if4-20020a0562141c4400b006a0423b368dsi16437707qvb.325.2024.04.24.17.08.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:17 -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=cVvXfVXq; 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 1rzmYK-0008Re-FO; Wed, 24 Apr 2024 20:01:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXz-0008Je-2e for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:07 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmXv-0006Jr-UU for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:06 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e9320c2ef6so2777025ad.2 for ; Wed, 24 Apr 2024 17:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003261; x=1714608061; 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=nB3u9roeckcA1AeJ8eQuq7GKVBVSdTSl/FRX2Yw2q30=; b=cVvXfVXqk/w0mKPLcJ4nK4lvB244EQ+14We0heQ6ikX2GfHLgDJN2NaBCJYMoahwe6 h/H3x+ByxUri9rh6tV8Vlv+dCeUuJF7q6rDn61Q5fCnBN/TNv/ZHX2FKSQZwaFbDDqjI wGwhvOUqhKizysfwoP+kZeCAo0sgAG9mesEMlwKPV3hV274/7QZHdwBfN3oehN935+MA xit2gbRPqgqkRasxi8VacC9ZVuXiicCSGit3bKv4MD3NLJSPOrCEmJHBEAqUv9KYbbOJ dvIn/SE7kxDDmxs8ZdlpLXbrCxeWOw001w8nJqXUdK8RTA3MYQE3oIjoV/VaZYCshK52 PvIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003261; x=1714608061; 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=nB3u9roeckcA1AeJ8eQuq7GKVBVSdTSl/FRX2Yw2q30=; b=JSMI1tEVCrvVqbcx9L/BRXq4wRHD73K/DJfd18NMpb2rpP5J/WIXkfe/1dKCmEyUtQ 4R0Ey3l3S9rGAuT5TIdZrXNJoiPhA0GeI45wtpBa9c5CPmvMx7OydgptqG03Gxfn4oiI YGXnY03luugd3qDf4D2TvbAzdNI46Y+BbfDQB9NDNeA4Ep7V6StKwxbo187cExXSF71k 3LlLGkKsdxONAx6tToRo5Dmgwcu1MDQmS0n5bDgXdYdXbz+L+QEMY8+iN2uhu46QBmzg cE1szvLX2C3eE623L6winhLGDMsm2yrqeklAUNFRzkrmHMGR9jNWkCjapeDzBtTH4kpl HW1A== X-Gm-Message-State: AOJu0YzkHrT8GNF0rVIAJT4aE7yIki2wloWtUVhCtkV7lzUvLGR8TF4W YFMEzOkocxOhut7CO0eQSp0qLJM0SM+FeD9vjLaHv2QQXirVX2xA2vDta61u5s0APU1bgQQK/hw z X-Received: by 2002:a17:903:120b:b0:1e2:16b6:e9b6 with SMTP id l11-20020a170903120b00b001e216b6e9b6mr4787724plh.48.1714003260824; Wed, 24 Apr 2024 17:01:00 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.01.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:01:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 37/45] target/hppa: Implement PSW_B Date: Wed, 24 Apr 2024 17:00:15 -0700 Message-Id: <20240425000023.1002026-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 PSW_B causes B,GATE to trap as an illegal instruction, removing the sequential execution test that was merely an approximation. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index a49cf09518..a4200742bd 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2060,11 +2060,8 @@ static void do_page_zero(DisasContext *ctx) g_assert_not_reached(); } - /* Check that we didn't arrive here via some means that allowed - non-sequential instruction execution. Normally the PSW[B] bit - detects this by disallowing the B,GATE instruction to execute - under such conditions. */ - if (iaqe_variable(&ctx->iaq_b) || ctx->iaq_b.disp != 4) { + /* If PSW[B] is set, the B,GATE insn would trap. */ + if (ctx->psw_xb & PSW_B) { goto do_sigill; } @@ -3963,23 +3960,13 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) { int64_t disp = a->disp; - nullify_over(ctx); - - /* Make sure the caller hasn't done something weird with the queue. - * ??? This is not quite the same as the PSW[B] bit, which would be - * expensive to track. Real hardware will trap for - * b gateway - * b gateway+4 (in delay slot of first branch) - * However, checking for a non-sequential instruction queue *will* - * diagnose the security hole - * b gateway - * b evil - * in which instructions at evil would run with increased privs. - */ - if (iaqe_variable(&ctx->iaq_b) || ctx->iaq_b.disp != ctx->iaq_f.disp + 4) { + /* Trap if PSW[B] is set. */ + if (ctx->psw_xb & PSW_B) { return gen_illegal(ctx); } + nullify_over(ctx); + #ifndef CONFIG_USER_ONLY if (ctx->tb_flags & PSW_C) { int type = hppa_artype_for_page(cpu_env(ctx->cs), ctx->base.pc_next); From patchwork Thu Apr 25 00:00:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791770 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118466wrq; Wed, 24 Apr 2024 17:08:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXw5zOoMsNuWYGn8oCk5D7qmSH+zk4h28utjwKk6BIV5Bk3lnc+hhpMJ34Vao6e82ilpf6mNZ945K05+r7qRXGj X-Google-Smtp-Source: AGHT+IHJy9sHQJxMb2WobEh2u5bmKKDsbtDP+TJb4zCs/zUn5gCFSLNjEQUOl27zV5mgXe/J7xmw X-Received: by 2002:a05:6214:1e7:b0:6a0:418c:5e8f with SMTP id c7-20020a05621401e700b006a0418c5e8fmr4092027qvu.41.1714003728274; Wed, 24 Apr 2024 17:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003728; cv=none; d=google.com; s=arc-20160816; b=ZRvF1FPaTt8GiE03n0ITpX2iokYKcQ4w7UY1PZxS3KwgTB9BYkqUC0mh2JGuqDg/sQ 1CMZMGYUqzc57pVFKLEMrl6hgCVq/d45t0b2lnf5zhA9LOyaQf5pm9s8zuUXiZFAXV+m s6LlRx/+Pf/WThljAlDCy0Am4+05uaUJCXtg1rKK+WEht+WnWG1uUVhvhetoECQv8lIc rRjg0mmlRzpPFCciENLIDwtgge3TYSlq/5IllCON1HPVW1mxL+vbMZosUJNmunMIKJng uChACzr9UeY7S4NkNQcw8SDsxMb7RbrNW02C1CVGHixvczsXCqVxU6F1OIN3Wgwv/lHW myqw== 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=03YkZQCWlVOksTPNxrPCbb3bwvJD4b/91KoJpuBrF7U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=LjiFx5Q7dGBuHshMHZ2LFwsEAQHeEBo0hVSCEb3wZ/zfFzjCU2/U5O64VKweVBJRpo kLWJLh7YEbG25rYcvBerbvpb9w2koWOHOViaOPQPQwQQA8OKeU3tjF9Xlv78rXx7NnSU /SPGwB3hGWcE4rGEgL6CHRTl6s6Z9Q1eVCX9LdajiOgND6LIALaLuqK4G7pC1aRvwDnP 9GXyyH4X2ge0RUqxVHjTLucrNVDBw1yfzF6tynrW3zW+xA91KF9/Fy0lO9baYeGWhSbM sWbKdIvaMch8MRwwzHxCQDTm8j33tND2rx97QnFg3nPoV+Jw3ZpYHzml3KHYSH9/A2Dy EqRg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qY7HYRJ3; 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 m12-20020ad45dcc000000b0069924854b26si16364478qvh.591.2024.04.24.17.08.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:48 -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=qY7HYRJ3; 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 1rzmYK-0008RZ-Aw; Wed, 24 Apr 2024 20:01:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzmXz-0008Jm-Gy for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:07 -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 1rzmXx-0006Jw-LE for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:07 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e36b7e7dd2so3451775ad.1 for ; Wed, 24 Apr 2024 17:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003262; x=1714608062; 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=03YkZQCWlVOksTPNxrPCbb3bwvJD4b/91KoJpuBrF7U=; b=qY7HYRJ3FEPxKKt5807lXFWOWnyqU66BlZRTCTIp65DO6SVsSUfhQsvkWO/N/q11AK 3AUmjPrnGHEQIXgZg1hlJubbLnkZEM9P4+vw60J6lTC/DoidMdzbGBWh+0fOx+E0X+YP sM0fmlLcsxamh7vBwBjG7ZTmr/7AaxJYyEe1Fa3Pnz6kLPl8n7ebnancEko9asCO56V0 BM29mlrQWGcrZyBHPFqJgCmoSJPAC+kbhpfUHsfMwIXifuwRSlMiuVbkcqWboilp1SsU Vr6lYHOsyYAh/Nlo2v1y3tBsco4VtJIczSbCfH07ZQUERZRlKF8XVOb3FCwRm8YnFz2G GOdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003262; x=1714608062; 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=03YkZQCWlVOksTPNxrPCbb3bwvJD4b/91KoJpuBrF7U=; b=QNnF8NsPignzci5biTNkl7hmOwXfxkjucEsx5ppukY7ev9pt3pmAwZhNbZ5SI/Osec ayRrLLHKWMN5wdCcyuhudtKjiM8eY8nkZ42qR85xiAyfvjBHiMUT2dFohE2278hoGYT9 rz6Qaz9JJKfMpKhCxz7wmdD2+lGM0du05JZAw/QRg4pQLEia2ZFfP8H3/iOQGSe4moHK tSUKCYvL9X3CgDHgp+KuqFlAOpPIw1QKnWSUZVo2/JuERlR0rO09M2ttpu4uGN2ZOkRb rJ6sZ6zxfIEEzLWKmdBr7n6mWfCJHZ+/3x9i35rLpLgsll6EthEHJk2N6GullItSVAvo WQmw== X-Gm-Message-State: AOJu0YzB3hjstwko/XIoZjym6jKx+JnpxbIQUrEhKRzLB48PhRSJkfv6 HHPJlyS3+wKYHuZHPei4aVCXJZCtEGwRe5ZnG2y2ffnENnnEt2Ue7N/Rn2w/Re6Cz9iDX93fiIR z X-Received: by 2002:a17:902:e54d:b0:1e2:6165:8086 with SMTP id n13-20020a170902e54d00b001e261658086mr5257851plf.61.1714003261779; Wed, 24 Apr 2024 17:01:01 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.01.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:01:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 38/45] target/hppa: Implement PSW_X Date: Wed, 24 Apr 2024 17:00:16 -0700 Message-Id: <20240425000023.1002026-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use PAGE_WRITE_INV to temporarily enable write permission on for a given page, driven by PSW_X being set. Signed-off-by: Richard Henderson --- target/hppa/mem_helper.c | 46 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 84785b5a5c..5eca5e8a1e 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -295,30 +295,38 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, goto egress; } - /* In reverse priority order, check for conditions which raise faults. - As we go, remove PROT bits that cover the condition we want to check. - In this way, the resulting PROT will force a re-check of the - architectural TLB entry for the next access. */ - if (unlikely(!ent->d)) { - if (type & PAGE_WRITE) { - /* The D bit is not set -- TLB Dirty Bit Fault. */ - ret = EXCP_TLB_DIRTY; - } - prot &= PAGE_READ | PAGE_EXEC; - } - if (unlikely(ent->b)) { - if (type & PAGE_WRITE) { - /* The B bit is set -- Data Memory Break Fault. */ - ret = EXCP_DMB; - } - prot &= PAGE_READ | PAGE_EXEC; - } + /* + * In priority order, check for conditions which raise faults. + * Remove PROT bits that cover the condition we want to check, + * so that the resulting PROT will force a re-check of the + * architectural TLB entry for the next access. + */ if (unlikely(ent->t)) { + prot &= PAGE_EXEC; if (!(type & PAGE_EXEC)) { /* The T bit is set -- Page Reference Fault. */ ret = EXCP_PAGE_REF; } - prot &= PAGE_EXEC; + } else if (!ent->d) { + prot &= PAGE_READ | PAGE_EXEC; + if (type & PAGE_WRITE) { + /* The D bit is not set -- TLB Dirty Bit Fault. */ + ret = EXCP_TLB_DIRTY; + } + } else if (unlikely(ent->b)) { + prot &= PAGE_READ | PAGE_EXEC; + if (type & PAGE_WRITE) { + /* + * The B bit is set -- Data Memory Break Fault. + * Except when PSW_X is set, allow this single access to succeed. + * The write bit will be invalidated for subsequent accesses. + */ + if (env->psw_xb & PSW_X) { + prot |= PAGE_WRITE_INV; + } else { + ret = EXCP_DMB; + } + } } egress: From patchwork Thu Apr 25 00:00:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791763 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1117608wrq; Wed, 24 Apr 2024 17:06:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvo3tad1ptQHDjZDLUL+oDyhps2pkk2ifRe9SOHs2+LqFplFIFCnXUC3in5yJmHl22jatAQY89iBz/Wh5sIvoi X-Google-Smtp-Source: AGHT+IHS+Y+saucZL+TtyoSehQwO+DzzdHcDUPPgLxopELsKGMumnV0/tVo9nNH3whAYu0ktaR3w X-Received: by 2002:a05:620a:1924:b0:790:7964:a654 with SMTP id bj36-20020a05620a192400b007907964a654mr5733438qkb.54.1714003595324; Wed, 24 Apr 2024 17:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003595; cv=none; d=google.com; s=arc-20160816; b=yZxTdiioKe6+5X+MkHaPwLCnRoo3Ws15K/xHp2Bil4cyIGv8EGeAopz4k21r3R29oS qYiP1ZvRAJg7LU2PKZt4JGvovkk2zwTAhBgMW6AS+gcCGFGxmuR97/qcxRaR/H5isjcD pWiRPw9UnVdHgItMwQjGvJaY7xgVRauhquNYEnqXwm4Z8XO1Ds03a+jR1oxLmp7yG1DQ L3EXAn8ePMrJAZkYBS7icAqjx8uu7nWt5bzJy8fujbMIYQ5C1NKGwkOeWoF950FMBSAp leGRtwDkFVG3WD0LggDALwqNpGCo5uJXqwDuNwuXmMaG+fko5BRSMl2JZoV0shaEQ/XB ZGbw== 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=BchewleEa3z2kopUOxAP4EuB5+hh38PFClM+ZeDHVn8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=0hcfmHmx+1k8xCxGskA+z6iL2kRNS3qrHdCkqVTAHiL8ujKSg9ED9Tq9FR1BJgE+MG lJmGEpYgkTrolZsyR3iMjvFkenR5vk3UF4S4AJ5Y87zPyeJhIZEze5+kg8Wta5XVQ/1J axsZA0bz6jbvMz9J2lr0q4qoyJbvI5swQwFazRf0ifw8gsyGw6NwOmL/HScbmCdWKwpX zYVFzhVHKjvQ+JwlEWITQv7RgGvO0FbrCIoX1LpdBjauWXMUOcesRodFRvrkOJoxK32c rS/ehtZ8fO95PakubuGitKk4pUgcp+DRXianSzDbFTt3FuCFsw/4I6d4tZcl405EoYSf Ldbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R8khUTNk; 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 vw17-20020a05620a565100b0078eba057e19si16507430qkn.752.2024.04.24.17.06.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:06:35 -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=R8khUTNk; 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 1rzmYM-0008SQ-Fg; Wed, 24 Apr 2024 20:01:31 -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 1rzmY0-0008Jx-33 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:08 -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 1rzmXx-0006KA-L6 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:01:07 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e3c3aa8938so2854235ad.1 for ; Wed, 24 Apr 2024 17:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003262; x=1714608062; 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=BchewleEa3z2kopUOxAP4EuB5+hh38PFClM+ZeDHVn8=; b=R8khUTNkCeQcvwu7C+LuItdc1QI6WzO7P/dbWJ9/XTDXjEiBXcF1vXQtzgEMhi7X5B 7Iwqjc3b+KazyEBRLj0cxbX5dhp1NwWnGIFUiLMjNkj5ESN8YOP+sZSEPj9r3g1DMjVe JTucQy1nSVbG91nxitbm2nVdIuOO94YCXakJ7RWY4nJhR/QdNoESEa1Tsxne+cb2fGzp xTxebT1hQYo8ZrjWR9ybLraLK3oEkJzKHWhIkRKlUeoYhypYOzCSDNf9mOnCCz9FCwYB Ufbsq/iEDIy2xQjbHXe3n1NTmf8aeVXx/s5k+Prw+xw4CavcL0caYXBBiRz3Wk4A+mA/ 7oJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003262; x=1714608062; 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=BchewleEa3z2kopUOxAP4EuB5+hh38PFClM+ZeDHVn8=; b=CcU/lJkCqRyYCMkubdEbBGP6v/9KqetX1XieIKGVHsySFAC3pdpXEAg1eCI0AevB9l 3Zv0urnvOrAHN2tGPqrJsu63Vowf+QClMxudhAG3YGwk9g1Qis2gLuNqFqxjKXukyYGN BoxYMMQ+rDaxNMENbRvqByPUk9ZNMDwwtqZRcLEWyH17OLXWYO5AFprTDM3fjhjFMdeN bgYIg4L0Wge+0KjtaehD4C5i3+4PFhL3NPS5B6uEZvFOu7vEt34VRo0R1Jl2rPiDwOl9 KpIItsAegIOtg4/wtFxxYYT67SOOA6xkIv+CaOBHCpjRThqLEZJlDrywiELfwgJw3F+o Kokw== X-Gm-Message-State: AOJu0Yx6YK9vtDPchh1yItLeTZPTNs72BTj2IBC+tYFoyPZIlExfMUYG DgylgtjwmEVI9Ds+csZudS7bZYiZe+bpOll2M4V3XsukhDj+/ts5a7qKCj7hxFhJit9vBTraNSS i X-Received: by 2002:a17:902:6e02:b0:1e8:ef23:80f6 with SMTP id u2-20020a1709026e0200b001e8ef2380f6mr3904337plk.37.1714003262632; Wed, 24 Apr 2024 17:01:02 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm12465715plg.156.2024.04.24.17.01.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:01:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 39/45] target/hppa: Drop tlb_entry return from hppa_get_physical_address Date: Wed, 24 Apr 2024 17:00:17 -0700 Message-Id: <20240425000023.1002026-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The return-by-reference is never used. Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 3 +-- target/hppa/int_helper.c | 2 +- target/hppa/mem_helper.c | 19 ++++--------------- target/hppa/op_helper.c | 3 +-- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 629299653d..5f3e99cdc4 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -377,8 +377,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, - int type, hwaddr *pphys, int *pprot, - HPPATLBEntry **tlb_entry); + int type, hwaddr *pphys, int *pprot); void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index 97e5f0b9a7..b82f32fd12 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -167,7 +167,7 @@ void hppa_cpu_do_interrupt(CPUState *cs) vaddr = hppa_form_gva_psw(old_psw, env->iasq_f, vaddr); t = hppa_get_physical_address(env, vaddr, MMU_KERNEL_IDX, - 0, &paddr, &prot, NULL); + 0, &paddr, &prot); if (t >= 0) { /* We can't re-load the instruction. */ env->cr[CR_IIR] = 0; diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 5eca5e8a1e..3ef9e80064 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -196,18 +196,13 @@ static int match_prot_id64(CPUHPPAState *env, uint32_t access_id) } int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, - int type, hwaddr *pphys, int *pprot, - HPPATLBEntry **tlb_entry) + int type, hwaddr *pphys, int *pprot) { hwaddr phys; int prot, r_prot, w_prot, x_prot, priv; HPPATLBEntry *ent; int ret = -1; - if (tlb_entry) { - *tlb_entry = NULL; - } - /* Virtual translation disabled. Map absolute to physical. */ if (MMU_IDX_MMU_DISABLED(mmu_idx)) { switch (mmu_idx) { @@ -237,10 +232,6 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, goto egress; } - if (tlb_entry) { - *tlb_entry = ent; - } - /* We now know the physical address. */ phys = ent->pa + (addr - ent->itree.start); @@ -349,7 +340,7 @@ hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) cpu->env.psw & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX); excp = hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, - &phys, &prot, NULL); + &phys, &prot); /* Since we're translating for debugging, the only error that is a hard error is no translation at all. Otherwise, while a real cpu @@ -431,7 +422,6 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, { HPPACPU *cpu = HPPA_CPU(cs); CPUHPPAState *env = &cpu->env; - HPPATLBEntry *ent; int prot, excp, a_prot; hwaddr phys; @@ -447,8 +437,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, break; } - excp = hppa_get_physical_address(env, addr, mmu_idx, - a_prot, &phys, &prot, &ent); + excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, &phys, &prot); if (unlikely(excp >= 0)) { if (probe) { return false; @@ -689,7 +678,7 @@ target_ulong HELPER(lpa)(CPUHPPAState *env, target_ulong addr) int prot, excp; excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, - &phys, &prot, NULL); + &phys, &prot); if (excp >= 0) { if (excp == EXCP_DTLB_MISS) { excp = EXCP_NA_DTLB_MISS; diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 66cad78a57..7f79196fff 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -334,8 +334,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr, } mmu_idx = PRIV_P_TO_MMU_IDX(level, env->psw & PSW_P); - excp = hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, - &prot, NULL); + excp = hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, &prot); if (excp >= 0) { cpu_restore_state(env_cpu(env), GETPC()); hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); From patchwork Thu Apr 25 00:00:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791772 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118476wrq; Wed, 24 Apr 2024 17:08:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOzcKj7IsFJsoIB0Fj8iRX93TzOit6YQ4jtIfn3uPwjXn8H90P69JUbXqPAIm5jwL2yuFeFoAda3XiIFQkhX4l X-Google-Smtp-Source: AGHT+IGLesf+v3zYtz/nz9Y0kKbHdQfWsdRMF6O9JAzhx2SjBKLflDTQd51Aym6/47RyBCB9tJ97 X-Received: by 2002:a05:6214:9cc:b0:69b:7260:b4dc with SMTP id dp12-20020a05621409cc00b0069b7260b4dcmr3896614qvb.3.1714003729013; Wed, 24 Apr 2024 17:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003729; cv=none; d=google.com; s=arc-20160816; b=cvXG7Qs0yehUSXkNGutZb7wWRKR6TnRSN2AmMGQfEDXXpdKaJ0GBl6RQRU5kmvNZtT hl6s6zQTPrdm5MTfbpN/Tj24yHPB6XhlIBFiYo3wG5zeTmELLUxmDpqgJ0UmMlPMuab2 TGGKW+t/LGj8DqhL7gSINF0AoxieP4E+QBwcl1h7DYqVmHtcmUtsaXTaNqkmQQ5CIbJp CAXmqkDqX65jffNk9MvvDL4wLaBN0iVYTNdwaAp69XtWtd8yyVxseytpslfN8zIhq241 rdkWktKPB1UQMF0QwvVgozGa4Zl6L9OWCtrrMfhcRnm6g02xuUHf3xSwaV+7adn5lfKO 1H8g== 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=sIcgMZsbCQjMNHUGM6x7heye+I2mJEY00KtRZt5wXT0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=efb5Fb8qWWL6jiD/0/QTyiisby4oPVaqFkRR2kZ/OCgdHGaOppxhma4vX5tsIiEQV6 cxolr5Dw0XTV86pqoYdvSJia1qTJwjh5XN8/hVToSggOl5H3bg35nRd68k8VdZTpsV1S wwLshgxqOtwkZ2qyMSrVwd/5CKc48xSitFUxQqNcA9Relf2Q06HTnJt8Aaj+GaSp1sQa +pCAsh58+h+bZH6yJfxSpweWFQpFmy0zjMHCpSz0scKub2aKz5ZzIa1EUiNHY6LH/T58 yz0X7jwUHn2wVLGxytoCbgpEby1J+h9r1HOBIs+AnDLYOy0aRxhbYsGnPaX4GIqcivjC 6Okw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rWEA9QXY; 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 15-20020a0562140d0f00b006a09f43f8edsi349123qvh.374.2024.04.24.17.08.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:48 -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=rWEA9QXY; 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 1rzmcE-0006gH-TI; Wed, 24 Apr 2024 20:05:38 -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 1rzmax-0005Fg-1d for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:11 -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 1rzmas-0007tj-Q4 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:08 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e9ffd3f96eso3558315ad.3 for ; Wed, 24 Apr 2024 17:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003444; x=1714608244; 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=sIcgMZsbCQjMNHUGM6x7heye+I2mJEY00KtRZt5wXT0=; b=rWEA9QXYcqvVGX1fNHzdZ45nJq2EeQy3lWGkkYxW9hE0QXe+SzjtsJDTDWuId9he1U h7EznO338YFi7vh/CPzPdYs5pPrHopjMq/pbi+TL8p4Ctkv3pu25nzBzkLFQMFPE7E7Y Rie19PX5yteDgFgiJvZZzLeUWLvrLrTGrxZH5hDKEjGLbG1pBgcki/EvHxt5WdLO/QKK 7ELWQoywcn9gF1jMIgSlVPyOY4wcTRtfLABYjKg84SyZ8AxQvqVaf8OVMSuzwLm1S9d6 Xk6K2a/ODJZ++OxeHYoFgaR62ITZiSdSdw/RpKi/6bt6Jlqxf9Db8DsGoh85zcS5sWfv Pedw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003444; x=1714608244; 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=sIcgMZsbCQjMNHUGM6x7heye+I2mJEY00KtRZt5wXT0=; b=KtGbF4zxrjC11ueWdcLrgG/FeITqzmDNCM5NyaUc6sQ6KGKfOZP3tRa8jvaxhm+ftu j8QGORSeRllkqTUqskbNGPh8PWdQmU1OtqG3s3b2PpYh+Nlu0SWP1I8cSfbmBH5kyqVY VsVNmrV6KJRpNrLPN15S09BpoikDMNat6FCeZ6i4a0s2blzvTCbzy67S1eePjf1ehXLI K+dDM2Ooff1wT5QMV+xB589K4ruqGUoHp+tvFumayqsfFkWtm/uMsIw7SGnjo14uqPWd tTakbxdN5x90n2sAkrF5SicvlpBNyBY6JxNUMH2N9Ct8hG5sGTKR15qFpSTQ4d1NxS3Z vyjA== X-Gm-Message-State: AOJu0Yw/KnrUqdwxQCTiJW7Vw9ojexz3TaX3cXHotJ59hrdj1wCVRNTs WT988OyRyAnw+32bPnytU6zzUEcFDPgWVlC7bUY5BMAdBZqZEUWIJ6Uz6bnK4BskqNo18ewtKUv m X-Received: by 2002:a17:902:f547:b0:1e5:62:7ac0 with SMTP id h7-20020a170902f54700b001e500627ac0mr5773548plf.14.1714003444228; Wed, 24 Apr 2024 17:04:04 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b001e0648dfd68sm12483717plb.296.2024.04.24.17.04.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:04:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 40/45] target/hppa: Adjust priv for B,GATE at runtime Date: Wed, 24 Apr 2024 17:00:18 -0700 Message-Id: <20240425000023.1002026-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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 Do not compile in the priv change based on the first translation; look up the PTE at execution time. Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 1 - target/hppa/helper.h | 1 + target/hppa/mem_helper.c | 34 +++++++++++++++++++++++++++------- target/hppa/translate.c | 36 +++++++++++++++++++----------------- 4 files changed, 47 insertions(+), 25 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 5f3e99cdc4..8523f22452 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -386,7 +386,6 @@ void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, extern const MemoryRegionOps hppa_io_eir_ops; extern const VMStateDescription vmstate_hppa_cpu; void hppa_cpu_alarm_timer(void *); -int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr); #endif G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra); diff --git a/target/hppa/helper.h b/target/hppa/helper.h index c12b48a04a..de411923d9 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -86,6 +86,7 @@ DEF_HELPER_1(halt, noreturn, env) DEF_HELPER_1(reset, noreturn, env) DEF_HELPER_1(rfi, void, env) DEF_HELPER_1(rfi_r, void, env) +DEF_HELPER_FLAGS_2(b_gate_priv, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_2(write_interval_timer, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(write_eirr, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(swap_system_mask, TCG_CALL_NO_RWG, tl, env, tl) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 3ef9e80064..6756d36dae 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -690,13 +690,6 @@ target_ulong HELPER(lpa)(CPUHPPAState *env, target_ulong addr) return phys; } -/* Return the ar_type of the TLB at VADDR, or -1. */ -int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr) -{ - HPPATLBEntry *ent = hppa_find_tlb(env, vaddr); - return ent ? ent->ar_type : -1; -} - /* * diag_btlb() emulates the PDC PDC_BLOCK_TLB firmware call to * allow operating systems to modify the Block TLB (BTLB) entries. @@ -792,3 +785,30 @@ void HELPER(diag_btlb)(CPUHPPAState *env) break; } } + +uint64_t HELPER(b_gate_priv)(CPUHPPAState *env, uint64_t iaoq_f) +{ + uint64_t gva = hppa_form_gva(env, env->iasq_f, iaoq_f); + HPPATLBEntry *ent = hppa_find_tlb(env, gva); + + if (ent == NULL) { + raise_exception_with_ior(env, EXCP_ITLB_MISS, GETPC(), gva, false); + } + + /* + * There should be no need to check page permissions, as that will + * already have been done by tb_lookup via get_page_addr_code. + * All we need at this point is to check the ar_type. + * + * No change for non-gateway pages or for priv decrease. + */ + if (ent->ar_type & 4) { + int old_priv = iaoq_f & 3; + int new_priv = ent->ar_type & 3; + + if (new_priv < old_priv) { + iaoq_f = (iaoq_f & -4) | new_priv; + } + } + return iaoq_f; +} diff --git a/target/hppa/translate.c b/target/hppa/translate.c index a4200742bd..3ae196490a 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -3959,6 +3959,7 @@ static bool trans_bl(DisasContext *ctx, arg_bl *a) static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) { int64_t disp = a->disp; + bool indirect = false; /* Trap if PSW[B] is set. */ if (ctx->psw_xb & PSW_B) { @@ -3968,24 +3969,22 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) nullify_over(ctx); #ifndef CONFIG_USER_ONLY - if (ctx->tb_flags & PSW_C) { - int type = hppa_artype_for_page(cpu_env(ctx->cs), ctx->base.pc_next); - /* If we could not find a TLB entry, then we need to generate an - ITLB miss exception so the kernel will provide it. - The resulting TLB fill operation will invalidate this TB and - we will re-translate, at which point we *will* be able to find - the TLB entry and determine if this is in fact a gateway page. */ - if (type < 0) { - gen_excp(ctx, EXCP_ITLB_MISS); - return true; - } - /* No change for non-gateway pages or for priv decrease. */ - if (type >= 4 && type - 4 < ctx->privilege) { - disp -= ctx->privilege; - disp += type - 4; - } + if (ctx->privilege == 0) { + /* Privilege cannot decrease. */ + } else if (!(ctx->tb_flags & PSW_C)) { + /* With paging disabled, priv becomes 0. */ + disp -= ctx->privilege; } else { - disp -= ctx->privilege; /* priv = 0 */ + /* Adjust the dest offset for the privilege change from the PTE. */ + TCGv_i64 off = tcg_temp_new_i64(); + + gen_helper_b_gate_priv(off, tcg_env, + tcg_constant_i64(ctx->iaoq_first + + ctx->iaq_f.disp)); + + ctx->iaq_j.base = off; + ctx->iaq_j.disp = disp + 8; + indirect = true; } #endif @@ -3998,6 +3997,9 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) save_gpr(ctx, a->l, tmp); } + if (indirect) { + return do_ibranch(ctx, 0, false, a->n); + } return do_dbranch(ctx, disp, 0, a->n); } From patchwork Thu Apr 25 00:00:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791761 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1117103wrq; Wed, 24 Apr 2024 17:05:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV93MLk2g3RWPS5hMDE64JQKaTDVes9UoItR0WHkUGXIVthC4oE7UFGIZHBH27K0ah/rWAOTOVcBy6+Fys+He5k X-Google-Smtp-Source: AGHT+IEtlP5BoXG0lu3JM5FA5an+ysPHsmOIWRW8gIudv1Z/XZw/uvepmtIJDU+5S2S0fCY3uffz X-Received: by 2002:a05:6359:100f:b0:186:bfc6:f329 with SMTP id ib15-20020a056359100f00b00186bfc6f329mr3558730rwb.21.1714003531709; Wed, 24 Apr 2024 17:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003531; cv=none; d=google.com; s=arc-20160816; b=laksJlw7Vq40VYRXup0wUIZGHS5ruNU/HEW8ZZcD2NTDVH8iyfvMJRJBo+rK7RilDI +ztMWlXvmhW6vDNlgtoqr8IaM6lq09eJP80OkTQNvau2R+6Tz/z1gT1tF8Txm4X0gQZk WSPOz+1Yn95oB3zXq8Rjav6u9dW04yBv1liOfEqoDWWaLdjhtWMn9J9sfYRCOAuvHelo GTh2jBYoIzsfqwBV7+uqxedqBP8sWbDLPg6ko1Nttf31gTo9UyJ5n7b1sTYoa6TDcUaK mQZQIITpLPtJGYqyjA4xSul4ayl93v1TMiJciWeuujc2Svv9sysi5vy+pKhn3eCqkCq3 fM4g== 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=POSCqgQxZHBBkOLPk0Q8P0oQeNibZDlMfgRZeP2hZlY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Bek4yy9oFMM6eGtCQmdmAQfjK5th/ejzXQsdJIJy3ZcIKN8qCXSCP34HOH7mtk/wU9 x3xM0gFC2oKDcvJWqwtmHz1dgBIIvKt+aCFDOntkU76m9O7mhQ9I0RUkAi15Klbi5wjR h4DQjnqFkZjSXrIE243f9bveFNxTbai3UqfX8Bl5kxTSXvFsNuM64cgtsP6HbkQFPls3 g8BAgAtdulbClWPABZCqzC3/iplbCEoLyNBvTVhPGD7/0C7E77xKR70tzQcBAYhqJHas Z9ogX4CMj4u8vRzcLdeHmkbdxCM5RVGAuRJysWmTQOLPp6CaASrnwYmdn0gVbX5EUcRZ gsXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SYvrzcjU; 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 d11-20020a05622a15cb00b004395cfaae06si12556275qty.118.2024.04.24.17.05.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:05:31 -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=SYvrzcjU; 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 1rzmbV-0005t0-Oh; Wed, 24 Apr 2024 20:04:46 -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 1rzmax-0005Fn-CL for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:13 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmat-0007tp-7Z for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:10 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e36b7e7dd2so3469235ad.1 for ; Wed, 24 Apr 2024 17:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003445; x=1714608245; 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=POSCqgQxZHBBkOLPk0Q8P0oQeNibZDlMfgRZeP2hZlY=; b=SYvrzcjUZW0kTR86566HLVBQnqIz8s/pyvtVE2jxR3i5tndezF9zyTwm4IUYnCxc+8 DRqGeai1u+CFIf+3SkdgrYFPiiLTTvBrAnjaPXvJMm0Zla7B/ol5PetLIrZPUG5cU9zH pM978yvlP934BKpJRobpgjdGItCurObmMrzif0nMOam7N5Dbn7Anlsg9fKoMfy2hC/bY d4JEuE3kUzbR2nk0gJ+bUQ2LVGezOcq4pxCfsREkXTZ7baU8JiaVoX0RoWUoPTR1SZqn DssFfVaLcMZJp+dUJkQeKpX6EMYyTokdQwNMomY6C8ylPpWO/yJlgZW27TLFjU8sX1Os IEFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003445; x=1714608245; 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=POSCqgQxZHBBkOLPk0Q8P0oQeNibZDlMfgRZeP2hZlY=; b=hSZsAWQC413qDtBJsul0zu9j5VNDDB9Uj0rCTWUoaESGww1dlWhHAbBXy1goNpDiyB 1qotzHxG8MPkLY1kgmLNqXLvYihBYzmvDs89Lhhwafnfu/g4HCKmmVLl3/2IXHnwztq0 n4sV5SoYMkGQB6cGq28Z+AzeuBzMTL2wV5GrwanED0WsbopoFo99gfJ3xLdlIotB++Xa gO9dE/p6koRrCa9BQSV55K+kLzUsFMdAs0FNpZDdxHHDToDd/vYs3eaQ4BUD7OsQYUZM tt0zMQ/OBMsu3xvqAHTmLKTKmZlKuqTIxC5F8Z2HZmTJOv+pXFYK0nctT4yItYHHuGTF FcNA== X-Gm-Message-State: AOJu0YyOIRiDo4uSdY8AWTrxwW8vXX6viI+YCO8n/8oQ53MZVdJZmpjp NlM3qn/BdbWHhWPRgJW9GG5rTloktIeWBGAtuaDLb/EZcbEJELZXMVLIaWQVsKqK5JmYIxl4jn8 u X-Received: by 2002:a17:902:9046:b0:1e4:b70d:eb72 with SMTP id w6-20020a170902904600b001e4b70deb72mr3659448plz.35.1714003445049; Wed, 24 Apr 2024 17:04:05 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b001e0648dfd68sm12483717plb.296.2024.04.24.17.04.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:04:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 41/45] target/hppa: Implement CF_PCREL Date: Wed, 24 Apr 2024 17:00:19 -0700 Message-Id: <20240425000023.1002026-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Now that the groundwork has been laid, enabling CF_PCREL within the translator proper is a simple matter of updating copy_iaoq_entry and install_iaq_entries. We also need to modify the unwind info, since we no longer have absolute addresses to install. As expected, this reduces the runtime overhead of compilation when running a Linux kernel with address space randomization enabled. Signed-off-by: Richard Henderson --- target/hppa/cpu.c | 19 ++++++------ target/hppa/translate.c | 68 ++++++++++++++++++++++++++++------------- 2 files changed, 55 insertions(+), 32 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 5f0df0697a..b3f3f070d3 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -62,10 +62,6 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, *pc = hppa_cpu_get_pc(env_cpu(env)); flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; - if (hppa_is_pa20(env)) { - cs_base = env->iaoq_f & MAKE_64BIT_MASK(32, 32); - } - /* * The only really interesting case is if IAQ_Back is on the same page * as IAQ_Front, so that we can use goto_tb between the blocks. In all @@ -113,19 +109,19 @@ static void hppa_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb, const uint64_t *data) { - HPPACPU *cpu = HPPA_CPU(cs); + CPUHPPAState *env = cpu_env(cs); - cpu->env.iaoq_f = data[0]; - if (data[1] != (target_ulong)-1) { - cpu->env.iaoq_b = data[1]; + env->iaoq_f = (env->iaoq_f & TARGET_PAGE_MASK) | data[0]; + if (data[1] != INT32_MIN) { + env->iaoq_b = env->iaoq_f + data[1]; } - cpu->env.unwind_breg = data[2]; + env->unwind_breg = data[2]; /* * Since we were executing the instruction at IAOQ_F, and took some * sort of action that provoked the cpu_restore_state, we can infer * that the instruction was not nullified. */ - cpu->env.psw_n = 0; + env->psw_n = 0; } static bool hppa_cpu_has_work(CPUState *cs) @@ -191,6 +187,9 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp) hppa_ptlbe(&cpu->env); } #endif + + /* Use pc-relative instructions always to simplify the translator. */ + cs->tcg_cflags |= CF_PCREL; } static void hppa_cpu_initfn(Object *obj) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 3ae196490a..b2cc81c685 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -46,7 +46,7 @@ typedef struct DisasIAQE { TCGv_i64 space; /* IAOQ base; may be null for relative address. */ TCGv_i64 base; - /* IAOQ addend; if base is null, relative to ctx->iaoq_first. */ + /* IAOQ addend; if base is null, relative to cpu_iaoq_f. */ int64_t disp; } DisasIAQE; @@ -663,11 +663,7 @@ static DisasIAQE iaqe_next_absv(DisasContext *ctx, TCGv_i64 var) static void copy_iaoq_entry(DisasContext *ctx, TCGv_i64 dest, const DisasIAQE *src) { - if (src->base == NULL) { - tcg_gen_movi_i64(dest, ctx->iaoq_first + src->disp); - } else { - tcg_gen_addi_i64(dest, src->base, src->disp); - } + tcg_gen_addi_i64(dest, src->base ? : cpu_iaoq_f, src->disp); } static void install_iaq_entries(DisasContext *ctx, const DisasIAQE *f, @@ -679,8 +675,28 @@ static void install_iaq_entries(DisasContext *ctx, const DisasIAQE *f, b_next = iaqe_incr(f, 4); b = &b_next; } - copy_iaoq_entry(ctx, cpu_iaoq_f, f); - copy_iaoq_entry(ctx, cpu_iaoq_b, b); + + /* + * There is an edge case + * bv r0(rN) + * b,l disp,r0 + * for which F will use cpu_iaoq_b (from the indirect branch), + * and B will use cpu_iaoq_f (from the direct branch). + * In this case we need an extra temporary. + */ + if (f->base != cpu_iaoq_b) { + copy_iaoq_entry(ctx, cpu_iaoq_b, b); + copy_iaoq_entry(ctx, cpu_iaoq_f, f); + } else if (f->base == b->base) { + copy_iaoq_entry(ctx, cpu_iaoq_f, f); + tcg_gen_addi_i64(cpu_iaoq_b, cpu_iaoq_f, b->disp - f->disp); + } else { + TCGv_i64 tmp = tcg_temp_new_i64(); + copy_iaoq_entry(ctx, tmp, b); + copy_iaoq_entry(ctx, cpu_iaoq_f, f); + tcg_gen_mov_i64(cpu_iaoq_b, tmp); + } + if (f->space) { tcg_gen_mov_i64(cpu_iasq_f, f->space); } @@ -3978,9 +3994,8 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) /* Adjust the dest offset for the privilege change from the PTE. */ TCGv_i64 off = tcg_temp_new_i64(); - gen_helper_b_gate_priv(off, tcg_env, - tcg_constant_i64(ctx->iaoq_first - + ctx->iaq_f.disp)); + copy_iaoq_entry(ctx, off, &ctx->iaq_f); + gen_helper_b_gate_priv(off, tcg_env, off); ctx->iaq_j.base = off; ctx->iaq_j.disp = disp + 8; @@ -4601,7 +4616,7 @@ static bool trans_diag_unimp(DisasContext *ctx, arg_diag_unimp *a) static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); - uint64_t cs_base, iaoq_f, iaoq_b; + uint64_t cs_base; int bound; ctx->cs = cs; @@ -4620,12 +4635,8 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) : ctx->tb_flags & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX); #endif - /* Recover the IAOQ values from the GVA + PRIV. */ cs_base = ctx->base.tb->cs_base; - iaoq_f = cs_base & MAKE_64BIT_MASK(32, 32); - iaoq_f |= ctx->base.pc_first & MAKE_64BIT_MASK(2, 30); - iaoq_f |= ctx->privilege; - ctx->iaoq_first = iaoq_f; + ctx->iaoq_first = ctx->base.pc_first + ctx->privilege; if (unlikely(cs_base & CS_BASE_DIFFSPACE)) { ctx->iaq_b.space = cpu_iasq_b; @@ -4633,8 +4644,9 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) } else if (unlikely(cs_base & CS_BASE_DIFFPAGE)) { ctx->iaq_b.base = cpu_iaoq_b; } else { - iaoq_b = (iaoq_f & TARGET_PAGE_MASK) | (cs_base & ~TARGET_PAGE_MASK); - ctx->iaq_b.disp = iaoq_b - iaoq_f; + uint64_t iaoq_f_pgofs = ctx->iaoq_first & ~TARGET_PAGE_MASK; + uint64_t iaoq_b_pgofs = cs_base & ~TARGET_PAGE_MASK; + ctx->iaq_b.disp = iaoq_b_pgofs - iaoq_f_pgofs; } ctx->zero = tcg_constant_i64(0); @@ -4661,11 +4673,23 @@ static void hppa_tr_tb_start(DisasContextBase *dcbase, CPUState *cs) static void hppa_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); + uint64_t iaoq_f, iaoq_b; + int64_t diff; tcg_debug_assert(!iaqe_variable(&ctx->iaq_f)); - tcg_gen_insn_start(ctx->iaoq_first + ctx->iaq_f.disp, - (iaqe_variable(&ctx->iaq_b) ? -1 : - ctx->iaoq_first + ctx->iaq_b.disp), 0); + + iaoq_f = ctx->iaoq_first + ctx->iaq_f.disp; + if (iaqe_variable(&ctx->iaq_b)) { + diff = INT32_MIN; + } else { + iaoq_b = ctx->iaoq_first + ctx->iaq_b.disp; + diff = iaoq_b - iaoq_f; + /* Direct branches can only produce a 24-bit displacement. */ + tcg_debug_assert(diff == (int32_t)diff); + tcg_debug_assert(diff != INT32_MIN); + } + + tcg_gen_insn_start(iaoq_f & ~TARGET_PAGE_MASK, diff, 0); ctx->insn_start_updated = false; } From patchwork Thu Apr 25 00:00:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791789 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119635wrq; Wed, 24 Apr 2024 17:11:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVu17VjpXfekOxh046A290gOjUEHK8S6HDR2WZb6FuHsYJFXRqJwPIsdV9q2ty67C2ySILlstlW+PTOubOfTgcO X-Google-Smtp-Source: AGHT+IG2DJD/26b0b3Ejd3WsrkgwwEg6dZLfPZIyozn0AdFV1tHq8DmuydFommrWzItlxoW/ZO+D X-Received: by 2002:a05:620a:3798:b0:78b:cc53:3097 with SMTP id pi24-20020a05620a379800b0078bcc533097mr4030031qkn.51.1714003918890; Wed, 24 Apr 2024 17:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003918; cv=none; d=google.com; s=arc-20160816; b=g/q3vpqg3FwcSwulilcuc0wU7ir7VUBG/pSBE8bj5ylRYRBUS3isglQnEzc7kxlGrz J1B+q+4HVouvifZETRw9TokBGNd5dqCt/MnOry+yusey7lCpd03vV59zq9b8sds3zI8+ VYNy0Jqfwk6y2/jcS/m2PRKWYSxmNIVx7UlsydAiZs9OGuy44GTJJaiD7ioS2Wa95t5q attgQA6I+tTQhyALysF2PbuIjXuWcCrN2InmmwXkELU+JvVgbDLjE/fBw49fPjyL2GxX 9gjPb8iA328I4y5SFZ80vE5eK1GYOoFIsC4SE6tBzsU/fO6NdPvaQC/SqpEBZY5M4YaF CJ6w== 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=5vBkU+37mGqQK6oTkMHCKqIJ4geVz8b/nkIOKlsoblU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=foF3LA6NCmRbCQ5+xkvLegbwdrhluTTkTqrsGmyTApUzk64nJhkqdahPtVeQhLiWVU FixYon3zi5EueYVHmSp+eECzk12Cy6ZQZfT5zmWXeSDgMUxpPdZhWokbfiT6yfKsIgxt BCpGeqVmTNlQHKWiATtp6pbMDc80EL1Ifvcp0pDoFDwdNlyQ9q1uXECeEB/TjpIY50+2 C2CYXj2v9G/a5m8+ReYMMovlBAOoip2gkiIA9qHBfajnLr3kE8A7jqm7ssLgF77YoY0U qhUvSabhFu8FoToSLQCYA8n6Ej4uKTo/JFZTFtRHUASZg8SvrYxj7KiqkN/Or6DGNAvU 6vRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rwrBS0nK; 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 yf13-20020a05620a3bcd00b0078d699ba683si15844833qkn.635.2024.04.24.17.11.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:11:58 -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=rwrBS0nK; 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 1rzmbf-00066j-4g; Wed, 24 Apr 2024 20:04:55 -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 1rzmax-0005Fi-7J for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:13 -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 1rzmat-0007tv-Lb for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:10 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e40042c13eso2910555ad.2 for ; Wed, 24 Apr 2024 17:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003446; x=1714608246; 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=5vBkU+37mGqQK6oTkMHCKqIJ4geVz8b/nkIOKlsoblU=; b=rwrBS0nKNdyvOC1d7q8+NdNUSsShR508MPyUYn9FORWrde6KQShmU1JqflmtUYzhrc AT2ZlNZCJhKqc7TUfENn/fRoL1Hka+DCxgS9+pivv6StK2f9NyAk1aAsx1tejMaX0w3N ly8sCWKHuztYBfJQPWgX4vDITpJd/AYAOUSV7keZ7SQ/iC0VeBIfq+aV7oo8vKKlEng7 pqmvVnCU3AVXeo+HqPFbay1wrQrw7k8anehzPNohMtnEEji1TNZnlBY21/JTbe0qKmj4 LlyzHmmTrveIDm32QejmrzWyJdLNaAWtzr11sjNy/Cn8gFBK1Ngl36dnF5K/15Her1bC /zGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003446; x=1714608246; 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=5vBkU+37mGqQK6oTkMHCKqIJ4geVz8b/nkIOKlsoblU=; b=o3z9jesgCN8i0J0f+ypxBnFM0VrmaIowj+BlHk8fFSAVNJV3ViFIZK2aqXTsSzyRKf 2oTDVw7nJlSE7u1K3kKSJw4ZEaReDTEiBkkOy5JEPCv7rno0hIroDeOs1utNy/fhW9cf kOl0+YDWcGxQ0k/L5tJBUXPYiBN0kLhOmfD9Kc7m7Q098klJPfcXcxz6QXdAjAfmdRiU bFmhTZx7lFjBT2dAj1uARX+p2VNXHZGkly0kkhYoGCK3LqtTtQ6kWP7dZ+8GGdQ9blQv OkdLedWhlUmMXAQz15scXC90KRCiM5BmDDmmgQigquX/0fzEn/dKBCb3eYHLyAuxPxJ3 bHFg== X-Gm-Message-State: AOJu0YycmTghI9w2p46yt3zfsNKZXLYvlsr5M5RSRlgiEPdhlEcEbemP N790ePFpuDkRLrHVoAEWGylDattjeAcFzYtiBE564B3Ya/Mchro+oazT/0Wb1nR5R4JSphiT8b0 8 X-Received: by 2002:a17:902:ea94:b0:1e4:3df0:38a5 with SMTP id x20-20020a170902ea9400b001e43df038a5mr3982013plb.65.1714003445872; Wed, 24 Apr 2024 17:04:05 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b001e0648dfd68sm12483717plb.296.2024.04.24.17.04.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:04:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 42/45] target/hppa: Implement PSW_T Date: Wed, 24 Apr 2024 17:00:20 -0700 Message-Id: <20240425000023.1002026-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org PSW_T enables a trap on taken branches, at the very end of the execution of the branch instruction. Signed-off-by: Richard Henderson --- target/hppa/cpu.c | 4 +-- target/hppa/translate.c | 55 +++++++++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index b3f3f070d3..42c413211a 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -76,10 +76,10 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, cs_base |= env->iaoq_b & ~TARGET_PAGE_MASK; } - /* ??? E, T, H, L bits need to be here, when implemented. */ + /* ??? E, H, L bits need to be here, when implemented. */ flags |= env->psw_n * PSW_N; flags |= env->psw_xb; - flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); + flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P | PSW_T); #ifdef CONFIG_USER_ONLY flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; diff --git a/target/hppa/translate.c b/target/hppa/translate.c index b2cc81c685..7ad7aa675d 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1872,6 +1872,23 @@ static bool do_fop_dedd(DisasContext *ctx, unsigned rt, return nullify_end(ctx); } +static bool do_taken_branch_trap(DisasContext *ctx, DisasIAQE *next, bool n) +{ + if (unlikely(ctx->tb_flags & PSW_T)) { + /* + * The X, B and N bits are updated, and the instruction queue + * is advanced before the trap is recognized. + */ + nullify_set(ctx, n); + store_psw_xb(ctx, PSW_B); + install_iaq_entries(ctx, &ctx->iaq_b, next); + gen_excp_1(EXCP_TB); + ctx->base.is_jmp = DISAS_NORETURN; + return true; + } + return false; +} + /* Emit an unconditional branch to a direct target, which may or may not have already had nullification handled. */ static bool do_dbranch(DisasContext *ctx, int64_t disp, @@ -1881,6 +1898,9 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { install_link(ctx, link, false); + if (do_taken_branch_trap(ctx, &ctx->iaq_j, is_n)) { + return true; + } if (is_n) { if (use_nullify_skip(ctx)) { nullify_set(ctx, 0); @@ -1897,7 +1917,9 @@ static bool do_dbranch(DisasContext *ctx, int64_t disp, nullify_over(ctx); install_link(ctx, link, false); - if (is_n && use_nullify_skip(ctx)) { + if (do_taken_branch_trap(ctx, &ctx->iaq_j, is_n)) { + /* done */ + } else if (is_n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); store_psw_xb(ctx, 0); gen_goto_tb(ctx, 0, &ctx->iaq_j, NULL); @@ -1959,7 +1981,9 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, n = is_n && disp >= 0; next = iaqe_branchi(ctx, disp); - if (n && use_nullify_skip(ctx)) { + if (do_taken_branch_trap(ctx, &next, is_n)) { + /* done */ + } else if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); store_psw_xb(ctx, 0); gen_goto_tb(ctx, 1, &next, NULL); @@ -1989,6 +2013,9 @@ static bool do_ibranch(DisasContext *ctx, unsigned link, { if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { install_link(ctx, link, with_sr0); + if (do_taken_branch_trap(ctx, &ctx->iaq_j, is_n)) { + return true; + } if (is_n) { if (use_nullify_skip(ctx)) { install_iaq_entries(ctx, &ctx->iaq_j, NULL); @@ -2004,20 +2031,22 @@ static bool do_ibranch(DisasContext *ctx, unsigned link, } nullify_over(ctx); - install_link(ctx, link, with_sr0); - if (is_n && use_nullify_skip(ctx)) { - install_iaq_entries(ctx, &ctx->iaq_j, NULL); - nullify_set(ctx, 0); - store_psw_xb(ctx, 0); - } else { - install_iaq_entries(ctx, &ctx->iaq_b, &ctx->iaq_j); - nullify_set(ctx, is_n); - store_psw_xb(ctx, PSW_B); + + if (!do_taken_branch_trap(ctx, &ctx->iaq_j, is_n)) { + if (is_n && use_nullify_skip(ctx)) { + install_iaq_entries(ctx, &ctx->iaq_j, NULL); + nullify_set(ctx, 0); + store_psw_xb(ctx, 0); + } else { + install_iaq_entries(ctx, &ctx->iaq_b, &ctx->iaq_j); + nullify_set(ctx, is_n); + store_psw_xb(ctx, PSW_B); + } + tcg_gen_lookup_and_goto_ptr(); + ctx->base.is_jmp = DISAS_NORETURN; } - tcg_gen_lookup_and_goto_ptr(); - ctx->base.is_jmp = DISAS_NORETURN; return nullify_end(ctx); } From patchwork Thu Apr 25 00:00:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791778 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119066wrq; Wed, 24 Apr 2024 17:10:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUQQfV3N3EtrNR0lUqcocKU4+Bn5GsNhTsnd/uwzcjhmOMzxoI9P8qqYydZ8ZtqJUS5CVhIjO9Zoq7tpx7wlXCS X-Google-Smtp-Source: AGHT+IFtaL+7mgW5+rQ+xtaGZq2hkxzpvRL7I4YzYfgi5kSw6650wVFuzE/HsdHjFwXefO2WhUqE X-Received: by 2002:a05:622a:5e87:b0:439:f5f1:2d78 with SMTP id er7-20020a05622a5e8700b00439f5f12d78mr4940822qtb.25.1714003827024; Wed, 24 Apr 2024 17:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003827; cv=none; d=google.com; s=arc-20160816; b=M2wUekBYDFsN+1erbxGXmwmiZ8fttCrp40pm7r1TdRg74tK4RYeLjwwH2mY3f/M2nW 92qSPOnCnMaqJYlHu8z0UIW7X1odJDI/eF35xKpFYy1iltVSmP4eKb73zrCABzweZuWp +PHWTlqV1WtAdnyD795skK0kJgYymcVvWq4nRRDMAl9Q9IYOXLe+t0Eg1wLEvSaRSvRD dCWcuYJRqapOZKsyuPb4KVef4aBjNIfKZxOr/Xjmlmv9qx8PI2uAkspHCP63S++vuPpF UCJU/seiU+MDilofSZDuUk2Z4yt0UDc0IxtObVi8+tJiVc36STrQwoKhWu60g3CfkmdH rPKg== 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=fX2m1kkCbS1cMj7VDlXMqT9akuCODLBKcZuUdZRgdS0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=AgGRjTASV1ZZg3twneMYHLtgIUHboKvqVL2DSOa7jstt5BK11hh6RcJ8zc2lKoL5Zp 5loa493rq8SoIimDmAWcOqK8s2DjoMBkpxWBJr22DyICaBDDYbDsU3PAzfvTBzvSSpXC 0xSWG1pSHRL2/l7PU+YB9Dh3P4uv60B7+v2YRVyDd7GtWcKjOLJq6tNkpv/40rlR+3Xz rs5+aBZX0Xn9YvN9CiehtA/iX12y8jdyCGEaf5zwzbXzH+W3PiErT3lJfU2mXQ8x+s4J B6IyD+z95TytMOicQXfn+9XtJcGBnQtaXum5F1j6pMwKa2WwHWLVxJLVJmB/vVMpQkJU tHCg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FdAOSXzR; 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 q18-20020a05622a031200b00439ff3a2dd2si4543032qtw.68.2024.04.24.17.10.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:10:27 -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=FdAOSXzR; 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 1rzmbc-00064G-Bm; Wed, 24 Apr 2024 20:04:52 -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 1rzmb1-0005GV-Ta for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:16 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmau-0007uG-PW for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:10 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e2bbc2048eso3632065ad.3 for ; Wed, 24 Apr 2024 17:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003447; x=1714608247; 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=fX2m1kkCbS1cMj7VDlXMqT9akuCODLBKcZuUdZRgdS0=; b=FdAOSXzRCGZtejBX1rult38Iqo/hxd/fzvEmjyQL6FvXlMTpX5/MxoOL3MpCdqig2f OiwFRws0VCLvYkJpJ+vxpsUb3WO+kAkgrEFm5Rafh/J+lfKFkfR0bcl9q+QaUz6iMWAr BySQjy6cCXm7PBudvdrnD1jbiOCfdEJ9jULqs3CCEEkpt9HnZ2c+XkLiluRLooa33gOn LPpATeIkpFAwMfzdVfHoMw0NIllOpuIeKZodGL9sVtDJfkZqIbxODnp5znPhMmz+DV0p tJaMAknA6Jq4Xnfcq2a6szzWRDaHo9o7eddDRlBp0masKELA3CoUzMijjp/gbRObmh7Q euog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003447; x=1714608247; 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=fX2m1kkCbS1cMj7VDlXMqT9akuCODLBKcZuUdZRgdS0=; b=hXN+Rg4uzdc7BPRpbSfJSt6bJobNPmzdNNIxdEhrU/+9r5JphcRej2Hj+LR+Od6gAk 5GfmFQB0cBH3rl6niJJSJcOf4Sz1a9HBoug63PME+/qpwgHXs2QkuT6Gfa9wrks0zgb7 WvlivhHsmdgRJbZ7fawhMDrH8emIp5GuCDqRPpGHqZJPpTn5PnJwlo4Zxzh2duJw2KTk aWFkO3l2YVlmMSra59EbLTkBFTvzrZXRpEIEC13U6RhQlMnNLPRWottR1H1iB62dnlw1 /5YHRmGSsQbSNkSipbCxHuTmGiO2U2KkbFSEeN7GN0jLXKxf7A0W64R9sZcoErklFJoM HOBg== X-Gm-Message-State: AOJu0Yy6HuJzNEo44BxH+G4HO0n9rHVAh8hTUZ+I/J8tsVj3PxjHRGlc iz/rBh9EF6y5SkpX6XO8iBBmoJ5O6PnjFMIdz/5GatVzcbgpdYZ4Q6x1ddhHyj+5bPvJLw4uLyh Y X-Received: by 2002:a17:902:db07:b0:1e8:32ed:6f6d with SMTP id m7-20020a170902db0700b001e832ed6f6dmr5126513plx.39.1714003446782; Wed, 24 Apr 2024 17:04:06 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b001e0648dfd68sm12483717plb.296.2024.04.24.17.04.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:04:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 43/45] target/hppa: Implement PSW_H, PSW_L Date: Wed, 24 Apr 2024 17:00:21 -0700 Message-Id: <20240425000023.1002026-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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/hppa/cpu.c | 4 +-- target/hppa/translate.c | 68 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 42c413211a..5adbe0fe9c 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -76,10 +76,10 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, cs_base |= env->iaoq_b & ~TARGET_PAGE_MASK; } - /* ??? E, H, L bits need to be here, when implemented. */ + /* ??? E bits need to be here, when implemented. */ flags |= env->psw_n * PSW_N; flags |= env->psw_xb; - flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P | PSW_T); + flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_H | PSW_L | PSW_P | PSW_T); #ifdef CONFIG_USER_ONLY flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 7ad7aa675d..4126995604 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -55,6 +55,7 @@ typedef struct DisasDelayException { TCGLabel *lab; uint32_t insn; bool set_iir; + bool set_b; int8_t set_n; uint8_t excp; /* Saved state at parent insn. */ @@ -744,6 +745,7 @@ static DisasDelayException *delay_excp(DisasContext *ctx, uint8_t excp) e->insn = ctx->insn; e->set_iir = true; e->set_n = ctx->psw_n_nonzero ? 0 : -1; + e->set_b = false; e->excp = excp; e->iaq_f = ctx->iaq_f; e->iaq_b = ctx->iaq_b; @@ -1872,6 +1874,54 @@ static bool do_fop_dedd(DisasContext *ctx, unsigned rt, return nullify_end(ctx); } +/* + * Since B,GATE can only increase priv, and other indirect branches can + * only decrease priv, we only need to test in one direction. + * If maybe_priv == 0, no priv is possible with the current insn; + * if maybe_priv < 0, priv might increase, otherwise priv might decrease. + */ +static void do_priv_branch_trap(DisasContext *ctx, int maybe_priv, + DisasIAQE *next, bool n) +{ + DisasDelayException *e; + uint32_t psw_bit, excp; + TCGv_i64 new_priv; + TCGCond cond; + + if (likely(maybe_priv == 0)) { + return; + } + if (maybe_priv < 0) { + psw_bit = PSW_H; + excp = EXCP_HPT; + cond = TCG_COND_LTU; + } else { + psw_bit = PSW_L; + excp = EXCP_LPT; + cond = TCG_COND_GTU; + } + if (likely(!(ctx->tb_flags & psw_bit))) { + return; + } + + e = tcg_malloc(sizeof(DisasDelayException)); + memset(e, 0, sizeof(*e)); + e->next = ctx->delay_excp_list; + ctx->delay_excp_list = e; + + e->lab = gen_new_label(); + e->set_n = n ? 1 : ctx->psw_n_nonzero ? 0 : -1; + e->set_b = ctx->psw_xb != PSW_B; + e->excp = excp; + e->iaq_f = ctx->iaq_b; + e->iaq_b = *next; + + new_priv = tcg_temp_new_i64(); + copy_iaoq_entry(ctx, new_priv, next); + tcg_gen_andi_i64(new_priv, new_priv, 3); + tcg_gen_brcondi_i64(cond, new_priv, ctx->privilege, e->lab); +} + static bool do_taken_branch_trap(DisasContext *ctx, DisasIAQE *next, bool n) { if (unlikely(ctx->tb_flags & PSW_T)) { @@ -2009,10 +2059,12 @@ static bool do_cbranch(DisasContext *ctx, int64_t disp, bool is_n, * This handles nullification of the branch itself. */ static bool do_ibranch(DisasContext *ctx, unsigned link, - bool with_sr0, bool is_n) + bool with_sr0, bool is_n, int maybe_priv) { if (ctx->null_cond.c == TCG_COND_NEVER && ctx->null_lab == NULL) { install_link(ctx, link, with_sr0); + + do_priv_branch_trap(ctx, maybe_priv, &ctx->iaq_j, is_n); if (do_taken_branch_trap(ctx, &ctx->iaq_j, is_n)) { return true; } @@ -2033,6 +2085,7 @@ static bool do_ibranch(DisasContext *ctx, unsigned link, nullify_over(ctx); install_link(ctx, link, with_sr0); + do_priv_branch_trap(ctx, maybe_priv, &ctx->iaq_j, is_n); if (!do_taken_branch_trap(ctx, &ctx->iaq_j, is_n)) { if (is_n && use_nullify_skip(ctx)) { install_iaq_entries(ctx, &ctx->iaq_j, NULL); @@ -3993,7 +4046,7 @@ static bool trans_be(DisasContext *ctx, arg_be *a) tcg_gen_addi_i64(ctx->iaq_j.base, load_gpr(ctx, a->b), a->disp); ctx->iaq_j.base = do_ibranch_priv(ctx, ctx->iaq_j.base); - return do_ibranch(ctx, a->l, true, a->n); + return do_ibranch(ctx, a->l, true, a->n, ctx->privilege == 3 ? 0 : 1); } static bool trans_bl(DisasContext *ctx, arg_bl *a) @@ -4042,7 +4095,7 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a) } if (indirect) { - return do_ibranch(ctx, 0, false, a->n); + return do_ibranch(ctx, 0, false, a->n, -1); } return do_dbranch(ctx, disp, 0, a->n); } @@ -4060,7 +4113,7 @@ static bool trans_blr(DisasContext *ctx, arg_blr *a) tcg_gen_add_i64(t0, t0, t1); ctx->iaq_j = iaqe_next_absv(ctx, t0); - return do_ibranch(ctx, a->l, false, a->n); + return do_ibranch(ctx, a->l, false, a->n, 0); } else { /* BLR R0,RX is a good way to load PC+8 into RX. */ return do_dbranch(ctx, 0, a->l, a->n); @@ -4081,7 +4134,7 @@ static bool trans_bv(DisasContext *ctx, arg_bv *a) dest = do_ibranch_priv(ctx, dest); ctx->iaq_j = iaqe_next_absv(ctx, dest); - return do_ibranch(ctx, 0, false, a->n); + return do_ibranch(ctx, 0, false, a->n, ctx->privilege == 3 ? 0 : 1); } static bool trans_bve(DisasContext *ctx, arg_bve *a) @@ -4094,7 +4147,7 @@ static bool trans_bve(DisasContext *ctx, arg_bve *a) ctx->iaq_j.base = do_ibranch_priv(ctx, b); ctx->iaq_j.disp = 0; - return do_ibranch(ctx, a->l, false, a->n); + return do_ibranch(ctx, a->l, false, a->n, ctx->privilege == 3 ? 0 : 1); } static bool trans_nopbts(DisasContext *ctx, arg_nopbts *a) @@ -4852,6 +4905,9 @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) if (e->set_n >= 0) { tcg_gen_movi_i64(cpu_psw_n, e->set_n); } + if (e->set_b) { + tcg_gen_movi_i32(cpu_psw_xb, PSW_B); + } if (e->set_iir) { tcg_gen_st_i64(tcg_constant_i64(e->insn), tcg_env, offsetof(CPUHPPAState, cr[CR_IIR])); From patchwork Thu Apr 25 00:00:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791765 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1118142wrq; Wed, 24 Apr 2024 17:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU7/CYrdMAd8vzT4iJf+ytmd6rUDKsrqLHbnePpDeTCAwRg44rYsTbbFEUpkxzVYUz3pDdJRmPuVwziM8NfRHQX X-Google-Smtp-Source: AGHT+IGaiPQH6VFNIHZQHCYUYOXBOJMkiD/2gEU1r6LqnJIlaOGRGf6BjJsTL8tFH/CGKzh0oGHP X-Received: by 2002:ac8:5ad3:0:b0:43a:3d4c:e364 with SMTP id d19-20020ac85ad3000000b0043a3d4ce364mr1081576qtd.24.1714003680714; Wed, 24 Apr 2024 17:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003680; cv=none; d=google.com; s=arc-20160816; b=mGH0bwad3XdJiLLqiMJnrxjnYdTUfBO7wNTEtJyqDd9IQUfg5CBxe0X9UKbpXByFbh 4jpwnkKLAsD7dVZfRblYql71lE35DziFp0uP5tBTXyxZXedj0cLCg4vx7pNZ9tyMF/MM Ng9pR1XMnH5gmNw1ytuDKmyeNGbMfgxOnfAowaE9/HKhIeyr5Kc5BGTbW7GWphH0uMF/ +AK5y+uemFgUEJsar7PTq0aywRPnte80H/l1821331ZCCoXJ0YQCoIIYNh9jqL/cPkjD zGtYtnH3mnwDRfvayYRwMAf6wJSD/bNLa7kcxyIzbMdvNZh7PVhoqGhhKH/8u4C5ULdR +zLg== 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=420RbZAGJjbzrfJsdBQyYhnJyXLQSLvrDO7PgYHuwLQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=KtMzdB/ujjwyCuXHfMCmhyLCnnmd5gUw6C0StZ7kT4viVPO/0JyQINJJV+e0LawxmS ydAZyy5AKUaqbDuJXFCxP6Djt/H9HEbPddM0P0vPldZzCCbdMD4ywYWAsxGD7imPDRZa LWUkgoIbXi5aQx6K6z8PRQib1ErTvvZNU/rw8GkLldrpJmb3pw9Mc2HEIxnNuPPho0WX w8IDsXalnu04OmuOv/dC/TK17I59GeaT25KbesquHKSZt+Fk+E4E++F8Mw953cDKoCgB IlGMT04f5Lep2JWE9FiyOdQYAUecKi2/DuXi7tUlF7wNKqCYP0yJkjSyapljvNqg8s8i 8bwA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jNOzx046; 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 o1-20020ac87c41000000b0043a11044e90si3435916qtv.710.2024.04.24.17.08.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:08:00 -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=jNOzx046; 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 1rzmbV-0005tF-Jh; Wed, 24 Apr 2024 20:04:46 -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 1rzmb7-0005Hk-J9 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:22 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzmav-0007uO-CA for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:10 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e9ffd3f96eso3558665ad.3 for ; Wed, 24 Apr 2024 17:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003447; x=1714608247; 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=420RbZAGJjbzrfJsdBQyYhnJyXLQSLvrDO7PgYHuwLQ=; b=jNOzx0469RKcDD960igYMYPF7lRm7mF4JI1Cmy731kke7Lf1vMq4NTh+oi3qGrif3K /MS/JKFw4/mp1mF6Is5VPd4kI6h7zBpxFHlgom8izYo/4fu2FlTMDPWelJjRbjfCxMP/ 36GCVC0mQBqvI0rehvvRowjEbyM7k0ScIoVgQd9/FU/l5KI8ei5ReQTYtd9itqXvyDg8 zsaSoCHVF0VBsOxUb1126Po3KnGgY1akzx7zl9vQZOMaQCzb/akcyFL+d4Nwjj1udkfV JNWESVaFEux/Cn2vN8hPto+9M6Y/UhdlCPLIzQta1mM+AWF7+Q45zhaIsHC0KFyeA8Zs tnmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003447; x=1714608247; 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=420RbZAGJjbzrfJsdBQyYhnJyXLQSLvrDO7PgYHuwLQ=; b=XWJ9Z1UlrshEdZJyG8TTSZLNpOyV01YEH7PuEks5JHFXb56FQ9eLddXXqsjnh6vLbr oFTBM2Bj3lUb7UJq8RVxPu/kigd+kH8B7EvqXJ0HYqqe7PgFbG8KKLqiUuz1MvFuH1mL g48rQ96VgGxxrf3rIfG15rQonIoJjtTJnbrxzV0QzHTjtww6sxzN2ZAFKnaZyD390Iv0 nsDkEYOfurC6x3t3Xr0X+C/yTMoFraE3aNz7l5GPQk6aJ+3BpH36ZU/tO4LZGkNfuix2 xQayCwy4RhMSxPXhJ6KwvrmYrJLAjki5xuBFCRqDMLGET0mm7IhnMfdxW748eQOc0MVP xhCg== X-Gm-Message-State: AOJu0YxnBu4qyHzdmmOpI2RMp0XmGmOS1d4BH9gyH5GYzX/1LXWpCpV4 KXMwJpLIsgXv8NE6ZkK9CzVEaGHfriaRgh5EXmqEHubu3i5DUK+dsoWELont1HT+evZjYLztyVK F X-Received: by 2002:a17:902:e848:b0:1e8:2c8d:b793 with SMTP id t8-20020a170902e84800b001e82c8db793mr4555867plg.41.1714003447648; Wed, 24 Apr 2024 17:04:07 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b001e0648dfd68sm12483717plb.296.2024.04.24.17.04.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:04:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 44/45] target/hppa: Log cpu state at interrupt Date: Wed, 24 Apr 2024 17:00:22 -0700 Message-Id: <20240425000023.1002026-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 This contains all of the information logged before, plus more. Signed-off-by: Richard Henderson --- target/hppa/int_helper.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index b82f32fd12..391f32f27d 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -241,21 +241,22 @@ void hppa_cpu_do_interrupt(CPUState *cs) [EXCP_SYSCALL_LWS] = "syscall-lws", [EXCP_TOC] = "TOC (transfer of control)", }; - static int count; - const char *name = NULL; - char unknown[16]; - if (i >= 0 && i < ARRAY_SIZE(names)) { - name = names[i]; + FILE *logfile = qemu_log_trylock(); + if (logfile) { + const char *name = NULL; + + if (i >= 0 && i < ARRAY_SIZE(names)) { + name = names[i]; + } + if (name) { + fprintf(logfile, "INT: cpu %d %s\n", cs->cpu_index, name); + } else { + fprintf(logfile, "INT: cpu %d unknown %d\n", cs->cpu_index, i); + } + hppa_cpu_dump_state(cs, logfile, 0); + qemu_log_unlock(logfile); } - if (!name) { - snprintf(unknown, sizeof(unknown), "unknown %d", i); - name = unknown; - } - qemu_log("INT %6d: %s @ " TARGET_FMT_lx ":" TARGET_FMT_lx - " for " TARGET_FMT_lx ":" TARGET_FMT_lx "\n", - ++count, name, env->cr[CR_IIASQ], env->cr[CR_IIAOQ], - env->cr[CR_ISR], env->cr[CR_IOR]); } cs->exception_index = -1; } From patchwork Thu Apr 25 00:00:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791785 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1119597wrq; Wed, 24 Apr 2024 17:11:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWC+7Fsc/n0DXd9TKpfktb3eKagt4GQgISY+BLh2qAmHFHW9RfdL9Ll0w0aJEF/qf1qYwG6qZYLEpXbSai2uuuh X-Google-Smtp-Source: AGHT+IGalrbNWDLtbqAd+cvoOzI6c4AmTkg7RhlopG7ifY8REgMBzvyVvzp+U5t/yB1wLAoBKyeU X-Received: by 2002:ac8:5789:0:b0:439:b3de:a669 with SMTP id v9-20020ac85789000000b00439b3dea669mr4946983qta.44.1714003913957; Wed, 24 Apr 2024 17:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714003913; cv=none; d=google.com; s=arc-20160816; b=pdAdHjblmphBTYxQRBi8TOCdMRctwmmPEuVrE0izqL2S4dXmxiA6RAwvLS+88nWYeS RlHib1rHJMiU7gw3yiVPOPnQlS6KbC13WRYxeuSIagxR231DaMvVcDx9atuPqGRZTM1A YZIphl1b80Pt1hbw8pWKDwzeTO/auw1QzE2hSnyWZ7lwAASHNyXzqm6GqoLSYIfUFPqt WrnT9RcDVL3oFe6BUg+GERE2v3gaKVlDB6ZhlUjGMSY40o2PwlDqzHDF4rP/bxQ4Wt4K JnHYOD40yC0imlE8fm1LC9Hdtd6RxM7jeS6+jlqXU1RvG4qRsZCsbwaQjEPL3bljXccW 2ftg== 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=IL2hAokqpmQr3sSx0rCsqvvhI5ki9eqOu02SaoXaEMQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=E5C2n9f8jLfeMV4lV2x5/MAOy6vhgWa1LNsBaBbbGUtfDqIHsQScUM+/mbBvzdZ9aX Y3VMRBxxrItH2KwProPZy/vT/5CVEA6KH5Ttg5QBlRcsOU7RRBEx4slkbZSRM9NvofiA 8+GhveOt2QK3l84sXChQb2rOuPAIW+tAS6Wxe39KNWP9eQZY8V7zG7fthnYQmV2jAbuT cmi5mRzzd9xvObZ3GEPSu6klE0/eRyk8NPcSawfthMjbwt1cu3/RECXpzfbBOCi6ciTY gb479C9skMKrKxndAzOwD5OLkC5WmEdGI03hOsINadsdt42P1W4DUxlRn9FS765WfrSx OzLg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pMqXt2EI; 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 x6-20020ac85f06000000b00439f518e6fesi4590986qta.158.2024.04.24.17.11.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 17:11:53 -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=pMqXt2EI; 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 1rzmbf-000672-03; Wed, 24 Apr 2024 20:04:55 -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 1rzmb7-0005Jd-W5 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:22 -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 1rzmaw-0007ue-1F for qemu-devel@nongnu.org; Wed, 24 Apr 2024 20:04:11 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so4009705ad.1 for ; Wed, 24 Apr 2024 17:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714003448; x=1714608248; 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=IL2hAokqpmQr3sSx0rCsqvvhI5ki9eqOu02SaoXaEMQ=; b=pMqXt2EIg+My+S0q42+uYmZ+cUJBMtM22sKVVCDDOFwSHcv24Kx9Ibn+/dALcrC2MC gG2hiwvnCIc3mAILeqPH+w+6bdtIaf0I4CIH9AnZSpZNWTRj9fx/aoLn35TeLx5lpAF1 qtGJK/rsWf3ew9hq9ZuelQ02i+CkhrvEoK2wL+2SrIdhFX7TA+WMdbHeN8t7x+RqpQdZ kC91ZEP6sDagvI+XZJwAlQXhhVXU35qb9Bsx+TDTxEn8qz51gG+LGADTZU+1q+97zaF3 U8KPaSRzhijU/fqcoCE66be0l3pRNzV+Ona58PZBofVZ+sVYVDb7jiCT3R58o3SXz1xd nYEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714003448; x=1714608248; 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=IL2hAokqpmQr3sSx0rCsqvvhI5ki9eqOu02SaoXaEMQ=; b=T/BCpk34I1y7gJrAjNlmsrRsYf3+G5bm5C3+cXrYUcZrzjx/WtQL/zRhexf6jdt1E9 Qi5fhoZVD6m3+TKIG7nkvU0VEpdRqoRZCLt5ji9RhSDQcbuRNSkeZwIx8YJ/U4NsEazs Ll+W0xn586dn5eSXOjtm9LM66UJl84mPN3e6Gfx1QuFh53xMDLlGpyBTYmUWXM4yZxty +wTwFHWK3Bpixv51FdTeogp5CaeWDdsC70uCheFsiqqkmYwkXpInNkzTaWTLB6Sbo9My N6Pn+rcLAWJzt/MqKcU9GQnyOsusLLMuCfQC2o0t8tHxInvkn3lBJjXflU36Exb2l/hk bxtw== X-Gm-Message-State: AOJu0Yw45bMa/nnOmJmAWs4GxAL2mt++gJ9C6HZiexzdgMtAtb9OWdPy uu9/4O2xexzpAcwFGfVBF37Rwak+0J2d3C7VaFyQUx3ioIVvSmg8Nw0X6BaD24BWFk9gLblVlXN 4 X-Received: by 2002:a17:902:cf12:b0:1e5:11ac:a283 with SMTP id i18-20020a170902cf1200b001e511aca283mr5418959plg.9.1714003448453; Wed, 24 Apr 2024 17:04:08 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b001e0648dfd68sm12483717plb.296.2024.04.24.17.04.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:04:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 45/45] target/hppa: Log cpu state on return-from-interrupt Date: Wed, 24 Apr 2024 17:00:23 -0700 Message-Id: <20240425000023.1002026-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425000023.1002026-1-richard.henderson@linaro.org> References: <20240425000023.1002026-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Inverse of the logging on taking an interrupt. Signed-off-by: Richard Henderson --- target/hppa/sys_helper.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/hppa/sys_helper.c b/target/hppa/sys_helper.c index 22d6c89964..9b43b556fd 100644 --- a/target/hppa/sys_helper.c +++ b/target/hppa/sys_helper.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" @@ -93,6 +94,17 @@ void HELPER(rfi)(CPUHPPAState *env) env->iaoq_b = env->cr_back[1]; env->iasq_f = (env->cr[CR_IIASQ] << 32) & ~(env->iaoq_f & mask); env->iasq_b = (env->cr_back[0] << 32) & ~(env->iaoq_b & mask); + + if (qemu_loglevel_mask(CPU_LOG_INT)) { + FILE *logfile = qemu_log_trylock(); + if (logfile) { + CPUState *cs = env_cpu(env); + + fprintf(logfile, "RFI: cpu %d\n", cs->cpu_index); + hppa_cpu_dump_state(cs, logfile, 0); + qemu_log_unlock(logfile); + } + } } static void getshadowregs(CPUHPPAState *env)