target/sparc: use signed denominator in sdiv helper
PATCH 1/1 target/sparc: use signed denominator in sdiv helper
The result has to be done with the signed denominator (b32) instead of the unsigned value passed in argument (b).
--- target/sparc/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/sparc/helper.c +1 -1
@@ -121,7 +121,7 @@ uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b)return (uint32_t )(b32 <0 ?INT32_MAX :INT32_MIN ) | (-1ull <<32 ); } - a64 /= b; + a64 /= b32; r = a64;if (unlikely (r != a64)) {return (uint32_t )(a64 <0 ?INT32_MIN :INT32_MAX ) | (-1ull <<32 );
Signature · 1 line
2.25.1
Quoted 14 lines · Clément Chigot
The result has to be done with the signed denominator (b32) instead of the unsigned value passed in argument (b).
Fixes 1326010322d6 ("target/sparc: Remove CC_OP_DIV")Signed-off-by Clément Chigot <[email protected]>--- target/sparc/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/sparc/helper.c +0
-0
target/sparc/helper.c uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b) · line 127
Quoted 8 lines
target/sparc/helper.c +1
-1@@ -121,7 +121,7 @@ uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b)return (uint32_t )(b32 <0 ?INT32_MAX :INT32_MIN ) | (-1ull <<32 ); } - a64 /= b; + a64 /= b32; r = a64;if (unlikely (r != a64)) {return (uint32_t )(a64 <0 ?INT32_MIN :INT32_MAX ) | (-1ull <<32 );
Oops.
r~
Quoted 14 lines · Clément Chigot
The result has to be done with the signed denominator (b32) instead of the unsigned value passed in argument (b).
Fixes 1326010322d6 ("target/sparc: Remove CC_OP_DIV")Signed-off-by Clément Chigot <[email protected]>--- target/sparc/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/sparc/helper.c +0
-0
target/sparc/helper.c uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b) · line 127
Quoted 8 lines
target/sparc/helper.c +1
-1@@ -121,7 +121,7 @@ uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b)return (uint32_t )(b32 <0 ?INT32_MAX :INT32_MIN ) | (-1ull <<32 ); } - a64 /= b; + a64 /= b32; r = a64;if (unlikely (r != a64)) {return (uint32_t )(a64 <0 ?INT32_MIN :INT32_MAX ) | (-1ull <<32 );
Thanks for the patch! I think this might also be:
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2319
ATB,
Mark.
Richard Henderson
AppliedQuoted 14 lines · Clément Chigot
The result has to be done with the signed denominator (b32) instead of the unsigned value passed in argument (b).
Fixes 1326010322d6 ("target/sparc: Remove CC_OP_DIV")Signed-off-by Clément Chigot <[email protected]>--- target/sparc/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/sparc/helper.c +0
-0
target/sparc/helper.c uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b) · line 127
Quoted 8 lines
target/sparc/helper.c +1
-1@@ -121,7 +121,7 @@ uint64_t helper_sdiv(CPUSPARCState *env, target_ulong a, target_ulong b)return (uint32_t )(b32 <0 ?INT32_MAX :INT32_MIN ) | (-1ull <<32 ); } - a64 /= b; + a64 /= b32; r = a64;if (unlikely (r != a64)) {return (uint32_t )(a64 <0 ?INT32_MIN :INT32_MAX ) | (-1ull <<32 );
Queued, thanks.
r~