diff options
author | Clément Chigot <chigot@adacore.com> | 2024-06-06 16:43:31 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-06-20 15:22:44 +0300 |
commit | f4564fc8d262808cc530d22d70324921138e7077 (patch) | |
tree | e442f125db41edf4a9b060e8f0a23cde542e657a | |
parent | 1649e9559b964c3b1267541e6e2eccb7cc083781 (diff) |
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).
Cc: qemu-stable@nongnu.org
Fixes: 1326010322d6 ("target/sparc: Remove CC_OP_DIV")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2319
Signed-off-by: Clément Chigot <chigot@adacore.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240606144331.698361-1-chigot@adacore.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 6b4965373e561b77f91cfbdf41353635c9661358)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | target/sparc/helper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target/sparc/helper.c b/target/sparc/helper.c index bd10b60e4b..8820c59e7c 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); |