mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-21 02:09:05 +02:00
Combine move-from-gpr and float cast.
This commit is contained in:
1 parent
0abcd00372
commit
c9ca3904d3
4 files changed
+17
-3
No files matched your search
@@ -121,6 +121,7 @@ static const IRMeta irMeta[] = {
|
||||
{ IROp::FMovFromGPR, "FMovFromGPR", "FG" },
|
||||
{ IROp::FMovToGPR, "FMovToGPR", "GF" },
|
||||
{ IROp::OptFMovToGPRShr8, "OptFMovToGPRShr8", "GF" },
|
||||
{ IROp::OptFCvtSWFromGPR, "OptFCvtSWFromGPR", "FG" },
|
||||
{ IROp::FpCondFromReg, "FpCondFromReg", "_G" },
|
||||
{ IROp::FpCondToReg, "FpCondToReg", "G" },
|
||||
{ IROp::FpCtrlFromReg, "FpCtrlFromReg", "_G" },
|
||||
|
||||
@@ -138,6 +138,7 @@ enum class IROp : uint8_t {
|
||||
FCvtScaledSW,
|
||||
|
||||
FMovFromGPR,
|
||||
OptFCvtSWFromGPR,
|
||||
FMovToGPR,
|
||||
OptFMovToGPRShr8,
|
||||
|
||||
|
||||
@@ -997,6 +997,9 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst) {
|
||||
case IROp::FMovFromGPR:
|
||||
memcpy(&mips->f[inst->dest], &mips->r[inst->src1], 4);
|
||||
break;
|
||||
case IROp::OptFCvtSWFromGPR:
|
||||
mips->f[inst->dest] = (float)(int)mips->r[inst->src1];
|
||||
break;
|
||||
case IROp::FMovToGPR:
|
||||
memcpy(&mips->r[inst->dest], &mips->f[inst->src1], 4);
|
||||
break;
|
||||
@@ -1007,6 +1010,7 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst) {
|
||||
mips->r[inst->dest] = temp >> 8;
|
||||
break;
|
||||
}
|
||||
|
||||
case IROp::ExitToConst:
|
||||
return inst->constant;
|
||||
|
||||
|
||||
@@ -2269,10 +2269,18 @@ bool OptimizeForInterpreter(const IRWriter &in, IRWriter &out, const IROptions &
|
||||
inst.op = IROp::OptFMovToGPRShr8;
|
||||
i++; // Skip the next instruction.
|
||||
}
|
||||
out.Write(inst);
|
||||
} else {
|
||||
out.Write(inst);
|
||||
}
|
||||
out.Write(inst);
|
||||
break;
|
||||
case IROp::FMovFromGPR:
|
||||
if (!last) {
|
||||
IRInst next = in.GetInstructions()[i + 1];
|
||||
if (next.op == IROp::FCvtSW && next.src1 == inst.dest && next.dest == inst.dest) {
|
||||
inst.op = IROp::OptFCvtSWFromGPR;
|
||||
i++; // Skip the next
|
||||
}
|
||||
}
|
||||
out.Write(inst);
|
||||
break;
|
||||
default:
|
||||
out.Write(inst);
|
||||
|
||||
Reference in new issue
Block a user