Skip to content

Commit

Permalink
Jit_Integer: Handle NOP case for xori and xoris
Browse files Browse the repository at this point in the history
Like ori and oris, xori and xoris can also be used to introduce a NOP.
In that case, just don't do anything.
  • Loading branch information
lioncash committed Mar 23, 2018
1 parent 007f9e5 commit fc16a78
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
14 changes: 11 additions & 3 deletions Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
Expand Up @@ -326,11 +326,19 @@ void Jit64::reg_imm(UGeckoInstruction inst)
regimmop(a, s, true, inst.UIMM << 16, And, &XEmitter::AND, true);
break;
case 26: // xori
regimmop(a, s, true, inst.UIMM, Xor, &XEmitter::XOR, false);
break;
case 27: // xoris
regimmop(a, s, true, inst.UIMM << 16, Xor, &XEmitter::XOR, false);
{
if (s == a && inst.UIMM == 0)
{
// Make the nop visible in the generated code.
NOP();
return;
}

const u32 immediate = inst.OPCD == 26 ? inst.UIMM : inst.UIMM << 16;
regimmop(a, s, true, immediate, Xor, &XEmitter::XOR, false);
break;
}
case 12: // addic
regimmop(d, a, false, (u32)(s32)inst.SIMM_16, Add, &XEmitter::ADD, false, true);
break;
Expand Down
13 changes: 10 additions & 3 deletions Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp
Expand Up @@ -142,12 +142,19 @@ void JitArm64::arith_imm(UGeckoInstruction inst)
reg_imm(a, s, inst.UIMM << 16, BitAND, &ARM64XEmitter::ANDI2R, true);
break;
case 26: // xori
reg_imm(a, s, inst.UIMM, BitXOR, &ARM64XEmitter::EORI2R);
break;
case 27: // xoris
reg_imm(a, s, inst.UIMM << 16, BitXOR, &ARM64XEmitter::EORI2R);
{
if (a == s && inst.UIMM == 0)
{
// NOP
return;
}

const u32 immediate = inst.OPCD == 26 ? inst.UIMM : inst.UIMM << 16;
reg_imm(a, s, immediate, BitXOR, &ARM64XEmitter::EORI2R);
break;
}
}
}

void JitArm64::addix(UGeckoInstruction inst)
Expand Down

0 comments on commit fc16a78

Please sign in to comment.