From: Toni Wilen Date: Sat, 11 Mar 2017 20:32:24 +0000 (+0200) Subject: Fix JIT FPU support. X-Git-Tag: 3500~85 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=1635f1ccd75d62b4887cace0abc0a91626ffd173;p=francis%2Fwinuae.git Fix JIT FPU support. --- diff --git a/fpp.cpp b/fpp.cpp index a12c3334..2daea2d5 100644 --- a/fpp.cpp +++ b/fpp.cpp @@ -606,11 +606,6 @@ uae_u32 fpp_get_fpsr (void) return regs.fpsr; } -static void fpp_set_fpsr (uae_u32 val) -{ - regs.fpsr = val; -} - static void fpp_set_fpcr (uae_u32 val) { fpp_set_mode(val); @@ -631,6 +626,25 @@ static void fpset (fpdata *fpd, uae_s32 val) fpp_from_int(fpd, val); } +static void fpp_set_fpsr (uae_u32 val) +{ + regs.fpsr = val; + +#ifdef JIT + // check comment in fpp_cond + if (currprefs.compfpu) { + if (val & 0x01000000) + fpnan(®s.fp_result); + else if (val & 0x04000000) + fpset(®s.fp_result, 0); + else if (val & 0x08000000) + fpset(®s.fp_result, -1); + else + fpset(®s.fp_result, 1); + } +#endif +} + bool fpu_get_constant(fpdata *fpd, int cr) { uae_u32 *f = NULL; @@ -1812,11 +1826,23 @@ static int get_fp_ad (uae_u32 opcode, uae_u32 * ad) int fpp_cond (int condition) { - int NotANumber = (regs.fpsr & FPSR_CC_NAN) != 0; - int N = (regs.fpsr & FPSR_CC_N) != 0; - int Z = (regs.fpsr & FPSR_CC_Z) != 0; + int NotANumber, N, Z; + +#ifdef JIT + if (currprefs.compfpu) { + // JIT reads and writes regs.fpu_result + NotANumber = fpp_is_nan(®s.fp_result); + N = fpp_is_neg(®s.fp_result); + Z = fpp_is_zero(®s.fp_result); + } else +#endif + { + NotANumber = (regs.fpsr & FPSR_CC_NAN) != 0; + N = (regs.fpsr & FPSR_CC_N) != 0; + Z = (regs.fpsr & FPSR_CC_Z) != 0; + } - if ((condition & 0x10) && NotANumber) { + if ((condition & 0x10) && NotANumber) { if (fpsr_set_bsun()) return -2; } diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 03312d02..4afbc371 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -2789,7 +2789,7 @@ void init_comp(void) } else if (i==FP_RESULT) { #ifdef UAE - live.fate[i].mem=(uae_u32*)(®s.fp_result); + live.fate[i].mem=(uae_u32*)(®s.fp_result.fp); #else live.fate[i].mem=(uae_u32*)(&fpu.result); #endif