From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W86kv-0003xl-Ma for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:23:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W86kp-0000cq-PC for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:23:01 -0500 Received: from mail-la0-f50.google.com ([209.85.215.50]:65269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W86kn-0000cJ-4Z for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:22:55 -0500 Received: by mail-la0-f50.google.com with SMTP id ec20so200315lab.9 for ; Tue, 28 Jan 2014 03:22:52 -0800 (PST) From: Will Newton Date: Tue, 28 Jan 2014 11:22:31 +0000 Message-Id: <1390908155-23475-7-git-send-email-will.newton@linaro.org> In-Reply-To: <1390908155-23475-1-git-send-email-will.newton@linaro.org> References: <1390908155-23475-1-git-send-email-will.newton@linaro.org> Subject: [Qemu-devel] [PATCH v2 07/11] target-arm: Add set_neon_rmode helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , patches@linaro.org This helper sets the rounding mode in the standard_fp_status word to allow NEON instructions to modify the rounding mode whilst using the standard FPSCR values for everything else. Signed-off-by: Will Newton Reviewed-by: Peter Maydell --- target-arm/helper.c | 17 +++++++++++++++++ target-arm/helper.h | 1 + 2 files changed, 18 insertions(+) diff --git a/target-arm/helper.c b/target-arm/helper.c index b1541b9..ca5b000 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -4048,6 +4048,23 @@ uint32_t HELPER(set_rmode)(uint32_t rmode, CPUARMState *env) return prev_rmode; } +/* Set the current fp rounding mode in the standard fp status and return + * the old one. This is for NEON instructions that need to change the + * rounding mode but wish to use the standard FPSCR values for everything + * else. Always set the rounding mode back to the correct value after + * modifying it. + * The argument is a softfloat float_round_ value. + */ +uint32_t HELPER(set_neon_rmode)(uint32_t rmode, CPUARMState *env) +{ + float_status *fp_status = &env->vfp.standard_fp_status; + + uint32_t prev_rmode = get_float_rounding_mode(fp_status); + set_float_rounding_mode(rmode, fp_status); + + return prev_rmode; +} + /* Half precision conversions. */ static float32 do_fcvt_f16_to_f32(uint32_t a, CPUARMState *env, float_status *s) { diff --git a/target-arm/helper.h b/target-arm/helper.h index 70872df..71b8411 100644 --- a/target-arm/helper.h +++ b/target-arm/helper.h @@ -149,6 +149,7 @@ DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr) DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr) DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, env) +DEF_HELPER_FLAGS_2(set_neon_rmode, TCG_CALL_NO_RWG, i32, i32, env) DEF_HELPER_2(vfp_fcvt_f16_to_f32, f32, i32, env) DEF_HELPER_2(vfp_fcvt_f32_to_f16, i32, f32, env) -- 1.8.1.4