Jit_SystemRegisters: mtspr

This commit is contained in:
MerryMage 2018-10-15 21:01:53 +01:00
parent d87436c57d
commit 2337e089bf

View File

@ -219,26 +219,32 @@ void Jit64::mtspr(UGeckoInstruction inst)
break; break;
case SPR_XER: case SPR_XER:
gpr.Lock(d); {
gpr.BindToRegister(d, true, false); RCX64Reg Rd = gpr.Bind(d, RCMode::Read);
MOV(32, R(RSCRATCH), gpr.R(d)); RegCache::Realize(Rd);
MOV(32, R(RSCRATCH), Rd);
AND(32, R(RSCRATCH), Imm32(0xff7f)); AND(32, R(RSCRATCH), Imm32(0xff7f));
MOV(16, PPCSTATE(xer_stringctrl), R(RSCRATCH)); MOV(16, PPCSTATE(xer_stringctrl), R(RSCRATCH));
MOV(32, R(RSCRATCH), gpr.R(d)); MOV(32, R(RSCRATCH), Rd);
SHR(32, R(RSCRATCH), Imm8(XER_CA_SHIFT)); SHR(32, R(RSCRATCH), Imm8(XER_CA_SHIFT));
AND(8, R(RSCRATCH), Imm8(1)); AND(8, R(RSCRATCH), Imm8(1));
MOV(8, PPCSTATE(xer_ca), R(RSCRATCH)); MOV(8, PPCSTATE(xer_ca), R(RSCRATCH));
MOV(32, R(RSCRATCH), gpr.R(d)); MOV(32, R(RSCRATCH), Rd);
SHR(32, R(RSCRATCH), Imm8(XER_OV_SHIFT)); SHR(32, R(RSCRATCH), Imm8(XER_OV_SHIFT));
MOV(8, PPCSTATE(xer_so_ov), R(RSCRATCH)); MOV(8, PPCSTATE(xer_so_ov), R(RSCRATCH));
gpr.UnlockAll();
return; return;
}
case SPR_HID0: case SPR_HID0:
{ {
MOV(32, R(RSCRATCH), gpr.R(d)); RCOpArg Rd = gpr.Use(d, RCMode::Read);
RegCache::Realize(Rd);
MOV(32, R(RSCRATCH), Rd);
BTR(32, R(RSCRATCH), Imm8(31 - 20)); // ICFI BTR(32, R(RSCRATCH), Imm8(31 - 20)); // ICFI
MOV(32, PPCSTATE(spr[iIndex]), R(RSCRATCH)); MOV(32, PPCSTATE(spr[iIndex]), R(RSCRATCH));
FixupBranch dont_reset_icache = J_CC(CC_NC); FixupBranch dont_reset_icache = J_CC(CC_NC);
@ -255,13 +261,9 @@ void Jit64::mtspr(UGeckoInstruction inst)
} }
// OK, this is easy. // OK, this is easy.
if (!gpr.R(d).IsImm()) RCOpArg Rd = gpr.BindOrImm(d, RCMode::Read);
{ RegCache::Realize(Rd);
gpr.Lock(d); MOV(32, PPCSTATE(spr[iIndex]), Rd);
gpr.BindToRegister(d, true, false);
}
MOV(32, PPCSTATE(spr[iIndex]), gpr.R(d));
gpr.UnlockAll();
} }
void Jit64::mfspr(UGeckoInstruction inst) void Jit64::mfspr(UGeckoInstruction inst)