From 007f9e5309ba0666ef057f285632ffdc351732c8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 22 Mar 2018 15:34:47 -0400 Subject: [PATCH] Jit_Integer: Handle NOP case for oris as well Like ori, this can also be used as a NOP under the same conditions. --- Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 15 +++++++++------ .../Core/PowerPC/JitArm64/JitArm64_Integer.cpp | 10 ++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index 333956b202..cf7df035fa 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -304,18 +304,21 @@ void Jit64::reg_imm(UGeckoInstruction inst) case 15: // addis regimmop(d, a, false, (u32)inst.SIMM_16 << 16, Add, &XEmitter::ADD); break; - case 24: // ori - if (a == s && inst.UIMM == 0) // check for nop + case 24: // ori + case 25: // oris + { + // check for nop + if (a == s && inst.UIMM == 0) { // Make the nop visible in the generated code. not much use but interesting if we see one. NOP(); return; } - regimmop(a, s, true, inst.UIMM, Or, &XEmitter::OR); - break; - case 25: // oris - regimmop(a, s, true, inst.UIMM << 16, Or, &XEmitter::OR, false); + + const u32 immediate = inst.OPCD == 24 ? inst.UIMM : inst.UIMM << 16; + regimmop(a, s, true, immediate, Or, &XEmitter::OR); break; + } case 28: // andi regimmop(a, s, true, inst.UIMM, And, &XEmitter::AND, true); break; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index e78c9e984c..487f976a3d 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -122,17 +122,19 @@ void JitArm64::arith_imm(UGeckoInstruction inst) switch (inst.OPCD) { case 24: // ori + case 25: // oris + { // check for nop if (a == s && inst.UIMM == 0) { // NOP return; } - reg_imm(a, s, inst.UIMM, BitOR, &ARM64XEmitter::ORRI2R); - break; - case 25: // oris - reg_imm(a, s, inst.UIMM << 16, BitOR, &ARM64XEmitter::ORRI2R); + + const u32 immediate = inst.OPCD == 24 ? inst.UIMM : inst.UIMM << 16; + reg_imm(a, s, immediate, BitOR, &ARM64XEmitter::ORRI2R); break; + } case 28: // andi reg_imm(a, s, inst.UIMM, BitAND, &ARM64XEmitter::ANDI2R, true); break;