From 3ea8a9607fdae391a81ba9da5848c728093a3420 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 30 Apr 2023 00:32:50 +0200 Subject: [PATCH] Replaced my implmenetation of FXTRACT with TC1995's. --- src/cpu/x87_ops_misc.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cpu/x87_ops_misc.h b/src/cpu/x87_ops_misc.h index 3a528f847..21fd4c084 100644 --- a/src/cpu/x87_ops_misc.h +++ b/src/cpu/x87_ops_misc.h @@ -36,12 +36,19 @@ opFNOP(uint32_t fetchdat) static int opFXTRACT(uint32_t fetchdat) { - double_decompose_t temp = (double_decompose_t) ST(0); + x87_conv_t test; + int64_t exp80, exp80final; + double mant; FP_ENTER(); cpu_state.pc++; - ST(0) = (double) temp.exponent; - x87_push((double) temp.mantissa); + test.eind.d = ST(0); + exp80 = test.eind.ll & (0x7ff0000000000000ll); + exp80final = (exp80 >> 52) - BIAS64; + mant = test.eind.d / (pow(2.0, (double)exp80final)); + ST(0) = (double)exp80final; + FP_TAG_VALID; + x87_push(mant); CLOCK_CYCLES_FPU((fpu_type >= FPU_487SX) ? (x87_timings.fxtract) : (x87_timings.fxtract * cpu_multi)); CONCURRENCY_CYCLES((fpu_type >= FPU_487SX) ? (x87_concurrency.fxtract) : (x87_concurrency.fxtract * cpu_multi)); return 0;