From nobody Sun Apr 6 20:49:06 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1735370646; cv=none; d=zohomail.com; s=zohoarc; b=Ul01/td+6V2e5g3f8gfFvT4iZp1gGeTAvtYHAbHeZwvB541yRtt0gMoF+xgVRkxkUMVYHoa7pqxs//8O/IWiYItVX/7Ss9ztmoWLjAbe3xiB54sXYv7aS0Ra1/d8tEhbrgL/AkKUkovTjpLHUtP+iLnOzM9igivO4a+vHnRm/hg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1735370646; h=Content-Type:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=NzMWiJK9bcEEMbqU1USeuXvqSebgZuHKLj6+jE5pKXc=; b=Ff+t3/Arh4OsACwo41q4f3DfDlP94iqsNrF3cFQb/jKgD4MK3pXHHPMbSzUcAWenrrldMLMYMmXUOPsELQlQasM1JY6K/xEQ6asvmtNS8WQk0VNb7eHZiiMZrxpO3MJKQGezW7uTKw5IfgVWJHX6nx0nmnjI7DbaTWNl/uE+I9o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17353706461537.145094771716572; Fri, 27 Dec 2024 23:24:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRRAN-000573-5S; Sat, 28 Dec 2024 02:23:19 -0500 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 1tRRAK-00056f-07 for qemu-devel@nongnu.org; Sat, 28 Dec 2024 02:23:16 -0500 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRRAH-0004Ll-B5 for qemu-devel@nongnu.org; Sat, 28 Dec 2024 02:23:14 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 3D41FA4014B; Sat, 28 Dec 2024 07:21:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 290CBC4CECD; Sat, 28 Dec 2024 07:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735370589; bh=qVBiZiQU7qm16mFrVGEswfPi1WlVAvEx7BPvNLCL5Gk=; h=Date:From:To:Subject:From; b=dQrF8Mk557eFEqHydqMVi7zX+M50SHOSsfk/YUGXqGziQ26Xc5+7cSGbN2qAWsz4c skbFmJifqEXvtNh032Nmxf+l7IghePgerI2LdJGfkpgrXJdWHcdF6hqVuJslEmrWgR q3OOSMPsTMMWWLGpXwWYzh591AMN/sjL2W9Vl5xR+/3MPn2EPKeJjVEXCoV8Mw143P 4lYfmJ1OogpXFNSdnRf1S2/huBkkN4lcqCXCsLWaNGzQ79cAMX/q8xDBw0VtOI1thf ognygQ2See8BcjZAf6s15WAdQc9NQBR9Z1Je9P5cj1UOk+KM9rYsj7KfCN1IePy3mg yUSXC5Hms7Rog== Date: Sat, 28 Dec 2024 08:23:05 +0100 From: Helge Deller To: richard.henderson@linaro.org, Laurent Vivier , qemu-devel@nongnu.org Subject: [PATCH] target/hppa: Speed up hppa_is_pa20() Message-ID: MIME-Version: 1.0 Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:45d1:ec00::3; envelope-from=deller@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.138, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1735370649069116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Although the hppa_is_pa20() helper is costly due to string comparisms in object_dynamic_cast(), it is called quite often during memory lookups and at each start of a block of instruction translations. Speed hppa_is_pa20() up by calling object_dynamic_cast() only once at CPU creation and store the result in the is_pa20 of struct CPUArchState. Signed-off-by: Helge Deller diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index a31dc32a9f..08ac1ec068 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -281,6 +281,7 @@ static TranslateFn *machine_HP_common_init_cpus(Machine= State *machine) /* Create CPUs. */ for (unsigned int i =3D 0; i < smp_cpus; i++) { cpu[i] =3D HPPA_CPU(cpu_create(machine->cpu_type)); + cpu[i]->env.is_pa20 =3D object_dynamic_cast(OBJECT(cpu[i]), TYPE_H= PPA64_CPU); } =20 /* diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index e45ba50a59..c37a701f44 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -208,6 +208,7 @@ typedef struct CPUArchState { uint64_t fr[32]; uint64_t sr[8]; /* stored shifted into place for gva */ =20 + bool is_pa20; 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 */ @@ -294,7 +295,7 @@ struct HPPACPUClass { =20 static inline bool hppa_is_pa20(CPUHPPAState *env) { - return object_dynamic_cast(OBJECT(env_cpu(env)), TYPE_HPPA64_CPU) !=3D= NULL; + return env->is_pa20; } =20 static inline int HPPA_BTLB_ENTRIES(CPUHPPAState *env)