aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorClément Chigot <chigot@adacore.com>2024-06-06 16:43:31 +0200
committerRichard Henderson <richard.henderson@linaro.org>2024-06-19 13:50:22 -0700
commit6b4965373e561b77f91cfbdf41353635c9661358 (patch)
tree750718f74063335ccc3f9e09ad3aae816bc7d6b5 /target
parent54b27921026df384f67df86f04c39539df375c60 (diff)
downloadqemu-6b4965373e561b77f91cfbdf41353635c9661358.zip
qemu-6b4965373e561b77f91cfbdf41353635c9661358.tar.gz
qemu-6b4965373e561b77f91cfbdf41353635c9661358.tar.bz2
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>
Diffstat (limited to 'target')
-rw-r--r--target/sparc/helper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/sparc/helper.c b/target/sparc/helper.c
index 2247e24..7846ddd 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);