From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PULL 4/7] softfloat: define floatx80_round()
Date: Fri, 30 Jun 2017 14:30:47 +0200 [thread overview]
Message-ID: <20170630123050.19834-5-laurent@vivier.eu> (raw)
In-Reply-To: <20170630123050.19834-1-laurent@vivier.eu>
Add a function to round a floatx80 to the defined precision
(floatx80_rounding_precision)
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170628204241.32106-5-laurent@vivier.eu>
---
fpu/softfloat.c | 16 ++++++++++++++++
include/fpu/softfloat.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 7af14e2..433c5da 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -5086,6 +5086,22 @@ float128 floatx80_to_float128(floatx80 a, float_status *status)
}
/*----------------------------------------------------------------------------
+| Rounds the extended double-precision floating-point value `a'
+| to the precision provided by floatx80_rounding_precision and returns the
+| result as an extended double-precision floating-point value.
+| The operation is performed according to the IEC/IEEE Standard for Binary
+| Floating-Point Arithmetic.
+*----------------------------------------------------------------------------*/
+
+floatx80 floatx80_round(floatx80 a, float_status *status)
+{
+ return roundAndPackFloatx80(status->floatx80_rounding_precision,
+ extractFloatx80Sign(a),
+ extractFloatx80Exp(a),
+ extractFloatx80Frac(a), 0, status);
+}
+
+/*----------------------------------------------------------------------------
| Rounds the extended double-precision floating-point value `a' to an integer,
| and returns the result as an extended quadruple-precision floating-point
| value. The operation is performed according to the IEC/IEEE Standard for
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index f1288ef..d9689ec 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -621,6 +621,7 @@ float128 floatx80_to_float128(floatx80, float_status *status);
/*----------------------------------------------------------------------------
| Software IEC/IEEE extended double-precision operations.
*----------------------------------------------------------------------------*/
+floatx80 floatx80_round(floatx80 a, float_status *status);
floatx80 floatx80_round_to_int(floatx80, float_status *status);
floatx80 floatx80_add(floatx80, floatx80, float_status *status);
floatx80 floatx80_sub(floatx80, floatx80, float_status *status);
--
2.9.4
next prev parent reply other threads:[~2017-06-30 12:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 12:30 [Qemu-devel] [PULL 0/7] M68k for 2.10 patches Laurent Vivier
2017-06-30 12:30 ` [Qemu-devel] [PULL 1/7] target/m68k: add fscc Laurent Vivier
2017-06-30 12:30 ` [Qemu-devel] [PULL 2/7] target/m68k: add fmovecr Laurent Vivier
2017-06-30 12:30 ` [Qemu-devel] [PULL 3/7] target/m68k: add explicit single and double precision operations Laurent Vivier
2017-06-30 12:30 ` Laurent Vivier [this message]
2017-06-30 12:30 ` [Qemu-devel] [PULL 5/7] target/m68k: add fsglmul and fsgldiv Laurent Vivier
2017-06-30 12:30 ` [Qemu-devel] [PULL 6/7] target/m68k: add explicit single and double precision operations (part 2) Laurent Vivier
2017-06-30 12:30 ` [Qemu-devel] [PULL 7/7] target/m68k: add fmovem Laurent Vivier
2017-06-30 15:29 ` [Qemu-devel] [PULL 0/7] M68k for 2.10 patches 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=20170630123050.19834-5-laurent@vivier.eu \
--to=laurent@vivier.eu \
--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).