From patchwork Wed May 25 16:00:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 97374 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B35D0B6F94 for ; Thu, 26 May 2011 02:01:10 +1000 (EST) Received: from localhost ([::1]:35973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPGWA-0001sj-ER for incoming@patchwork.ozlabs.org; Wed, 25 May 2011 12:01:06 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPGVa-00014O-2t for qemu-devel@nongnu.org; Wed, 25 May 2011 12:00:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPGVY-00081W-1K for qemu-devel@nongnu.org; Wed, 25 May 2011 12:00:29 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:42332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPGVX-0007wf-GK for qemu-devel@nongnu.org; Wed, 25 May 2011 12:00:27 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QPGVL-0000KT-I1; Wed, 25 May 2011 17:00:15 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 25 May 2011 17:00:11 +0100 Message-Id: <1306339215-1228-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1306339215-1228-1-git-send-email-peter.maydell@linaro.org> References: <1306339215-1228-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Blue Swirl , Paul Brook , Aurelien Jarno , patches@linaro.org Subject: [Qemu-devel] [PATCH 2/6] target-arm: Add helper function to generate code to get fpstatus pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add and use a helper function which returns a TCGv which is a pointer to the fp_status for either Neon or VFP operations. Signed-off-by: Peter Maydell --- target-arm/translate.c | 40 ++++++++++++++++------------------------ 1 files changed, 16 insertions(+), 24 deletions(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index 9a22f50..a1ec459 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -893,6 +893,19 @@ static inline void gen_add_datah_offset(DisasContext *s, unsigned int insn, } } +static TCGv get_fpstatus_ptr(int neon) +{ + TCGv statusptr = tcg_temp_new_i32(); + int offset; + if (neon) { + offset = offsetof(CPUState, vfp.standard_fp_status); + } else { + offset = offsetof(CPUState, vfp.fp_status); + } + tcg_gen_addi_i32(statusptr, cpu_env, offset); + return statusptr; +} + #define VFP_OP2(name) \ static inline void gen_vfp_##name(int dp) \ { \ @@ -980,14 +993,7 @@ static inline void gen_vfp_F1_ld0(int dp) #define VFP_GEN_ITOF(name) \ static inline void gen_vfp_##name(int dp, int neon) \ { \ - TCGv statusptr = tcg_temp_new_i32(); \ - int offset; \ - if (neon) { \ - offset = offsetof(CPUState, vfp.standard_fp_status); \ - } else { \ - offset = offsetof(CPUState, vfp.fp_status); \ - } \ - tcg_gen_addi_i32(statusptr, cpu_env, offset); \ + TCGv statusptr = get_fpstatus_ptr(neon); \ if (dp) { \ gen_helper_vfp_##name##d(cpu_F0d, cpu_F0s, statusptr); \ } else { \ @@ -1003,14 +1009,7 @@ VFP_GEN_ITOF(sito) #define VFP_GEN_FTOI(name) \ static inline void gen_vfp_##name(int dp, int neon) \ { \ - TCGv statusptr = tcg_temp_new_i32(); \ - int offset; \ - if (neon) { \ - offset = offsetof(CPUState, vfp.standard_fp_status); \ - } else { \ - offset = offsetof(CPUState, vfp.fp_status); \ - } \ - tcg_gen_addi_i32(statusptr, cpu_env, offset); \ + TCGv statusptr = get_fpstatus_ptr(neon); \ if (dp) { \ gen_helper_vfp_##name##d(cpu_F0s, cpu_F0d, statusptr); \ } else { \ @@ -1029,14 +1028,7 @@ VFP_GEN_FTOI(tosiz) static inline void gen_vfp_##name(int dp, int shift, int neon) \ { \ TCGv tmp_shift = tcg_const_i32(shift); \ - TCGv statusptr = tcg_temp_new_i32(); \ - int offset; \ - if (neon) { \ - offset = offsetof(CPUState, vfp.standard_fp_status); \ - } else { \ - offset = offsetof(CPUState, vfp.fp_status); \ - } \ - tcg_gen_addi_i32(statusptr, cpu_env, offset); \ + TCGv statusptr = get_fpstatus_ptr(neon); \ if (dp) { \ gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, tmp_shift, statusptr); \ } else { \