summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2021-06-17 09:12:50 +0200
committerGitHub <noreply@github.com>2021-06-17 09:12:50 +0200
commitb530d9b8c242a0c87e3744b87c7e4e7e25544ebb (patch)
tree01056430b02098b4891f40e289ee3c5b15c94bb9 /Source/Core
parent4e9e75f4c59df17e9ac0a15260fadea255a015fe (diff)
parent18aaf488b0cb3509727ee8d252c0f08a5951fffa (diff)
Merge pull request #9817 from Sintendo/jit64subfic
Jit64: subfic - Optimize constants for d != a
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
index 30cc919d60..1f6371e2c2 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
@@ -898,28 +898,31 @@ void Jit64::subfic(UGeckoInstruction inst)
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
RegCache::Realize(Ra, Rd);
- if (d == a)
+ if (imm == 0)
{
- if (imm == 0)
- {
- // Flags act exactly like subtracting from 0
- NEG(32, Rd);
- // Output carry is inverted
- FinalizeCarry(CC_NC);
- }
- else if (imm == -1)
- {
- NOT(32, Rd);
- // CA is always set in this case
- FinalizeCarry(true);
- }
- else
- {
- NOT(32, Rd);
- ADD(32, Rd, Imm32(imm + 1));
- // Output carry is normal
- FinalizeCarry(CC_C);
- }
+ if (d != a)
+ MOV(32, Rd, Ra);
+
+ // Flags act exactly like subtracting from 0
+ NEG(32, Rd);
+ // Output carry is inverted
+ FinalizeCarry(CC_NC);
+ }
+ else if (imm == -1)
+ {
+ if (d != a)
+ MOV(32, Rd, Ra);
+
+ NOT(32, Rd);
+ // CA is always set in this case
+ FinalizeCarry(true);
+ }
+ else if (d == a)
+ {
+ NOT(32, Rd);
+ ADD(32, Rd, Imm32(imm + 1));
+ // Output carry is normal
+ FinalizeCarry(CC_C);
}
else
{