Received: from eggs.gnu.org ([2001:4830:134:3::10]:38922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPMF3-0001NY-SA for qemu-devel@nongnu.org; Thu, 26 Sep 2013 20:49:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPMEt-0004gt-IV for qemu-devel@nongnu.org; Thu, 26 Sep 2013 20:49:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52591 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPMEt-0004gB-6o for qemu-devel@nongnu.org; Thu, 26 Sep 2013 20:48:59 -0400 From: Alexander Graf Date: Fri, 27 Sep 2013 02:47:57 +0200 Message-Id: <1380242934-20953-4-git-send-email-agraf@suse.de> In-Reply-To: <1380242934-20953-1-git-send-email-agraf@suse.de> References: <1380242934-20953-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 03/60] arm: Split VFP cmp from FPSCR setting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Michael Matz , C Fontana , Dirk Mueller , Laurent Desnogues , Christoffer Dall , Richard Henderson The VFP cmp operations do a comparison and then store the result in FPSCR. For AArch64, we need to compare but store the result in normal PSTATE instead. So split the comparison from FPSCR modifications. Signed-off-by: Alexander Graf --- target-arm/helper.c | 14 ++++++++++++-- target-arm/helper.h | 12 ++++++++---- target-arm/translate.c | 8 ++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 24e8ae4..2b031a8 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -3604,7 +3604,7 @@ float64 VFP_HELPER(sqrt, d)(float64 a, CPUARMState *env) /* XXX: check quiet/signaling case */ #define DO_VFP_cmp(p, type) \ -void VFP_HELPER(cmp, p)(type a, type b, CPUARMState *env) \ +uint32_t VFP_HELPER(cmp, p)(type a, type b, CPUARMState *env) \ { \ uint32_t flags; \ switch(type ## _compare_quiet(a, b, &env->vfp.fp_status)) { \ @@ -3614,10 +3614,15 @@ void VFP_HELPER(cmp, p)(type a, type b, CPUARMState *env) \ default: \ case float_relation_unordered: flags = PSTATE_V | PSTATE_C; break; \ } \ + return flags; \ +} \ +void VFP_HELPER(fpscr_cmp, p)(type a, type b, CPUARMState *env) \ +{ \ + uint32_t flags = VFP_HELPER(cmp, p)(a, b, env); \ env->vfp.xregs[ARM_VFP_FPSCR] = (flags << 28) \ | (env->vfp.xregs[ARM_VFP_FPSCR] & 0x0fffffff); \ } \ -void VFP_HELPER(cmpe, p)(type a, type b, CPUARMState *env) \ +uint32_t VFP_HELPER(cmpe, p)(type a, type b, CPUARMState *env) \ { \ uint32_t flags; \ switch(type ## _compare(a, b, &env->vfp.fp_status)) { \ @@ -3627,6 +3632,11 @@ void VFP_HELPER(cmpe, p)(type a, type b, CPUARMState *env) \ default: \ case float_relation_unordered: flags = PSTATE_V | PSTATE_C; break; \ } \ + return flags; \ +} \ +void VFP_HELPER(fpscr_cmpe, p)(type a, type b, CPUARMState *env) \ +{ \ + uint32_t flags = VFP_HELPER(cmpe, p)(a, b, env); \ env->vfp.xregs[ARM_VFP_FPSCR] = (flags << 28) \ | (env->vfp.xregs[ARM_VFP_FPSCR] & 0x0fffffff); \ } diff --git a/target-arm/helper.h b/target-arm/helper.h index 63ae13a..e66362a 100644 --- a/target-arm/helper.h +++ b/target-arm/helper.h @@ -85,10 +85,14 @@ DEF_HELPER_1(vfp_abss, f32, f32) DEF_HELPER_1(vfp_absd, f64, f64) DEF_HELPER_2(vfp_sqrts, f32, f32, env) DEF_HELPER_2(vfp_sqrtd, f64, f64, env) -DEF_HELPER_3(vfp_cmps, void, f32, f32, env) -DEF_HELPER_3(vfp_cmpd, void, f64, f64, env) -DEF_HELPER_3(vfp_cmpes, void, f32, f32, env) -DEF_HELPER_3(vfp_cmped, void, f64, f64, env) +DEF_HELPER_3(vfp_fpscr_cmps, void, f32, f32, env) +DEF_HELPER_3(vfp_fpscr_cmpd, void, f64, f64, env) +DEF_HELPER_3(vfp_fpscr_cmpes, void, f32, f32, env) +DEF_HELPER_3(vfp_fpscr_cmped, void, f64, f64, env) +DEF_HELPER_3(vfp_cmps, i32, f32, f32, env) +DEF_HELPER_3(vfp_cmpd, i32, f64, f64, env) +DEF_HELPER_3(vfp_cmpes, i32, f32, f32, env) +DEF_HELPER_3(vfp_cmped, i32, f64, f64, env) DEF_HELPER_2(vfp_fcvtds, f64, f32, env) DEF_HELPER_2(vfp_fcvtsd, f32, f64, env) diff --git a/target-arm/translate.c b/target-arm/translate.c index b0a25ca..ef284da 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -1059,17 +1059,17 @@ static inline void gen_vfp_sqrt(int dp) static inline void gen_vfp_cmp(int dp) { if (dp) - gen_helper_vfp_cmpd(cpu_F0d, cpu_F1d, cpu_env); + gen_helper_vfp_fpscr_cmpd(cpu_F0d, cpu_F1d, cpu_env); else - gen_helper_vfp_cmps(cpu_F0s, cpu_F1s, cpu_env); + gen_helper_vfp_fpscr_cmps(cpu_F0s, cpu_F1s, cpu_env); } static inline void gen_vfp_cmpe(int dp) { if (dp) - gen_helper_vfp_cmped(cpu_F0d, cpu_F1d, cpu_env); + gen_helper_vfp_fpscr_cmped(cpu_F0d, cpu_F1d, cpu_env); else - gen_helper_vfp_cmpes(cpu_F0s, cpu_F1s, cpu_env); + gen_helper_vfp_fpscr_cmpes(cpu_F0s, cpu_F1s, cpu_env); } static inline void gen_vfp_F1_ld0(int dp) -- 1.7.12.4