[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] target/m68k: fix FPSR quotient byte for fmod instruction
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 3/4] target/m68k: fix FPSR quotient byte for fmod instruction |
Date: |
Sun, 1 Jan 2023 14:43:37 +0000 |
The FPSR quotient byte should be set to the value of the quotient and not the
result. Switch from using floatx80_mod() to floatx80_modrem() which returns
the quotient as a uint64_t which can be used for the quotient byte.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
target/m68k/fpu_helper.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
index ae839785fa..18594a35af 100644
--- a/target/m68k/fpu_helper.c
+++ b/target/m68k/fpu_helper.c
@@ -523,14 +523,17 @@ static void make_quotient(CPUM68KState *env, int sign,
uint32_t quotient)
void HELPER(fmod)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
- res->d = floatx80_mod(val1->d, val0->d, &env->fp_status);
+ uint64_t quotient;
+ int sign = extractFloatx80Sign(val1->d) ^ extractFloatx80Sign(val0->d);
+
+ res->d = floatx80_modrem(val1->d, val0->d, true, "ient,
+ &env->fp_status);
if (floatx80_is_any_nan(res->d)) {
return;
}
- make_quotient(env, extractFloatx80Sign(res->d),
- floatx80_to_int32(res->d, &env->fp_status));
+ make_quotient(env, sign, quotient);
}
void HELPER(frem)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
--
2.30.2
- Re: [PATCH 1/4] target/m68k: pass quotient directly into make_quotient(), (continued)
[PATCH 4/4] target/m68k: fix FPSR quotient byte for frem instruction, Mark Cave-Ayland, 2023/01/01
[PATCH 3/4] target/m68k: fix FPSR quotient byte for fmod instruction,
Mark Cave-Ayland <=