qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Christophe Lyon <christophe.lyon@st.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH] Softfloat: Add support to softfloat to return floatxx_default_nan when the corresponding target status flag is set.
Date: Fri, 4 Feb 2011 14:44:48 +0000	[thread overview]
Message-ID: <AANLkTikYh1LFmc4e4DCDpYNxCwxAyazsmG+xZfTmZ89M@mail.gmail.com> (raw)
In-Reply-To: <4D4C06CD.4060900@st.com>

On 4 February 2011 14:01, Christophe Lyon <christophe.lyon@st.com> wrote:
> Some CPUs have a status flag imposing to return floatxx_default_nan
> whatever the input value, when converting from one FP format to
> another. Implement this, using the already existing default_nan_mode
> status flag, only for ARM at the moment, though other architectures
> may have the same feature. This patch only modifies the
> commonNaNToFloat32 and commonNaNToFloat64 conversion functions, as ARM
> only uses these.

> -static float32 commonNaNToFloat32( commonNaNT a )
> +static float32 commonNaNToFloat32( commonNaNT a STATUS_PARAM )
>  {
>     bits32 mantissa = a.high>>41;
> +
> +#if defined(TARGET_ARM)
> +    if ( STATUS(default_nan_mode) ) {
> +        return float32_default_nan;
> +    }
> +#endif

The target-specific #ifdef is pretty ugly.
Fortunately the only architecture except ARM that sets
default_nan_mode is sh4, so all we have to do is find out
what it does with its float-to-float conversions. It looks
to me from
http://documentation.renesas.com/eng/products/mpumcu/rej09b0318_sh_4sm.pdf
that it also returns the default NaN for converting a NaN
from one float format to another. So you can just drop the
#ifdef.

(cc'ing Aurelien to check since he's the SH4 maintainer.)

I also think the change is simple enough that we ought to do
it consistently for the floatx80 and float128 functions even if
neither ARM nor sh4 use them.

-- PMM

  reply	other threads:[~2011-02-04 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04 14:01 [Qemu-devel] [PATCH] Softfloat: Add support to softfloat to return floatxx_default_nan when the corresponding target status flag is set Christophe Lyon
2011-02-04 14:44 ` Peter Maydell [this message]
2011-02-04 19:47   ` Aurelien Jarno
2011-02-07 10:17     ` Christophe Lyon
2011-02-07 10:33       ` 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=AANLkTikYh1LFmc4e4DCDpYNxCwxAyazsmG+xZfTmZ89M@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=christophe.lyon@st.com \
    --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).