* [Qemu-devel] [PATCH] ppc: Fix emulated INFINITY and NAN conversions
@ 2019-08-19 19:19 Paul A. Clarke
2019-08-19 20:57 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Paul A. Clarke @ 2019-08-19 19:19 UTC (permalink / raw)
To: david; +Cc: richard.henderson, qemu-ppc, qemu-devel
From: "Paul A. Clarke" <pc@us.ibm.com>
helper_todouble() was not properly converting INFINITY from 32 bit
float to 64 bit double.
(Normalized operand conversion is unchanged, other than indentation.)
Signed-off-by: Paul A. Clarke <pc@us.ibm.com>
---
target/ppc/fpu_helper.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 23b9c97..52bcda2 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -58,10 +58,17 @@ uint64_t helper_todouble(uint32_t arg)
uint64_t ret;
if (likely(abs_arg >= 0x00800000)) {
- /* Normalized operand, or Inf, or NaN. */
- ret = (uint64_t)extract32(arg, 30, 2) << 62;
- ret |= ((extract32(arg, 30, 1) ^ 1) * (uint64_t)7) << 59;
- ret |= (uint64_t)extract32(arg, 0, 30) << 29;
+ if (unlikely(extract32(arg, 23, 8) == 0xff)) {
+ /* Inf or NAN. */
+ ret = (uint64_t)extract32(arg, 31, 1) << 63;
+ ret |= (uint64_t)0x7ff << 52;
+ ret |= (uint64_t)extract32(arg, 0, 23) << 29;
+ } else {
+ /* Normalized operand. */
+ ret = (uint64_t)extract32(arg, 30, 2) << 62;
+ ret |= ((extract32(arg, 30, 1) ^ 1) * (uint64_t)7) << 59;
+ ret |= (uint64_t)extract32(arg, 0, 30) << 29;
+ }
} else {
/* Zero or Denormalized operand. */
ret = (uint64_t)extract32(arg, 31, 1) << 63;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: Fix emulated INFINITY and NAN conversions
2019-08-19 19:19 [Qemu-devel] [PATCH] ppc: Fix emulated INFINITY and NAN conversions Paul A. Clarke
@ 2019-08-19 20:57 ` Richard Henderson
2019-08-20 0:59 ` David Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2019-08-19 20:57 UTC (permalink / raw)
To: Paul A. Clarke, david; +Cc: qemu-ppc, qemu-devel
On 8/19/19 12:19 PM, Paul A. Clarke wrote:
> From: "Paul A. Clarke" <pc@us.ibm.com>
>
> helper_todouble() was not properly converting INFINITY from 32 bit
> float to 64 bit double.
>
> (Normalized operand conversion is unchanged, other than indentation.)
>
> Signed-off-by: Paul A. Clarke <pc@us.ibm.com>
> ---
> target/ppc/fpu_helper.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: Fix emulated INFINITY and NAN conversions
2019-08-19 20:57 ` Richard Henderson
@ 2019-08-20 0:59 ` David Gibson
0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2019-08-20 0:59 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-ppc, Paul A. Clarke, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
On Mon, Aug 19, 2019 at 01:57:42PM -0700, Richard Henderson wrote:
> On 8/19/19 12:19 PM, Paul A. Clarke wrote:
> > From: "Paul A. Clarke" <pc@us.ibm.com>
> >
> > helper_todouble() was not properly converting INFINITY from 32 bit
> > float to 64 bit double.
> >
> > (Normalized operand conversion is unchanged, other than indentation.)
> >
> > Signed-off-by: Paul A. Clarke <pc@us.ibm.com>
> > ---
> > target/ppc/fpu_helper.c | 15 +++++++++++----
> > 1 file changed, 11 insertions(+), 4 deletions(-)
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Applied to ppc-for-4.2, thanks.
>
>
> r~
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-20 1:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 19:19 [Qemu-devel] [PATCH] ppc: Fix emulated INFINITY and NAN conversions Paul A. Clarke
2019-08-19 20:57 ` Richard Henderson
2019-08-20 0:59 ` David Gibson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.