From: Richard Henderson <richard.henderson@linaro.org>
To: "Paul A. Clarke" <pc@us.ibm.com>, david@gibson.dropbear.id.au
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ppc: Fix xscvdpspn for SNAN
Date: Tue, 20 Aug 2019 11:56:27 -0700 [thread overview]
Message-ID: <b5a38b88-fee6-5469-623e-892e819fdfc1@linaro.org> (raw)
In-Reply-To: <1566321964-1447-1-git-send-email-pc@us.ibm.com>
On 8/20/19 10:26 AM, Paul A. Clarke wrote:
> From: "Paul A. Clarke" <pc@us.ibm.com>
>
> helper_xscvdpspn() uses float64_to_float32() to convert double-precision
> floating-point to single-precision. Unfortunately, float64_to_float32()
> converts SNAN to QNAN, which should not happen with xscvdpspn.
>
> float64_to_float32() is also used by other instruction implementations
> for conversions which _should_ convert SNAN to QNAN.
>
> Rather than trying to wedge code to preserve SNAN in float64_to_float32()
> just for this this one case, I instead embed an embodiment of the
> conversion code outlined in the POWER ISA for xscvdpspn.
>
> Signed-off-by: Paul A. Clarke <pc@us.ibm.com>
> ---
> target/ppc/fpu_helper.c | 32 ++++++++++++++++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
Perhaps a better description is:
---
The xscvdpspn instruction implements a non-arithmetic conversion.
In particular, NaNs are not silenced and rounding is not performed.
Rewrite to match the pseudocode for ConvertDPtoSP_NS() in the
Power 3.0B manual.
---
The term comes from the ieee spec, in that "arithmetic" operations (like add)
are required to notice exceptional conditions like NaN but "non-arithmetic"
operations (like abs) are not required to do so. Thus a valid implementation
of abs merely clears the sign bit without otherwise transforming NaNs.
The code does match the pseudocode, so
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2019-08-20 19:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 17:26 [Qemu-devel] [PATCH] ppc: Fix xscvdpspn for SNAN Paul A. Clarke
2019-08-20 18:56 ` Richard Henderson [this message]
2019-08-21 23:00 ` David Gibson
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=b5a38b88-fee6-5469-623e-892e819fdfc1@linaro.org \
--to=richard.henderson@linaro.org \
--cc=david@gibson.dropbear.id.au \
--cc=pc@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).