ppc: Fix xsrdpi, xvrdpi and xvrspi rounding
PATCH 1/1 ppc: Fix xsrdpi, xvrdpi and xvrspi rounding
From: Anton Blanchard <[email protected]>
xsrdpi, xvrdpi and xvrspi use the round ties away method, not round nearest even.
Signed-off-by Anton Blanchard <[email protected]>
--- target-ppc/fpu_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-ppc/fpu_helper.c +3 -3
@@ -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 )
Signature · 1 line
2.7.4
David Gibson
AppliedQuoted 6 lines · Anton Blanchard
From: Anton Blanchard <[email protected]>
xsrdpi, xvrdpi and xvrspi use the round ties away method, not round nearest even.
Signed-off-by Anton Blanchard <[email protected]>
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"?
Quoted 31 lines
--- target-ppc/fpu_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)target-ppc/fpu_helper.c +3
-3@@ -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 )
Signature · 4 lines
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
Hi David,
Quoted 2 lines
I take it
float_round_ties_awayis 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