diff --git a/core/hw/sh4/dyna/ssa.h b/core/hw/sh4/dyna/ssa.h index 0252c956a..523230b8d 100644 --- a/core/hw/sh4/dyna/ssa.h +++ b/core/hw/sh4/dyna/ssa.h @@ -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()) { diff --git a/core/nullDC.cpp b/core/nullDC.cpp index 7dceaf2b1..7218173b4 100755 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -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; diff --git a/core/rec-x64/rec_x64.cpp b/core/rec-x64/rec_x64.cpp index 59349d5f2..b315d18ff 100644 --- a/core/rec-x64/rec_x64.cpp +++ b/core/rec-x64/rec_x64.cpp @@ -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); }