Optimize ADDI in RSP Recompiler

No need to add 0 to a variable. I've seen
ADDI V0, V0, 0x0000 in Super Smash Bros audio microcode.
This commit is contained in:
LegendOfDragoon 2015-09-07 11:49:37 -07:00
parent 720d8c8dd7
commit 2ff2165bd9
1 changed files with 3 additions and 1 deletions

View File

@ -444,7 +444,9 @@ void Compile_ADDI ( void ) {
if (RSPOpC.rt == 0) return; if (RSPOpC.rt == 0) return;
if (RSPOpC.rt == RSPOpC.rs) { if (RSPOpC.rt == RSPOpC.rs) {
AddConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); if(Immediate != 0) {
AddConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
} else if (RSPOpC.rs == 0) { } else if (RSPOpC.rs == 0) {
MoveConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); MoveConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
} else if ((IsRegConst(RSPOpC.rs) & 1) != 0) { } else if ((IsRegConst(RSPOpC.rs) & 1) != 0) {