From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christophe Lyon <christophe.lyon@st.com>,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH v2 4/6] softfloat: Correctly handle NaNs in float16_to_float32()
Date: Wed, 9 Feb 2011 19:42:09 +0100 [thread overview]
Message-ID: <20110209184209.GE3131@volta.aurel32.net> (raw)
In-Reply-To: <1297268850-5777-5-git-send-email-peter.maydell@linaro.org>
On Wed, Feb 09, 2011 at 04:27:28PM +0000, Peter Maydell wrote:
> Correctly handle NaNs in float16_to_float32(), by defining and
> using a float16ToCommonNaN() function, as we do with the other formats.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> fpu/softfloat-specialize.h | 17 +++++++++++++++++
> fpu/softfloat.c | 4 +---
> 2 files changed, 18 insertions(+), 3 deletions(-)
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
> diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
> index 4907484..af82359 100644
> --- a/fpu/softfloat-specialize.h
> +++ b/fpu/softfloat-specialize.h
> @@ -116,6 +116,23 @@ float16 float16_maybe_silence_nan(float16 a)
> }
>
> /*----------------------------------------------------------------------------
> +| Returns the result of converting the half-precision floating-point NaN
> +| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid
> +| exception is raised.
> +*----------------------------------------------------------------------------*/
> +
> +static commonNaNT float16ToCommonNaN( float16 a STATUS_PARAM )
> +{
> + commonNaNT z;
> +
> + if ( float16_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR );
> + z.sign = a >> 15;
> + z.low = 0;
> + z.high = ((bits64) a)<<54;
> + return z;
> +}
> +
> +/*----------------------------------------------------------------------------
> | Returns the result of converting the canonical NaN `a' to the half-
> | precision floating-point format.
> *----------------------------------------------------------------------------*/
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index 4d51428..735db38 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -2733,9 +2733,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
>
> if (aExp == 0x1f && ieee) {
> if (aSig) {
> - /* Make sure correct exceptions are raised. */
> - float32ToCommonNaN(a STATUS_VAR);
> - aSig |= 0x200;
> + return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR);
> }
> return packFloat32(aSign, 0xff, aSig << 13);
> }
> --
> 1.7.1
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
next prev parent reply other threads:[~2011-02-09 18:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 16:27 [Qemu-devel] [PATCH v2 0/6] target-arm: Fix floating point conversions Peter Maydell
2011-02-09 16:27 ` [Qemu-devel] [PATCH v2 1/6] softfloat: Add float16 type and float16 NaN handling functions Peter Maydell
2011-02-09 18:40 ` Aurelien Jarno
2011-02-09 19:25 ` Peter Maydell
2011-02-09 16:27 ` [Qemu-devel] [PATCH v2 2/6] softfloat: Honour default_nan_mode for float-to-float conversions Peter Maydell
2011-02-09 18:40 ` Aurelien Jarno
2011-02-09 16:27 ` [Qemu-devel] [PATCH v2 3/6] softfloat: Fix single-to-half precision float conversions Peter Maydell
2011-02-09 18:41 ` Aurelien Jarno
2011-02-09 16:27 ` [Qemu-devel] [PATCH v2 4/6] softfloat: Correctly handle NaNs in float16_to_float32() Peter Maydell
2011-02-09 18:42 ` Aurelien Jarno [this message]
2011-02-09 16:27 ` [Qemu-devel] [PATCH v2 5/6] target-arm: Silence NaNs resulting from half-precision conversions Peter Maydell
2011-02-09 18:42 ` Aurelien Jarno
2011-02-09 16:27 ` [Qemu-devel] [PATCH v2 6/6] target-arm: Use standard FPSCR for Neon half-precision operations Peter Maydell
2011-02-09 18:43 ` Aurelien Jarno
2011-02-09 19:03 ` 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=20110209184209.GE3131@volta.aurel32.net \
--to=aurelien@aurel32.net \
--cc=christophe.lyon@st.com \
--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).