ssa: don't propagate const over interpreter fallback, sync_sr and sync_fpscr

rec-x64: support immediate args for xtract
Set write rtt to vram for Super Speed Racing (a.k.a Flag to Flag)
This commit is contained in:
Flyinghead 2019-06-24 18:56:09 +02:00
parent f862903a74
commit c27975fb37
3 changed files with 51 additions and 12 deletions

View File

@ -37,12 +37,14 @@ public:
{
AddVersionPass();
#if DEBUG
printf("BEFORE\n");
PrintBlock();
printf("BEFORE\n");
PrintBlock();
#endif
ConstPropPass();
WriteAfterWritePass();
// This should only be done for ram/vram/aram access
// Disabled for now and probably not worth the trouble
//WriteAfterWritePass();
DeadCodeRemovalPass();
SimplifyExpressionPass();
CombineShiftsPass();
@ -170,7 +172,34 @@ private:
if (op.op != shop_fmac && op.op != shop_adc)
ConstPropOperand(op.rs3);
if (op.op == shop_readm || op.op == shop_writem)
if (op.op == shop_ifb)
{
constprop_values.clear();
}
else if (op.op == shop_sync_sr)
{
for (auto it = constprop_values.begin(); it != constprop_values.end(); )
{
Sh4RegType reg = it->first.get_reg();
if (reg == reg_sr_status || reg == reg_old_sr_status || (reg >= reg_r0 && reg <= reg_r7)
|| (reg >= reg_r0_Bank && reg <= reg_r7_Bank))
it = constprop_values.erase(it);
else
it++;
}
}
else if (op.op == shop_sync_fpscr)
{
for (auto it = constprop_values.begin(); it != constprop_values.end(); )
{
Sh4RegType reg = it->first.get_reg();
if (reg == reg_fpscr || reg == reg_old_fpscr || (reg >= reg_fr_0 && reg <= reg_xf_15))
it = constprop_values.erase(it);
else
it++;
}
}
else if (op.op == shop_readm || op.op == shop_writem)
{
if (op.rs1.is_imm())
{

View File

@ -158,8 +158,10 @@ void LoadSpecialSettings()
|| !strncmp("T40204D", reios_product_number, 7)
// Skies of Arcadia
|| !strncmp("MK-51052", reios_product_number, 8)
// Flag to Flag
|| !strncmp("MK-51007", reios_product_number, 8))
// Flag to Flag (US)
|| !strncmp("MK-51007", reios_product_number, 8)
// Super Speed Racing (JP)
|| !strncmp("HDR-0013", reios_product_number, 8))
{
settings.rend.RenderToTextureBuffer = 1;
rtt_to_buffer_game = true;

View File

@ -948,9 +948,17 @@ public:
case shop_xtrct:
{
Xbyak::Reg32 rd = regalloc.MapRegister(op.rd);
Xbyak::Reg32 rs1 = regalloc.MapRegister(op.rs1);
Xbyak::Reg32 rs2 = regalloc.MapRegister(op.rs2);
if (regalloc.mapg(op.rd) == regalloc.mapg(op.rs2))
Xbyak::Reg32 rs1 = ecx;
if (op.rs1.is_reg())
rs1 = regalloc.MapRegister(op.rs1);
else
mov(rs1, op.rs1.imm_value());
Xbyak::Reg32 rs2 = eax;
if (op.rs2.is_reg())
rs2 = regalloc.MapRegister(op.rs2);
else
mov(rs2, op.rs2.imm_value());
if (rd == rs2)
{
shl(rd, 16);
mov(eax, rs1);
@ -958,7 +966,7 @@ public:
or_(rd, eax);
break;
}
else if (regalloc.mapg(op.rd) != regalloc.mapg(op.rs1))
else if (rd != rs1)
{
mov(rd, rs1);
}
@ -1693,7 +1701,7 @@ private:
mov(dword[rax], op.rs2._imm);
else
{
mov(rcx, (uintptr_t)op.rd.reg_ptr());
mov(rcx, (uintptr_t)op.rs2.reg_ptr());
mov(ecx, dword[rcx]);
mov(dword[rax], ecx);
}
@ -1711,7 +1719,7 @@ private:
else
#endif
{
mov(rcx, (uintptr_t)op.rd.reg_ptr());
mov(rcx, (uintptr_t)op.rs2.reg_ptr());
mov(rcx, qword[rcx]);
mov(qword[rax], rcx);
}