From 025e7c835ab310119ee1a4e7c5505459efe29258 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 23 Aug 2015 11:22:46 +0200 Subject: [PATCH] JitArm64: Implement subfcx --- Source/Core/Core/PowerPC/JitArm64/Jit.h | 1 + .../PowerPC/JitArm64/JitArm64_Integer.cpp | 32 +++++++++++++++++++ .../Core/PowerPC/JitArm64/JitArm64_Tables.cpp | 4 +-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.h b/Source/Core/Core/PowerPC/JitArm64/Jit.h index 9d44f967ef..6022e9eb64 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.h @@ -100,6 +100,7 @@ public: void slwx(UGeckoInstruction inst); void rlwimix(UGeckoInstruction inst); void subfex(UGeckoInstruction inst); + void subfcx(UGeckoInstruction inst); // System Registers void mtmsr(UGeckoInstruction inst); diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index 937bd07f3d..8c27c56ad8 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -784,6 +784,38 @@ void JitArm64::subfex(UGeckoInstruction inst) ComputeRC(gpr.R(d), 0); } +void JitArm64::subfcx(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(bJITIntegerOff); + FALLBACK_IF(inst.OE); + + int a = inst.RA, b = inst.RB, d = inst.RD; + + if (gpr.IsImm(a) && gpr.IsImm(b)) + { + u32 a_imm = gpr.GetImm(a), b_imm = gpr.GetImm(b); + + gpr.SetImmediate(d, b_imm - a_imm); + ComputeCarry(a_imm == 0 || Interpreter::Helper_Carry(b_imm, 0u - a_imm)); + + if (inst.Rc) + ComputeRC(gpr.GetImm(d), 0); + } + else + { + gpr.BindToRegister(d, d == a || d == b); + + // d = b - a + SUBS(gpr.R(d), gpr.R(b), gpr.R(a)); + + ComputeCarry(); + + if (inst.Rc) + ComputeRC(gpr.R(d), 0); + } +} + void JitArm64::addcx(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 7b3327706e..6111e33e5a 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp @@ -192,8 +192,8 @@ static GekkoOPTemplate table31[] = {616, &JitArm64::negx}, // negox {40, &JitArm64::subfx}, // subfx {552, &JitArm64::subfx}, // subfox - {8, &JitArm64::FallBackToInterpreter}, // subfcx - {520, &JitArm64::FallBackToInterpreter}, // subfcox + {8, &JitArm64::subfcx}, // subfcx + {520, &JitArm64::subfcx}, // subfcox {136, &JitArm64::subfex}, // subfex {648, &JitArm64::subfex}, // subfeox {232, &JitArm64::FallBackToInterpreter}, // subfmex