From nobody Mon Feb 9 19:54:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155220797894261.374821203720444; Sun, 10 Mar 2019 00:52:58 -0800 (PST) Received: from localhost ([127.0.0.1]:42094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2uCV-000617-Nj for importer@patchew.org; Sun, 10 Mar 2019 04:52:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2tor-0001gi-1B for qemu-devel@nongnu.org; Sun, 10 Mar 2019 04:28:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2toq-0001o3-1R for qemu-devel@nongnu.org; Sun, 10 Mar 2019 04:28:28 -0400 Received: from ozlabs.org ([203.11.71.1]:34719) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2top-0001aP-BX; Sun, 10 Mar 2019 04:28:27 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44HDqr72SMz9sPW; Sun, 10 Mar 2019 19:27:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1552206440; bh=wgF2JB2YsWkVkyOoreIQkODh/HRir2xjXaw6u8uVY9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FENloWPC4/Th/M7tIiN79/QgLote3QBN0yXvql1oA332fko359FAF9sTJ9MLbxe8s ii0ZDy085ebUuyEbzI2sjPwWCM4nKOvMd4rNofNJzQgZTeM3JI1HtXWOD0KwNYg8oF xeY5DEDQDtIxRcYgxW/DAYxlpdf3aNsW8bAeBYt0= From: David Gibson To: peter.maydell@linaro.org Date: Sun, 10 Mar 2019 19:26:41 +1100 Message-Id: <20190310082703.1245-39-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190310082703.1245-1-david@gibson.dropbear.id.au> References: <20190310082703.1245-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 38/60] target/ppc: improve avr64_offset() and use it to simplify get_avr64()/set_avr64() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, Richard Henderson , Mark Cave-Ayland , groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland By using the VsrD macro in avr64_offset() the same offset calculation can be used regardless of the host endian. This allows get_avr64() and set_avr64()= to be simplified accordingly. Signed-off-by: Mark Cave-Ayland Message-Id: <20190307180520.13868-6-mark.cave-ayland@ilande.co.uk> Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/cpu.h | 5 +++++ target/ppc/translate.c | 16 ++-------------- target/ppc/translate/vmx-impl.inc.c | 5 ----- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index caddbd012c..3050982707 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2608,6 +2608,11 @@ static inline uint64_t *cpu_vsrl_ptr(CPUPPCState *en= v, int i) return (uint64_t *)((uintptr_t)env + vsrl_offset(i)); } =20 +static inline long avr64_offset(int i, bool high) +{ + return offsetof(CPUPPCState, vsr[32 + i].VsrD(high ? 0 : 1)); +} + static inline int avr_full_offset(int i) { return vsr_full_offset(i + 32); diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 668d4cf75a..98b37cebc2 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6687,24 +6687,12 @@ static inline void set_fpr(int regno, TCGv_i64 src) =20 static inline void get_avr64(TCGv_i64 dst, int regno, bool high) { -#ifdef HOST_WORDS_BIGENDIAN - tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUPPCState, - vsr[32 + regno].u64[(high ? 0 : = 1)])); -#else - tcg_gen_ld_i64(dst, cpu_env, offsetof(CPUPPCState, - vsr[32 + regno].u64[(high ? 1 : = 0)])); -#endif + tcg_gen_ld_i64(dst, cpu_env, avr64_offset(regno, high)); } =20 static inline void set_avr64(int regno, TCGv_i64 src, bool high) { -#ifdef HOST_WORDS_BIGENDIAN - tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, - vsr[32 + regno].u64[(high ? 0 : = 1)])); -#else - tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, - vsr[32 + regno].u64[(high ? 1 : = 0)])); -#endif + tcg_gen_st_i64(src, cpu_env, avr64_offset(regno, high)); } =20 #include "translate/fp-impl.inc.c" diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 4e5d0bc0e0..eb10c533ca 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -14,11 +14,6 @@ static inline TCGv_ptr gen_avr_ptr(int reg) return r; } =20 -static inline long avr64_offset(int reg, bool high) -{ - return offsetof(CPUPPCState, vsr[32 + reg].u64[(high ? 0 : 1)]); -} - #define GEN_VR_LDX(name, opc2, opc3) = \ static void glue(gen_, name)(DisasContext *ctx) = \ { = \ --=20 2.20.1