Skip to content

Commit

Permalink
[INTERPRETER] Improve x87 comparison (backported from Box64)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Dec 4, 2024
1 parent 1c280bd commit 512f0a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/emu/x87emu_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 512f0a6

Please sign in to comment.