diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.h b/Source/Core/Core/PowerPC/JitArm64/Jit.h index 244a58db05..a7c75b24e5 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.h @@ -101,6 +101,7 @@ public: void rlwimix(UGeckoInstruction inst); void subfex(UGeckoInstruction inst); void subfcx(UGeckoInstruction inst); + void subfic(UGeckoInstruction inst); void addex(UGeckoInstruction inst); // System Registers diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index 119cc099c3..fb3f1ec407 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -816,6 +816,41 @@ void JitArm64::subfcx(UGeckoInstruction inst) } } +void JitArm64::subfic(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(bJITIntegerOff); + + int a = inst.RA, d = inst.RD; + s32 imm = inst.SIMM_16; + + if (gpr.IsImm(a)) + { + u32 a_imm = gpr.GetImm(a); + + gpr.SetImmediate(d, imm - a_imm); + ComputeCarry(a_imm == 0 || Interpreter::Helper_Carry(imm, 0u - a_imm)); + + if (inst.Rc) + ComputeRC(gpr.GetImm(d), 0); + } + else + { + gpr.BindToRegister(d, d == a); + + // d = imm - a + ARM64Reg WA = gpr.GetReg(); + MOVI2R(WA, imm); + SUBS(gpr.R(d), WA, gpr.R(a)); + gpr.Unlock(WA); + + ComputeCarry(); + + if (inst.Rc) + ComputeRC(gpr.R(d), 0); + } +} + void JitArm64::addex(UGeckoInstruction inst) { INSTRUCTION_START diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp index 1cec717685..a33cb9909c 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp @@ -44,7 +44,7 @@ static GekkoOPTemplate primarytable[] = {17, &JitArm64::sc}, // sc {7, &JitArm64::mulli}, // mulli - {8, &JitArm64::FallBackToInterpreter}, // subfic + {8, &JitArm64::subfic}, // subfic {10, &JitArm64::cmpli}, // cmpli {11, &JitArm64::cmpi}, // cmpi {12, &JitArm64::addic}, // addic