diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2023-01-14 23:29:56 +0000 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2023-01-16 09:47:31 +0100 |
commit | 3ec21437b1470cff373c002c1ebb4f70f666f0c3 (patch) | |
tree | 1c01267aca2a5a3d92b360bfe3f0042655dc2888 /target/m68k/fpu_helper.c | |
parent | 886fb67020e32ce6a2cf7049c6f017acf1f0d69a (diff) |
target/m68k: pass quotient directly into make_quotient()
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230114232959.118224-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'target/m68k/fpu_helper.c')
-rw-r--r-- | target/m68k/fpu_helper.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index fdc4937e29..0932c464fd 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -515,16 +515,10 @@ uint32_t HELPER(fmovemd_ld_postinc)(CPUM68KState *env, uint32_t addr, return fmovem_postinc(env, addr, mask, cpu_ld_float64_ra); } -static void make_quotient(CPUM68KState *env, floatx80 val) +static void make_quotient(CPUM68KState *env, int32_t quotient) { - int32_t quotient; int sign; - if (floatx80_is_any_nan(val)) { - return; - } - - quotient = floatx80_to_int32(val, &env->fp_status); sign = quotient < 0; if (sign) { quotient = -quotient; @@ -538,14 +532,22 @@ void HELPER(fmod)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1) { res->d = floatx80_mod(val1->d, val0->d, &env->fp_status); - make_quotient(env, res->d); + if (floatx80_is_any_nan(res->d)) { + return; + } + + make_quotient(env, floatx80_to_int32(res->d, &env->fp_status)); } void HELPER(frem)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1) { res->d = floatx80_rem(val1->d, val0->d, &env->fp_status); - make_quotient(env, res->d); + if (floatx80_is_any_nan(res->d)) { + return; + } + + make_quotient(env, floatx80_to_int32(res->d, &env->fp_status)); } void HELPER(fgetexp)(CPUM68KState *env, FPReg *res, FPReg *val) |