diff options
author | Laurent Vivier <laurent@vivier.eu> | 2017-06-28 22:42:40 +0200 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2017-06-29 20:29:00 +0200 |
commit | 77bdb2292492fafc4bc0fbb4d8c44fdd0ef1fa8e (patch) | |
tree | c6ca7c82c19b06f8cf6f805dc7bf51558e76a08f /target/m68k/fpu_helper.c | |
parent | 2f77995cebc8027851b8ea8f02c097fb8cdf668a (diff) | |
download | qemu-77bdb2292492fafc4bc0fbb4d8c44fdd0ef1fa8e.zip qemu-77bdb2292492fafc4bc0fbb4d8c44fdd0ef1fa8e.tar.gz qemu-77bdb2292492fafc4bc0fbb4d8c44fdd0ef1fa8e.tar.bz2 |
target/m68k: add explicit single and double precision operations (part 2)
Add fsabs, fdabs, fsneg, fdneg, fsmove and fdmove.
The value is converted using the new floatx80_round() function.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20170628204241.32106-7-laurent@vivier.eu>
Diffstat (limited to 'target/m68k/fpu_helper.c')
-rw-r--r-- | target/m68k/fpu_helper.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 600ae8a..382fbc1 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -167,6 +167,20 @@ void HELPER(set_fpcr)(CPUM68KState *env, uint32_t val) set_floatx80_rounding_precision(old, &env->fp_status); \ } while (0) +void HELPER(fsround)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + PREC_BEGIN(32); + res->d = floatx80_round(val->d, &env->fp_status); + PREC_END(); +} + +void HELPER(fdround)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + PREC_BEGIN(64); + res->d = floatx80_round(val->d, &env->fp_status); + PREC_END(); +} + void HELPER(fsqrt)(CPUM68KState *env, FPReg *res, FPReg *val) { res->d = floatx80_sqrt(val->d, &env->fp_status); @@ -188,12 +202,40 @@ void HELPER(fdsqrt)(CPUM68KState *env, FPReg *res, FPReg *val) void HELPER(fabs)(CPUM68KState *env, FPReg *res, FPReg *val) { - res->d = floatx80_abs(val->d); + res->d = floatx80_round(floatx80_abs(val->d), &env->fp_status); +} + +void HELPER(fsabs)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + PREC_BEGIN(32); + res->d = floatx80_round(floatx80_abs(val->d), &env->fp_status); + PREC_END(); +} + +void HELPER(fdabs)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + PREC_BEGIN(64); + res->d = floatx80_round(floatx80_abs(val->d), &env->fp_status); + PREC_END(); +} + +void HELPER(fneg)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + res->d = floatx80_round(floatx80_chs(val->d), &env->fp_status); } -void HELPER(fchs)(CPUM68KState *env, FPReg *res, FPReg *val) +void HELPER(fsneg)(CPUM68KState *env, FPReg *res, FPReg *val) { - res->d = floatx80_chs(val->d); + PREC_BEGIN(32); + res->d = floatx80_round(floatx80_chs(val->d), &env->fp_status); + PREC_END(); +} + +void HELPER(fdneg)(CPUM68KState *env, FPReg *res, FPReg *val) +{ + PREC_BEGIN(64); + res->d = floatx80_round(floatx80_chs(val->d), &env->fp_status); + PREC_END(); } void HELPER(fadd)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1) |