mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
irjit: Correct another PurgeTemps case.
In this case: Mov A, B AndConst A, A, 1 Load32 C, A, 0 Was still swapping the Load32 to B, not just the AndConst. Fixes #15735.
This commit is contained in:
parent
5abf1362a2
commit
7b081a61c8
@ -857,6 +857,15 @@ bool PurgeTemps(const IRWriter &in, IRWriter &out, const IROptions &opts) {
|
||||
// We're changing "Mov A, B; Add C, C, A" to "Mov A, B; Add C, C, B" here.
|
||||
// srcReg should only be set when it was a Mov.
|
||||
inst = IRReplaceSrcGPR(inst, check.reg, check.srcReg);
|
||||
|
||||
// If the Mov modified the same reg as this instruction, we can't optimize from it anymore.
|
||||
if (inst.dest == check.reg) {
|
||||
check.reg = 0;
|
||||
// We can also optimize it out since we've essentially moved now.
|
||||
insts[check.index].op = IROp::Mov;
|
||||
insts[check.index].dest = 0;
|
||||
insts[check.index].src1 = 0;
|
||||
}
|
||||
} else if (!IRMutatesDestGPR(insts[check.index], check.reg) && inst.op == IROp::Mov && i == check.index + 1) {
|
||||
// As long as the previous inst wasn't modifying its dest reg, and this is a Mov, we can swap.
|
||||
// We're changing "Add A, B, C; Mov B, A" to "Add B, B, C; Mov A, B" here.
|
||||
|
@ -92,6 +92,19 @@ static const IRVerification tests[] = {
|
||||
},
|
||||
{ &PurgeTemps },
|
||||
},
|
||||
{
|
||||
"Load32LeftPurgeTemps",
|
||||
{
|
||||
{ IROp::Mov, { IRTEMP_LR_ADDR }, MIPS_REG_A0 },
|
||||
{ IROp::AndConst, { IRTEMP_LR_ADDR }, IRTEMP_LR_ADDR, 0, 0xFFFFFFFC },
|
||||
{ IROp::Load32, { MIPS_REG_V0 }, IRTEMP_LR_ADDR, 0, 0 },
|
||||
},
|
||||
{
|
||||
{ IROp::AndConst, { IRTEMP_LR_ADDR }, MIPS_REG_A0, 0, 0xFFFFFFFC },
|
||||
{ IROp::Load32, { MIPS_REG_V0 }, IRTEMP_LR_ADDR, 0, 0 },
|
||||
},
|
||||
{ &PurgeTemps },
|
||||
},
|
||||
{
|
||||
"SwapClobberTemp",
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user