From 5bc9cdb6815130debddcdb2707bad6cbc8648922 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Mon, 12 Mar 2018 09:20:42 -0400 Subject: [PATCH] target/m68k: define floatx80_move() This functions is needed by upcoming m68k softfloat functions. Source code copied for WinUAE (tag 3500) (The WinUAE file has been copied from QEMU and has the QEMU licensing notice) Backports commit 9a069775a8087cbd6fa8c479b69be8d37bd90351 from qemu --- qemu/target/m68k/softfloat.c | 27 +++++++++++++++++++++++++++ qemu/target/m68k/softfloat.h | 1 + 2 files changed, 28 insertions(+) diff --git a/qemu/target/m68k/softfloat.c b/qemu/target/m68k/softfloat.c index 9cb14190..55eb7a26 100644 --- a/qemu/target/m68k/softfloat.c +++ b/qemu/target/m68k/softfloat.c @@ -247,3 +247,30 @@ floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status) return roundAndPackFloatx80(status->floatx80_rounding_precision, aSign, aExp, aSig, 0, status); } + +floatx80 floatx80_move(floatx80 a, float_status *status) +{ + flag aSign; + int32_t aExp; + uint64_t aSig; + + aSig = extractFloatx80Frac(a); + aExp = extractFloatx80Exp(a); + aSign = extractFloatx80Sign(a); + + if (aExp == 0x7FFF) { + if ((uint64_t)(aSig << 1)) { + return propagateFloatx80NaNOneArg(a, status); + } + return a; + } + if (aExp == 0) { + if (aSig == 0) { + return a; + } + normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision, + aSign, aExp, aSig, 0, status); + } + return roundAndPackFloatx80(status->floatx80_rounding_precision, aSign, + aExp, aSig, 0, status); +} diff --git a/qemu/target/m68k/softfloat.h b/qemu/target/m68k/softfloat.h index 78fbc0cd..18561b87 100644 --- a/qemu/target/m68k/softfloat.h +++ b/qemu/target/m68k/softfloat.h @@ -26,4 +26,5 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status); floatx80 floatx80_getman(floatx80 a, float_status *status); floatx80 floatx80_getexp(floatx80 a, float_status *status); floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status); +floatx80 floatx80_move(floatx80 a, float_status *status); #endif