mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
Guess what? More RIP elimination (but keep the fast path too)
This commit is contained in:
parent
7c3b37c561
commit
0743334946
@ -2248,12 +2248,22 @@ void Jit::Comp_VV2Op(MIPSOpcode op) {
|
||||
case 1: // d[i] = fabsf(s[i]); break; //vabs
|
||||
if (!fpr.V(sregs[i]).IsSimpleReg(tempxregs[i]))
|
||||
MOVSS(tempxregs[i], fpr.V(sregs[i]));
|
||||
ANDPS(tempxregs[i], M(&noSignMask));
|
||||
if (RipAccessible(&noSignMask)) {
|
||||
ANDPS(tempxregs[i], M(&noSignMask));
|
||||
} else {
|
||||
MOV(PTRBITS, R(TEMPREG), ImmPtr(&noSignMask));
|
||||
ANDPS(tempxregs[i], MatR(TEMPREG));
|
||||
}
|
||||
break;
|
||||
case 2: // d[i] = -s[i]; break; //vneg
|
||||
if (!fpr.V(sregs[i]).IsSimpleReg(tempxregs[i]))
|
||||
MOVSS(tempxregs[i], fpr.V(sregs[i]));
|
||||
XORPS(tempxregs[i], M(&signBitLower));
|
||||
if (RipAccessible(&signBitLower)) {
|
||||
XORPS(tempxregs[i], M(&signBitLower));
|
||||
} else {
|
||||
MOV(PTRBITS, R(TEMPREG), ImmPtr(&signBitLower));
|
||||
XORPS(tempxregs[i], MatR(TEMPREG));
|
||||
}
|
||||
break;
|
||||
case 4: // if (s[i] < 0) d[i] = 0; else {if(s[i] > 1.0f) d[i] = 1.0f; else d[i] = s[i];} break; // vsat0
|
||||
if (!fpr.V(sregs[i]).IsSimpleReg(tempxregs[i]))
|
||||
@ -2266,7 +2276,8 @@ void Jit::Comp_VV2Op(MIPSOpcode op) {
|
||||
ANDNPS(XMM0, R(tempxregs[i]));
|
||||
|
||||
// Retain a NAN in XMM0 (must be second operand.)
|
||||
MOVSS(tempxregs[i], M(&one));
|
||||
MOV(PTRBITS, R(TEMPREG), ImmPtr(&one));
|
||||
MOVSS(tempxregs[i], MatR(TEMPREG));
|
||||
MINSS(tempxregs[i], R(XMM0));
|
||||
break;
|
||||
case 5: // if (s[i] < -1.0f) d[i] = -1.0f; else {if(s[i] > 1.0f) d[i] = 1.0f; else d[i] = s[i];} break; // vsat1
|
||||
@ -2284,7 +2295,8 @@ void Jit::Comp_VV2Op(MIPSOpcode op) {
|
||||
ORPS(XMM0, R(XMM1));
|
||||
|
||||
// Retain a NAN in XMM0 (must be second operand.)
|
||||
MOVSS(tempxregs[i], M(&one));
|
||||
MOV(PTRBITS, R(TEMPREG), ImmPtr(&one));
|
||||
MOVSS(tempxregs[i], MatR(TEMPREG));
|
||||
MINSS(tempxregs[i], R(XMM0));
|
||||
break;
|
||||
case 16: // d[i] = 1.0f / s[i]; break; //vrcp
|
||||
@ -2323,7 +2335,8 @@ void Jit::Comp_VV2Op(MIPSOpcode op) {
|
||||
break;
|
||||
case 22: // d[i] = sqrtf(s[i]); break; //vsqrt
|
||||
SQRTSS(tempxregs[i], fpr.V(sregs[i]));
|
||||
ANDPS(tempxregs[i], M(&noSignMask));
|
||||
MOV(PTRBITS, R(TEMPREG), ImmPtr(&noSignMask));
|
||||
ANDPS(tempxregs[i], MatR(TEMPREG));
|
||||
break;
|
||||
case 23: // d[i] = asinf(s[i]) / M_PI_2; break; //vasin
|
||||
trigCallHelper(&ASinScaled, sregs[i]);
|
||||
|
@ -667,7 +667,12 @@ void Jit::WriteExit(u32 destination, int exit_num) {
|
||||
// If we need to verify coreState and rewind, we may not jump yet.
|
||||
if (js.afterOp & (JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE)) {
|
||||
// CORE_RUNNING is <= CORE_NEXTFRAME.
|
||||
CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
if (RipAccessible((const void *)coreState)) {
|
||||
CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
} else {
|
||||
MOV(PTRBITS, R(RAX), ImmPtr((const void *)&coreState));
|
||||
CMP(32, MatR(RAX), Imm32(CORE_NEXTFRAME));
|
||||
}
|
||||
FixupBranch skipCheck = J_CC(CC_LE);
|
||||
MOV(32, MIPSSTATE_VAR(pc), Imm32(GetCompilerPC()));
|
||||
WriteSyscallExit();
|
||||
@ -706,7 +711,12 @@ void Jit::WriteExitDestInReg(X64Reg reg) {
|
||||
// If we need to verify coreState and rewind, we may not jump yet.
|
||||
if (js.afterOp & (JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE)) {
|
||||
// CORE_RUNNING is <= CORE_NEXTFRAME.
|
||||
CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
if (RipAccessible((const void *)coreState)) {
|
||||
CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
} else {
|
||||
MOV(PTRBITS, R(RAX), ImmPtr((const void *)&coreState));
|
||||
CMP(32, MatR(RAX), Imm32(CORE_NEXTFRAME));
|
||||
}
|
||||
FixupBranch skipCheck = J_CC(CC_LE);
|
||||
MOV(32, MIPSSTATE_VAR(pc), Imm32(GetCompilerPC()));
|
||||
WriteSyscallExit();
|
||||
|
@ -368,7 +368,12 @@ void JitSafeMem::MemCheckImm(MemoryOpType type)
|
||||
jit_->CallProtectedFunction(&JitMemCheck, iaddr_, size_, type == MEM_WRITE ? 1 : 0);
|
||||
|
||||
// CORE_RUNNING is <= CORE_NEXTFRAME.
|
||||
jit_->CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
if (jit_->RipAccessible((const void *)coreState)) {
|
||||
jit_->CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
} else {
|
||||
jit_->MOV(PTRBITS, R(RAX), ImmPtr((const void *)&coreState));
|
||||
jit_->CMP(32, MatR(RAX), Imm32(CORE_NEXTFRAME));
|
||||
}
|
||||
skipChecks_.push_back(jit_->J_CC(CC_G, true));
|
||||
jit_->js.afterOp |= JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE | JitState::AFTER_MEMCHECK_CLEANUP;
|
||||
}
|
||||
@ -418,7 +423,12 @@ void JitSafeMem::MemCheckAsm(MemoryOpType type)
|
||||
if (possible)
|
||||
{
|
||||
// CORE_RUNNING is <= CORE_NEXTFRAME.
|
||||
jit_->CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
if (jit_->RipAccessible((const void *)coreState)) {
|
||||
jit_->CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME));
|
||||
} else {
|
||||
jit_->MOV(PTRBITS, R(RAX), ImmPtr((const void *)&coreState));
|
||||
jit_->CMP(32, MatR(RAX), Imm32(CORE_NEXTFRAME));
|
||||
}
|
||||
skipChecks_.push_back(jit_->J_CC(CC_G, true));
|
||||
jit_->js.afterOp |= JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE | JitState::AFTER_MEMCHECK_CLEANUP;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user