summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorSintendo <bram.speeckaert@gmail.com>2020-11-15 13:04:57 +0100
committerSintendo <bram.speeckaert@gmail.com>2020-12-25 19:30:51 +0100
commit2e4e2ad1ffc92ac76498f926ca88637d098ea747 (patch)
tree98e8050340755c39a1e1e28db2160841a8e60f3b /Source
parent6ddf69d0940b193cad1fb97356bf175a8c4388ab (diff)
Jit64: subfic - Handle constants
Occurs surprisingly often. Prevents generating silly code like this: BE 03 00 00 00 mov esi,3 83 EE 08 sub esi,8 0F 93 45 58 setae byte ptr [rbp+58h]
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
index 74362c12c1..12e46b0530 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
@@ -862,13 +862,20 @@ void Jit64::subfic(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
- int a = inst.RA, d = inst.RD;
+ int a = inst.RA, d = inst.RD, imm = inst.SIMM_16;
+
+ if (gpr.IsImm(a))
+ {
+ u32 i = imm, j = gpr.Imm32(a);
+ gpr.SetImmediate32(d, i - j);
+ FinalizeCarry(j == 0 || (i > j - 1));
+ return;
+ }
RCOpArg Ra = gpr.Use(a, RCMode::Read);
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
RegCache::Realize(Ra, Rd);
- int imm = inst.SIMM_16;
if (d == a)
{
if (imm == 0)