From ef2ea31eacefcaa02aeda653f3ff3da4fa7e46e4 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 14 Sep 2013 04:12:57 +0000 Subject: [PATCH] [ARM] ps_madds0 and ps_madds1 implementations. --- Source/Core/Core/Src/PowerPC/JitArm32/Jit.h | 2 + .../Src/PowerPC/JitArm32/JitArm_Paired.cpp | 68 ++++++++++++++++++- .../Src/PowerPC/JitArm32/JitArm_Tables.cpp | 4 +- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h index 75136ec155..143f21b5ee 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h +++ b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h @@ -210,6 +210,8 @@ public: void ps_sum0(UGeckoInstruction _inst); void ps_sum1(UGeckoInstruction _inst); void ps_madd(UGeckoInstruction _inst); + void ps_madds0(UGeckoInstruction _inst); + void ps_madds1(UGeckoInstruction _inst); void ps_sub(UGeckoInstruction _inst); void ps_mul(UGeckoInstruction _inst); void ps_muls0(UGeckoInstruction _inst); diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Paired.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Paired.cpp index 019e0563e6..9f8c90b7df 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Paired.cpp @@ -47,7 +47,6 @@ void JitArm::ps_add(UGeckoInstruction inst) VADD(vD1, vA1, vB1); } -// Wrong, THP videos like SMS and Ikaruga show artifacts void JitArm::ps_madd(UGeckoInstruction inst) { INSTRUCTION_START @@ -83,6 +82,73 @@ void JitArm::ps_madd(UGeckoInstruction inst) fpr.Unlock(V1); } +void JitArm::ps_madds0(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(bJITPairedOff) + + u32 a = inst.FA, b = inst.FB, c = inst.FC, d = inst.FD; + + if (inst.Rc) { + Default(inst); return; + } + ARMReg vA0 = fpr.R0(a); + ARMReg vA1 = fpr.R1(a); + ARMReg vB0 = fpr.R0(b); + ARMReg vB1 = fpr.R1(b); + ARMReg vC0 = fpr.R0(c); + ARMReg vD0 = fpr.R0(d, false); + ARMReg vD1 = fpr.R1(d, false); + + ARMReg V0 = fpr.GetReg(); + ARMReg V1 = fpr.GetReg(); + + VMOV(V0, vB0); + VMOV(V1, vB1); + + VMLA(V0, vA0, vC0); + VMLA(V1, vA1, vC0); + + VMOV(vD0, V0); + VMOV(vD1, V1); + + fpr.Unlock(V0); + fpr.Unlock(V1); +} + +void JitArm::ps_madds1(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(bJITPairedOff) + + u32 a = inst.FA, b = inst.FB, c = inst.FC, d = inst.FD; + + if (inst.Rc) { + Default(inst); return; + } + ARMReg vA0 = fpr.R0(a); + ARMReg vA1 = fpr.R1(a); + ARMReg vB0 = fpr.R0(b); + ARMReg vB1 = fpr.R1(b); + ARMReg vC1 = fpr.R1(c); + ARMReg vD0 = fpr.R0(d, false); + ARMReg vD1 = fpr.R1(d, false); + + ARMReg V0 = fpr.GetReg(); + ARMReg V1 = fpr.GetReg(); + + VMOV(V0, vB0); + VMOV(V1, vB1); + + VMLA(V0, vA0, vC1); + VMLA(V1, vA1, vC1); + + VMOV(vD0, V0); + VMOV(vD1, V1); + + fpr.Unlock(V0); + fpr.Unlock(V1); +} void JitArm::ps_sum0(UGeckoInstruction inst) { INSTRUCTION_START diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp index da6d6b9dc8..4569eb54c4 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp @@ -147,8 +147,8 @@ static GekkoOPTemplate table4_2[] = {11, &JitArm::ps_sum1}, //"ps_sum1", OPTYPE_PS, 0}}, {12, &JitArm::ps_muls0}, //"ps_muls0", OPTYPE_PS, 0}}, {13, &JitArm::ps_muls1}, //"ps_muls1", OPTYPE_PS, 0}}, - {14, &JitArm::Default}, //"ps_madds0", OPTYPE_PS, 0}}, - {15, &JitArm::Default}, //"ps_madds1", OPTYPE_PS, 0}}, + {14, &JitArm::ps_madds0}, //"ps_madds0", OPTYPE_PS, 0}}, + {15, &JitArm::ps_madds1}, //"ps_madds1", OPTYPE_PS, 0}}, {18, &JitArm::Default}, //"ps_div", OPTYPE_PS, 0, 16}}, {20, &JitArm::ps_sub}, //"ps_sub", OPTYPE_PS, 0}}, {21, &JitArm::ps_add}, //"ps_add", OPTYPE_PS, 0}},