Remove the ability to disable rounding mode support. It's time.

This commit is contained in:
Henrik Rydgard 2015-10-08 10:32:39 +02:00
parent 6dd86cd843
commit bfed830f91
7 changed files with 47 additions and 58 deletions

View File

@ -334,7 +334,6 @@ static ConfigSetting cpuSettings[] = {
ConfigSetting("FastMemoryAccess", &g_Config.bFastMemory, true, true, true),
ReportedConfigSetting("FuncReplacements", &g_Config.bFuncReplacements, true, true, true),
ReportedConfigSetting("CPUSpeed", &g_Config.iLockedCPUSpeed, 0, true, true),
ReportedConfigSetting("SetRoundingMode", &g_Config.bSetRoundingMode, true, true, true),
ConfigSetting(false),
};

View File

@ -116,7 +116,6 @@ public:
bool bCheckForNewVersion;
bool bForceLagSync;
bool bFuncReplacements;
bool bSetRoundingMode;
// Definitely cannot be changed while game is running.
bool bSeparateCPUThread;

View File

@ -587,7 +587,7 @@ void ArmJit::WriteDownCountR(ARMReg reg) {
void ArmJit::RestoreRoundingMode(bool force) {
// If the game has never set an interesting rounding mode, we can safely skip this.
if (g_Config.bSetRoundingMode && (force || js.hasSetRounding)) {
if (force || js.hasSetRounding) {
VMRS(SCRATCHREG2);
// Assume we're always in round-to-nearest mode beforehand. Flush-to-zero is off.
BIC(SCRATCHREG2, SCRATCHREG2, AssumeMakeOperand2((3 | 4) << 22));
@ -598,7 +598,7 @@ void ArmJit::RestoreRoundingMode(bool force) {
void ArmJit::ApplyRoundingMode(bool force) {
// NOTE: Must not destroy R0.
// If the game has never set an interesting rounding mode, we can safely skip this.
if (g_Config.bSetRoundingMode && (force || js.hasSetRounding)) {
if (force || js.hasSetRounding) {
LDR(SCRATCHREG2, CTXREG, offsetof(MIPSState, fcr31));
TST(SCRATCHREG2, AssumeMakeOperand2(1 << 24));
@ -639,25 +639,23 @@ void ArmJit::ApplyRoundingMode(bool force) {
void ArmJit::UpdateRoundingMode() {
// NOTE: Must not destroy R0.
if (g_Config.bSetRoundingMode) {
LDR(SCRATCHREG2, CTXREG, offsetof(MIPSState, fcr31));
LDR(SCRATCHREG2, CTXREG, offsetof(MIPSState, fcr31));
TST(SCRATCHREG2, AssumeMakeOperand2(1 << 24));
AND(SCRATCHREG2, SCRATCHREG2, Operand2(3));
SetCC(CC_NEQ);
ADD(SCRATCHREG2, SCRATCHREG2, Operand2(4));
SetCC(CC_AL);
// We can only skip if the rounding mode is zero and flush is not set.
CMP(SCRATCHREG2, Operand2(3));
TST(SCRATCHREG2, AssumeMakeOperand2(1 << 24));
AND(SCRATCHREG2, SCRATCHREG2, Operand2(3));
SetCC(CC_NEQ);
ADD(SCRATCHREG2, SCRATCHREG2, Operand2(4));
SetCC(CC_AL);
// We can only skip if the rounding mode is zero and flush is not set.
CMP(SCRATCHREG2, Operand2(3));
FixupBranch skip = B_CC(CC_EQ);
PUSH(1, SCRATCHREG1);
MOVI2R(SCRATCHREG2, 1);
MOVP2R(SCRATCHREG1, &js.hasSetRounding);
STRB(SCRATCHREG2, SCRATCHREG1, 0);
POP(1, SCRATCHREG1);
SetJumpTarget(skip);
}
FixupBranch skip = B_CC(CC_EQ);
PUSH(1, SCRATCHREG1);
MOVI2R(SCRATCHREG2, 1);
MOVP2R(SCRATCHREG1, &js.hasSetRounding);
STRB(SCRATCHREG2, SCRATCHREG1, 0);
POP(1, SCRATCHREG1);
SetJumpTarget(skip);
}
// IDEA - could have a WriteDualExit that takes two destinations and two condition flags,

View File

@ -526,7 +526,7 @@ void Arm64Jit::WriteDownCountR(ARM64Reg reg, bool updateFlags) {
void Arm64Jit::RestoreRoundingMode(bool force) {
// If the game has never set an interesting rounding mode, we can safely skip this.
if (g_Config.bSetRoundingMode && (force || js.hasSetRounding)) {
if (force || js.hasSetRounding) {
MRS(SCRATCH2_64, FIELD_FPCR);
// We are not in flush-to-zero mode outside the JIT, so let's turn it off.
uint32_t mask = ~(4 << 22);
@ -540,7 +540,7 @@ void Arm64Jit::RestoreRoundingMode(bool force) {
void Arm64Jit::ApplyRoundingMode(bool force) {
// NOTE: Must not destroy SCRATCH1.
// If the game has never set an interesting rounding mode, we can safely skip this.
if (g_Config.bSetRoundingMode && (force || js.hasSetRounding)) {
if (force || js.hasSetRounding) {
LDR(INDEX_UNSIGNED, SCRATCH2, CTXREG, offsetof(MIPSState, fcr31));
TSTI2R(SCRATCH2, 1 << 24);
ANDI2R(SCRATCH2, SCRATCH2, 3);
@ -591,26 +591,24 @@ void Arm64Jit::ApplyRoundingMode(bool force) {
void Arm64Jit::UpdateRoundingMode() {
// NOTE: Must not destroy SCRATCH1.
if (g_Config.bSetRoundingMode) {
LDR(INDEX_UNSIGNED, SCRATCH2, CTXREG, offsetof(MIPSState, fcr31));
LDR(INDEX_UNSIGNED, SCRATCH2, CTXREG, offsetof(MIPSState, fcr31));
TSTI2R(SCRATCH2, 1 << 24);
ANDI2R(SCRATCH2, SCRATCH2, 3);
FixupBranch skip = B(CC_EQ);
ADDI2R(SCRATCH2, SCRATCH2, 4);
SetJumpTarget(skip);
TSTI2R(SCRATCH2, 1 << 24);
ANDI2R(SCRATCH2, SCRATCH2, 3);
FixupBranch skip = B(CC_EQ);
ADDI2R(SCRATCH2, SCRATCH2, 4);
SetJumpTarget(skip);
// We can only skip if the rounding mode is zero and flush is not set.
CMPI2R(SCRATCH2, 3);
// We can only skip if the rounding mode is zero and flush is not set.
CMPI2R(SCRATCH2, 3);
FixupBranch skip2 = B(CC_EQ);
PUSH(SCRATCH1_64);
MOVI2R(SCRATCH2, 1);
MOVP2R(SCRATCH1_64, &js.hasSetRounding);
STRB(INDEX_UNSIGNED, SCRATCH2, SCRATCH1_64, 0);
POP(SCRATCH1_64);
SetJumpTarget(skip2);
}
FixupBranch skip2 = B(CC_EQ);
PUSH(SCRATCH1_64);
MOVI2R(SCRATCH2, 1);
MOVP2R(SCRATCH1_64, &js.hasSetRounding);
STRB(INDEX_UNSIGNED, SCRATCH2, SCRATCH1_64, 0);
POP(SCRATCH1_64);
SetJumpTarget(skip2);
}
// IDEA - could have a WriteDualExit that takes two destinations and two condition flags,

View File

@ -223,7 +223,7 @@ void Jit::WriteDowncount(int offset)
void Jit::RestoreRoundingMode(bool force, XEmitter *emitter)
{
// If the game has never set an interesting rounding mode, we can safely skip this.
if (g_Config.bSetRoundingMode && (force || js.hasSetRounding))
if (force || js.hasSetRounding)
{
if (emitter == NULL)
emitter = this;
@ -237,7 +237,7 @@ void Jit::RestoreRoundingMode(bool force, XEmitter *emitter)
void Jit::ApplyRoundingMode(bool force, XEmitter *emitter)
{
// If the game has never set an interesting rounding mode, we can safely skip this.
if (g_Config.bSetRoundingMode && (force || js.hasSetRounding))
if (force || js.hasSetRounding)
{
if (emitter == NULL)
emitter = this;
@ -273,24 +273,21 @@ void Jit::ApplyRoundingMode(bool force, XEmitter *emitter)
void Jit::UpdateRoundingMode(XEmitter *emitter)
{
if (g_Config.bSetRoundingMode)
{
if (emitter == NULL)
emitter = this;
if (emitter == NULL)
emitter = this;
// If it's only ever 0, we don't actually bother applying or restoring it.
// This is the most common situation.
emitter->TEST(32, M(&mips_->fcr31), Imm32(0x01000003));
FixupBranch skip = emitter->J_CC(CC_Z);
// If it's only ever 0, we don't actually bother applying or restoring it.
// This is the most common situation.
emitter->TEST(32, M(&mips_->fcr31), Imm32(0x01000003));
FixupBranch skip = emitter->J_CC(CC_Z);
#ifdef _M_X64
// TODO: Move the hasSetRounding flag somewhere we can reach it through the context pointer, or something.
emitter->MOV(64, R(RAX), Imm64((uintptr_t)&js.hasSetRounding));
emitter->MOV(8, MatR(RAX), Imm8(1));
// TODO: Move the hasSetRounding flag somewhere we can reach it through the context pointer, or something.
emitter->MOV(64, R(RAX), Imm64((uintptr_t)&js.hasSetRounding));
emitter->MOV(8, MatR(RAX), Imm8(1));
#else
emitter->MOV(8, M(&js.hasSetRounding), Imm8(1));
emitter->MOV(8, M(&js.hasSetRounding), Imm8(1));
#endif
emitter->SetJumpTarget(skip);
}
emitter->SetJumpTarget(skip);
}
void Jit::ClearCache()

View File

@ -509,7 +509,6 @@ void GameSettingsScreen::CreateViews() {
#ifndef MOBILE_DEVICE
systemSettings->Add(new PopupSliderChoice(&g_Config.iRewindFlipFrequency, 0, 1800, sy->T("Rewind Snapshot Frequency", "Rewind Snapshot Frequency (0 = off, mem hog)"), screenManager()));
#endif
systemSettings->Add(new CheckBox(&g_Config.bSetRoundingMode, sy->T("Respect FPU rounding (disable for old GEB saves)")))->OnClick.Handle(this, &GameSettingsScreen::OnJitAffectingSetting);
systemSettings->Add(new ItemHeader(sy->T("General")));

View File

@ -357,7 +357,6 @@ int main(int argc, const char* argv[])
g_Config.bSoftwareSkinning = true;
g_Config.bVertexDecoderJit = true;
g_Config.bBlockTransferGPU = true;
g_Config.bSetRoundingMode = true;
#ifdef _WIN32
InitSysDirectories();