Skip to content

Commit

Permalink
Move setround to fpu_setround
Browse files Browse the repository at this point in the history
  • Loading branch information
Hagb committed Apr 14, 2024
1 parent be3a40a commit fe22932
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/emu/x86rund8.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "x86emu_private.h"
#include "x86run_private.h"
#include "x87emu_private.h"
#include "x87emu_setround.h"
#include "x86primop.h"
#include "x86trace.h"
#include "box86context.h"
#include "setround.h"

#include "modrm.h"

Expand All @@ -34,7 +34,7 @@ uintptr_t RunD8(x86emu_t *emu, uintptr_t addr)
#ifdef TEST_INTERPRETER
x86emu_t*emu = test->emu;
#endif
int oldround = setround(emu);
int oldround = fpu_setround(emu);

nextop = F8;
switch (nextop) {
Expand Down
20 changes: 10 additions & 10 deletions src/emu/x86rund9.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

#include "debug.h"
#include "box86stack.h"
#include "setround.h"
#include "x86emu.h"
#include "x86run.h"
#include "x86emu_private.h"
#include "x86run_private.h"
#include "x87emu_private.h"
#include "x87emu_setround.h"
#include "x86primop.h"
#include "x86trace.h"
#include "box86context.h"
Expand Down Expand Up @@ -128,7 +128,7 @@ uintptr_t RunD9(x86emu_t *emu, uintptr_t addr)
emu->sw.f.F87_C1 = 0;
break;
case 0xF2: /* FPTAN */
oldround = setround(emu);
oldround = fpu_setround(emu);
ST0.d = tan(ST0.d);
fesetround(oldround);
fpu_do_push(emu);
Expand All @@ -137,7 +137,7 @@ uintptr_t RunD9(x86emu_t *emu, uintptr_t addr)
emu->sw.f.F87_C1 = 0;
break;
case 0xF3: /* FPATAN */
oldround = setround(emu);
oldround = fpu_setround(emu);
ST1.d = atan2(ST1.d, ST0.d);
fesetround(oldround);
fpu_do_pop(emu);
Expand Down Expand Up @@ -208,14 +208,14 @@ uintptr_t RunD9(x86emu_t *emu, uintptr_t addr)
emu->sw.f.F87_C1 = 0;
break;
case 0xFA: /* FSQRT */
oldround = setround(emu);
oldround = fpu_setround(emu);
ST0.d = sqrt(ST0.d);
fesetround(oldround);
emu->sw.f.F87_C1 = 0;
break;
case 0xFB: /* FSINCOS */
fpu_do_push(emu);
oldround = setround(emu);
oldround = fpu_setround(emu);
sincos(ST1.d, &ST1.d, &ST0.d);
fesetround(oldround);
emu->sw.f.F87_C2 = 0;
Expand All @@ -233,21 +233,21 @@ uintptr_t RunD9(x86emu_t *emu, uintptr_t addr)
else
tmp32s = ST1.d;
if(ST0.d!=0.0) {
oldround = setround(emu);
oldround = fpu_setround(emu);
ST0.d = ldexp(ST0.d, tmp32s);
fesetround(oldround);
}
emu->sw.f.F87_C1 = 0;
break;
case 0xFE: /* FSIN */
oldround = setround(emu);
oldround = fpu_setround(emu);
ST0.d = sin(ST0.d);
fesetround(oldround);
emu->sw.f.F87_C2 = 0;
emu->sw.f.F87_C1 = 0;
break;
case 0xFF: /* FCOS */
oldround = setround(emu);
oldround = fpu_setround(emu);
ST0.d = cos(ST0.d);
fesetround(oldround);
emu->sw.f.F87_C2 = 0;
Expand Down Expand Up @@ -289,7 +289,7 @@ uintptr_t RunD9(x86emu_t *emu, uintptr_t addr)
case 2: /* FST Ed, ST0 */
GET_ED;
if(!(((uintptr_t)ED)&3)) {
oldround = setround(emu);
oldround = fpu_setround(emu);
*(float*)ED = ST0.d;
fesetround(oldround);
} else {
Expand All @@ -300,7 +300,7 @@ uintptr_t RunD9(x86emu_t *emu, uintptr_t addr)
case 3: /* FSTP Ed, ST0 */
GET_ED;
if(!(((uintptr_t)ED)&3)) {
oldround = setround(emu);
oldround = fpu_setround(emu);
*(float*)ED = ST0.d;
fesetround(oldround);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/emu/x86runda.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "x86emu_private.h"
#include "x86run_private.h"
#include "x87emu_private.h"
#include "x87emu_setround.h"
#include "x86primop.h"
#include "x86trace.h"
#include "box86context.h"
#include "setround.h"

#include "modrm.h"

Expand Down Expand Up @@ -103,7 +103,7 @@ uintptr_t RunDA(x86emu_t *emu, uintptr_t addr)
case 0xFD:
return 0;
default:;
int oldround = setround(emu);
int oldround = fpu_setround(emu);
switch((nextop>>3)&7) {
case 0: /* FIADD ST0, Ed int */
GET_ED;
Expand Down
4 changes: 2 additions & 2 deletions src/emu/x86rundc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "x86emu_private.h"
#include "x86run_private.h"
#include "x87emu_private.h"
#include "x87emu_setround.h"
#include "x86primop.h"
#include "x86trace.h"
#include "box86context.h"
#include "setround.h"

#include "modrm.h"

Expand All @@ -34,7 +34,7 @@ uintptr_t RunDC(x86emu_t *emu, uintptr_t addr)
x86emu_t*emu = test->emu;
#endif

int oldround = setround(emu);
int oldround = fpu_setround(emu);
nextop = F8;
switch(nextop) {
case 0xC0:
Expand Down
4 changes: 2 additions & 2 deletions src/emu/x86runde.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include "debug.h"
#include "box86stack.h"
#include "setround.h"
#include "x86emu.h"
#include "x86run.h"
#include "x86emu_private.h"
#include "x86run_private.h"
#include "x87emu_private.h"
#include "x87emu_setround.h"
#include "x86primop.h"
#include "x86trace.h"
#include "box86context.h"
Expand All @@ -33,7 +33,7 @@ uintptr_t RunDE(x86emu_t *emu, uintptr_t addr)
x86emu_t*emu = test->emu;
#endif

int oldround = setround(emu);
int oldround = fpu_setround(emu);
nextop = F8;
switch (nextop) {
case 0xC0: /* FADDP STx, ST0 */
Expand Down

0 comments on commit fe22932

Please sign in to comment.