qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Will Newton <will.newton@linaro.org>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>, patches@linaro.org
Subject: [Qemu-devel] [PATCH v2 07/11] target-arm: Add set_neon_rmode helper
Date: Tue, 28 Jan 2014 11:22:31 +0000	[thread overview]
Message-ID: <1390908155-23475-7-git-send-email-will.newton@linaro.org> (raw)
In-Reply-To: <1390908155-23475-1-git-send-email-will.newton@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 <will.newton@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 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

  parent reply	other threads:[~2014-01-28 11:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 11:22 [Qemu-devel] [PATCH v2 01/11] target-arm: Move arm_rmode_to_sf to a shared location Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 02/11] target-arm: Add AArch32 FP VRINTA, VRINTN, VRINTP and VRINTM Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 03/11] target-arm: Add support for AArch32 FP VRINTR Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 04/11] target-arm: Add support for AArch32 FP VRINTZ Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 05/11] target-arm: Add support for AArch32 FP VRINTX Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 06/11] target-arm: Add support for AArch32 SIMD VRINTX Will Newton
2014-01-28 11:22 ` Will Newton [this message]
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 08/11] target-arm: Add AArch32 SIMD VRINTA, VRINTN, VRINTP, VRINTM, VRINTZ Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 09/11] target-arm: Add AArch32 FP VCVTA, VCVTN, VCVTP and VCVTM Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 10/11] target-arm: Add AArch32 SIMD " Will Newton
2014-01-28 11:22 ` [Qemu-devel] [PATCH v2 11/11] target-arm: Add support for AArch32 64bit VCVTB and VCVTT Will Newton
2014-01-28 15:26   ` Peter Maydell
2014-01-28 15:05 ` [Qemu-devel] [PATCH v2 01/11] target-arm: Move arm_rmode_to_sf to a shared location Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390908155-23475-7-git-send-email-will.newton@linaro.org \
    --to=will.newton@linaro.org \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).