[DYNAREC] More handling of low precision x87 flag change (#2556)

This commit is contained in:
Yang Liu 2025-04-21 20:09:26 +08:00 committed by GitHub
parent eee547d50a
commit 20ea2987a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 2 deletions

View File

@ -557,6 +557,7 @@ uintptr_t dynarec64_D9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
}
MOV32w(x2, 0);
CALL(fpu_loadenv, -1);
NATIVE_RESTORE_X87PC();
break;
case 5:
INST_NAME("FLDCW Ew");

View File

@ -92,7 +92,6 @@ uintptr_t dynarec64_D9(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
FNEGS(v1, v1);
} else {
FNEGD(v1, v1);
X87_CHECK_PRECISION(v1);
}
break;
case 0xE1:
@ -102,7 +101,6 @@ uintptr_t dynarec64_D9(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
FABSS(v1, v1);
} else {
FABSD(v1, v1);
X87_CHECK_PRECISION(v1);
}
break;
@ -485,11 +483,16 @@ uintptr_t dynarec64_D9(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
addr = geted(dyn, addr, ninst, nextop, &ed, x1, x2, &fixedaddress, rex, NULL, 0, 0);
MOV32w(x2, 0);
CALL(fpu_loadenv, -1, ed, x2);
NATIVE_RESTORE_X87PC();
break;
case 5:
INST_NAME("FLDCW Ew");
GETEW(x1, 0);
SH(x1, xEmu, offsetof(x64emu_t, cw)); // hopefully cw is not too far for an imm8
if (dyn->need_x87check) {
SRLI(x87pc, x1, 8);
ANDI(x87pc, x87pc, 0b11);
}
break;
case 6:
INST_NAME("FNSTENV Ed");

View File

@ -112,6 +112,7 @@ uintptr_t dynarec64_DB(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
MESSAGE(LOG_DUMP, "Need Optimization\n");
x87_purgecache(dyn, ninst, 0, x1, x2, x3);
CALL(reset_fpu, -1, 0, 0);
NATIVE_RESTORE_X87PC();
break;
case 0xE8 ... 0xEF:
INST_NAME("FUCOMI ST0, STx");

View File

@ -162,6 +162,7 @@ uintptr_t dynarec64_DD(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
addr = geted(dyn, addr, ninst, nextop, &ed, x4, x6, &fixedaddress, rex, NULL, 0, 0);
CALL(native_fsave, -1, ed, 0);
CALL(reset_fpu, -1, 0, 0);
NATIVE_RESTORE_X87PC();
break;
case 7:
INST_NAME("FNSTSW m2byte");