* [PATCH] target/sparc: use signed denominator in sdiv helper
@ 2024-06-06 14:43 Clément Chigot
2024-06-06 17:07 ` Richard Henderson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Clément Chigot @ 2024-06-06 14:43 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, 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 <chigot@adacore.com>
---
target/sparc/helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/sparc/helper.c b/target/sparc/helper.c
index 2247e243b5..7846ddd6f6 100644
--- a/target/sparc/helper.c
+++ b/target/sparc/helper.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] target/sparc: use signed denominator in sdiv helper
2024-06-06 14:43 [PATCH] target/sparc: use signed denominator in sdiv helper Clément Chigot
@ 2024-06-06 17:07 ` Richard Henderson
2024-06-06 17:34 ` Mark Cave-Ayland
2024-06-16 18:39 ` Richard Henderson
2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-06-06 17:07 UTC (permalink / raw)
To: Clément Chigot, qemu-devel
On 6/6/24 07:43, Clément Chigot wrote:
> 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 <chigot@adacore.com>
> ---
> target/sparc/helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/sparc/helper.c b/target/sparc/helper.c
> index 2247e243b5..7846ddd6f6 100644
> --- a/target/sparc/helper.c
> +++ b/target/sparc/helper.c
> @@ -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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/sparc: use signed denominator in sdiv helper
2024-06-06 14:43 [PATCH] target/sparc: use signed denominator in sdiv helper Clément Chigot
2024-06-06 17:07 ` Richard Henderson
@ 2024-06-06 17:34 ` Mark Cave-Ayland
2024-06-16 18:39 ` Richard Henderson
2 siblings, 0 replies; 4+ messages in thread
From: Mark Cave-Ayland @ 2024-06-06 17:34 UTC (permalink / raw)
To: Clément Chigot, qemu-devel; +Cc: richard.henderson
On 06/06/2024 15:43, Clément Chigot wrote:
> 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 <chigot@adacore.com>
> ---
> target/sparc/helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/sparc/helper.c b/target/sparc/helper.c
> index 2247e243b5..7846ddd6f6 100644
> --- a/target/sparc/helper.c
> +++ b/target/sparc/helper.c
> @@ -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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/sparc: use signed denominator in sdiv helper
2024-06-06 14:43 [PATCH] target/sparc: use signed denominator in sdiv helper Clément Chigot
2024-06-06 17:07 ` Richard Henderson
2024-06-06 17:34 ` Mark Cave-Ayland
@ 2024-06-16 18:39 ` Richard Henderson
2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-06-16 18:39 UTC (permalink / raw)
To: Clément Chigot, qemu-devel
On 6/6/24 07:43, Clément Chigot wrote:
> 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 <chigot@adacore.com>
> ---
> target/sparc/helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/sparc/helper.c b/target/sparc/helper.c
> index 2247e243b5..7846ddd6f6 100644
> --- a/target/sparc/helper.c
> +++ b/target/sparc/helper.c
> @@ -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~
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-16 18:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06 14:43 [PATCH] target/sparc: use signed denominator in sdiv helper Clément Chigot
2024-06-06 17:07 ` Richard Henderson
2024-06-06 17:34 ` Mark Cave-Ayland
2024-06-16 18:39 ` Richard Henderson
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).