All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc: Fix xsrdpi, xvrdpi and xvrspi rounding
@ 2016-07-03 23:20 Anton Blanchard
  2016-07-04  2:11 ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Blanchard @ 2016-07-03 23:20 UTC (permalink / raw)
  To: david, agraf; +Cc: qemu-ppc, qemu-devel, Anton Blanchard

From: Anton Blanchard <anton@samba.org>

xsrdpi, xvrdpi and xvrspi use the round ties away method, not round
nearest even.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 target-ppc/fpu_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c
index 4ef893b..d9795d0 100644
--- a/target-ppc/fpu_helper.c
+++ b/target-ppc/fpu_helper.c
@@ -2689,19 +2689,19 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)                    \
     helper_float_check_status(env);                                    \
 }
 
-VSX_ROUND(xsrdpi, 1, float64, VsrD(0), float_round_nearest_even, 1)
+VSX_ROUND(xsrdpi, 1, float64, VsrD(0), float_round_ties_away, 1)
 VSX_ROUND(xsrdpic, 1, float64, VsrD(0), FLOAT_ROUND_CURRENT, 1)
 VSX_ROUND(xsrdpim, 1, float64, VsrD(0), float_round_down, 1)
 VSX_ROUND(xsrdpip, 1, float64, VsrD(0), float_round_up, 1)
 VSX_ROUND(xsrdpiz, 1, float64, VsrD(0), float_round_to_zero, 1)
 
-VSX_ROUND(xvrdpi, 2, float64, VsrD(i), float_round_nearest_even, 0)
+VSX_ROUND(xvrdpi, 2, float64, VsrD(i), float_round_ties_away, 0)
 VSX_ROUND(xvrdpic, 2, float64, VsrD(i), FLOAT_ROUND_CURRENT, 0)
 VSX_ROUND(xvrdpim, 2, float64, VsrD(i), float_round_down, 0)
 VSX_ROUND(xvrdpip, 2, float64, VsrD(i), float_round_up, 0)
 VSX_ROUND(xvrdpiz, 2, float64, VsrD(i), float_round_to_zero, 0)
 
-VSX_ROUND(xvrspi, 4, float32, VsrW(i), float_round_nearest_even, 0)
+VSX_ROUND(xvrspi, 4, float32, VsrW(i), float_round_ties_away, 0)
 VSX_ROUND(xvrspic, 4, float32, VsrW(i), FLOAT_ROUND_CURRENT, 0)
 VSX_ROUND(xvrspim, 4, float32, VsrW(i), float_round_down, 0)
 VSX_ROUND(xvrspip, 4, float32, VsrW(i), float_round_up, 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc: Fix xsrdpi, xvrdpi and xvrspi rounding
  2016-07-03 23:20 [Qemu-devel] [PATCH] ppc: Fix xsrdpi, xvrdpi and xvrspi rounding Anton Blanchard
@ 2016-07-04  2:11 ` David Gibson
  2016-07-04 10:43   ` Anton Blanchard
  0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2016-07-04  2:11 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: agraf, qemu-ppc, qemu-devel, Anton Blanchard

[-- Attachment #1: Type: text/plain, Size: 2205 bytes --]

On Mon, Jul 04, 2016 at 09:20:12AM +1000, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
> 
> xsrdpi, xvrdpi and xvrspi use the round ties away method, not round
> nearest even.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Applied to ppc-for-2.7.

I take it float_round_ties_away is the same thing the architecture
refers to as "round to Nearest Away"?


> ---
>  target-ppc/fpu_helper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c
> index 4ef893b..d9795d0 100644
> --- a/target-ppc/fpu_helper.c
> +++ b/target-ppc/fpu_helper.c
> @@ -2689,19 +2689,19 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)                    \
>      helper_float_check_status(env);                                    \
>  }
>  
> -VSX_ROUND(xsrdpi, 1, float64, VsrD(0), float_round_nearest_even, 1)
> +VSX_ROUND(xsrdpi, 1, float64, VsrD(0), float_round_ties_away, 1)
>  VSX_ROUND(xsrdpic, 1, float64, VsrD(0), FLOAT_ROUND_CURRENT, 1)
>  VSX_ROUND(xsrdpim, 1, float64, VsrD(0), float_round_down, 1)
>  VSX_ROUND(xsrdpip, 1, float64, VsrD(0), float_round_up, 1)
>  VSX_ROUND(xsrdpiz, 1, float64, VsrD(0), float_round_to_zero, 1)
>  
> -VSX_ROUND(xvrdpi, 2, float64, VsrD(i), float_round_nearest_even, 0)
> +VSX_ROUND(xvrdpi, 2, float64, VsrD(i), float_round_ties_away, 0)
>  VSX_ROUND(xvrdpic, 2, float64, VsrD(i), FLOAT_ROUND_CURRENT, 0)
>  VSX_ROUND(xvrdpim, 2, float64, VsrD(i), float_round_down, 0)
>  VSX_ROUND(xvrdpip, 2, float64, VsrD(i), float_round_up, 0)
>  VSX_ROUND(xvrdpiz, 2, float64, VsrD(i), float_round_to_zero, 0)
>  
> -VSX_ROUND(xvrspi, 4, float32, VsrW(i), float_round_nearest_even, 0)
> +VSX_ROUND(xvrspi, 4, float32, VsrW(i), float_round_ties_away, 0)
>  VSX_ROUND(xvrspic, 4, float32, VsrW(i), FLOAT_ROUND_CURRENT, 0)
>  VSX_ROUND(xvrspim, 4, float32, VsrW(i), float_round_down, 0)
>  VSX_ROUND(xvrspip, 4, float32, VsrW(i), float_round_up, 0)

-- 
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: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc: Fix xsrdpi, xvrdpi and xvrspi rounding
  2016-07-04  2:11 ` David Gibson
@ 2016-07-04 10:43   ` Anton Blanchard
  0 siblings, 0 replies; 3+ messages in thread
From: Anton Blanchard @ 2016-07-04 10:43 UTC (permalink / raw)
  To: David Gibson; +Cc: agraf, qemu-ppc, qemu-devel

Hi David,

> I take it float_round_ties_away is the same thing the architecture
> refers to as "round to Nearest Away"?

Yeah. I noticed it when 0.5 got rounded to 0 on QEMU and 1.0 on real
hardware.

Anton

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-04 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-03 23:20 [Qemu-devel] [PATCH] ppc: Fix xsrdpi, xvrdpi and xvrspi rounding Anton Blanchard
2016-07-04  2:11 ` David Gibson
2016-07-04 10:43   ` Anton Blanchard

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.