From 512f0a6c92f28bb391e4343b8350bde246a3177e Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 4 Dec 2024 10:25:46 +0100 Subject: [PATCH] [INTERPRETER] Improve x87 comparison (backported from Box64) --- src/emu/x87emu_private.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/emu/x87emu_private.h b/src/emu/x87emu_private.h index afde0debf..d39302687 100755 --- a/src/emu/x87emu_private.h +++ b/src/emu/x87emu_private.h @@ -84,6 +84,10 @@ static inline void fpu_fcom(x86emu_t* emu, double b) emu->sw.f.F87_C0 = 1; emu->sw.f.F87_C2 = 1; emu->sw.f.F87_C3 = 1; + } else if ((b==-INFINITY) || (ST0.d==INFINITY)) { + emu->sw.f.F87_C0 = 0; + emu->sw.f.F87_C2 = 0; + emu->sw.f.F87_C3 = 0; } else if (isgreater(ST0.d, b)) { emu->sw.f.F87_C0 = 0; emu->sw.f.F87_C2 = 0; @@ -111,6 +115,10 @@ static inline void fpu_fcomi(x86emu_t* emu, double b) SET_FLAG(F_CF); SET_FLAG(F_PF); SET_FLAG(F_ZF); + } else if ((b==-INFINITY) || (ST0.d==INFINITY)) { + CLEAR_FLAG(F_CF); + CLEAR_FLAG(F_PF); + CLEAR_FLAG(F_ZF); } else if (isgreater(ST0.d, b)) { CLEAR_FLAG(F_CF); CLEAR_FLAG(F_PF);