Fixed status of C2 x87 flags after sin, cos, sincos and tan function ([DYNCAREC] too) (for #158, thnk @icecream95 for the debugging)

This commit is contained in:
ptitSeb 2021-07-21 12:04:18 +02:00
parent a62a9f6c75
commit d7dcb56105
3 changed files with 23 additions and 0 deletions

View File

@ -213,6 +213,10 @@ uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
VMOV_64(0, v1); // prepare call to tan
CALL_1D(tan, 0);
VMOV_64(v1, 0);
//emu->sw.f.F87_C2 = 0;
LDRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
BFC(x1, 10, 1); //C2 = 0
STRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
#endif
v2 = x87_do_push(dyn, ninst, x3);
#if 0
@ -310,6 +314,10 @@ uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
VSWP(v1, 0);
CALL_1D(cos, 0);
VMOV_64(v2, 0);
//emu->sw.f.F87_C2 = 0;
LDRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
BFC(x1, 10, 1); //C2 = 0
STRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
#endif
break;
case 0xFD:
@ -341,6 +349,10 @@ uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
VMOV_64(0, v1); // prepare call to sin
CALL_1D(sin, 0);
VMOV_64(v1, 0);
//emu->sw.f.F87_C2 = 0;
LDRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
BFC(x1, 10, 1); //C2 = 0
STRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
#endif
break;
case 0xFF:
@ -353,6 +365,10 @@ uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
VMOV_64(0, v1); // prepare call to cos
CALL_1D(cos, 0);
VMOV_64(v1, 0);
//emu->sw.f.F87_C2 = 0;
LDRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
BFC(x1, 10, 1); //C2 = 0
STRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
#endif
break;

View File

@ -50,6 +50,7 @@ void arm_fyl2x(x86emu_t* emu)
void arm_ftan(x86emu_t* emu)
{
ST0.d = tan(ST0.d);
emu->sw.f.F87_C2 = 0;
}
void arm_fpatan(x86emu_t* emu)
{
@ -78,6 +79,7 @@ void arm_fyl2xp1(x86emu_t* emu)
void arm_fsincos(x86emu_t* emu)
{
sincos(ST1.d, &ST1.d, &ST0.d);
emu->sw.f.F87_C2 = 0;
}
void arm_frndint(x86emu_t* emu)
{
@ -91,10 +93,12 @@ void arm_fscale(x86emu_t* emu)
void arm_fsin(x86emu_t* emu)
{
ST0.d = sin(ST0.d);
emu->sw.f.F87_C2 = 0;
}
void arm_fcos(x86emu_t* emu)
{
ST0.d = cos(ST0.d);
emu->sw.f.F87_C2 = 0;
}
void arm_fbld(x86emu_t* emu, uint8_t* ed)

View File

@ -153,6 +153,7 @@
case 0xFB: /* FSINCOS */
fpu_do_push(emu);
sincos(ST1.d, &ST1.d, &ST0.d);
emu->sw.f.F87_C2 = 0;
break;
case 0xFC: /* FRNDINT */
ST0.d = fpu_round(emu, ST0.d);
@ -164,9 +165,11 @@
break;
case 0xFE: /* FSIN */
ST0.d = sin(ST0.d);
emu->sw.f.F87_C2 = 0;
break;
case 0xFF: /* FCOS */
ST0.d = cos(ST0.d);
emu->sw.f.F87_C2 = 0;
break;