diff options
| author | JosJuice <josjuice@gmail.com> | 2023-08-22 18:49:28 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2025-11-16 09:50:30 +0100 |
| commit | 2dead5009b593bc17f23eabf62e717be0d7bd01d (patch) | |
| tree | 0627b983ad29436c845e38972dec5ea4b2ab186d /Source/Core | |
| parent | b74c3faa486442f3240c75b88a1c592d1cbcba97 (diff) | |
Jit64: Extract handling of immediate Rc
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/Jit.h | 1 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 40 |
2 files changed, 22 insertions, 19 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.h b/Source/Core/Core/PowerPC/Jit64/Jit.h index e72397ccc5..5ce409cbaf 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/PowerPC/Jit64/Jit.h @@ -122,6 +122,7 @@ public: void FinalizeCarry(Gen::CCFlags cond); void FinalizeCarry(bool ca); void ComputeRC(preg_t preg, bool needs_test = true, bool needs_sext = true); + void FinalizeImmediateRC(s32 value); void AndWithMask(Gen::X64Reg reg, u32 mask); void RotateLeft(int bits, Gen::X64Reg regOp, const Gen::OpArg& arg, u8 rotate); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index 65d2a4296b..03d8e2af7a 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -150,7 +150,10 @@ void Jit64::ComputeRC(preg_t preg, bool needs_test, bool needs_sext) if (arg.IsImm()) { - MOV(64, PPCSTATE_CR(0), Imm32(arg.SImm32())); + const s32 value = arg.SImm32(); + arg.Unlock(); + FinalizeImmediateRC(value); + return; } else if (needs_sext) { @@ -164,33 +167,32 @@ void Jit64::ComputeRC(preg_t preg, bool needs_test, bool needs_sext) if (CheckMergedBranch(0)) { - if (arg.IsImm()) + if (needs_test) { - s32 offset = arg.SImm32(); + TEST(32, arg, arg); arg.Unlock(); - DoMergedBranchImmediate(offset); } else { - if (needs_test) - { - TEST(32, arg, arg); - arg.Unlock(); - } - else - { - // If an operand to the cmp/rc op we're merging with the branch isn't used anymore, it'd be - // better to flush it here so that we don't have to flush it on both sides of the branch. - // We don't want to do this if a test is needed though, because it would interrupt macro-op - // fusion. - arg.Unlock(); - gpr.Flush(~js.op->gprInUse); - } - DoMergedBranchCondition(); + // If an operand to the cmp/rc op we're merging with the branch isn't used anymore, it'd be + // better to flush it here so that we don't have to flush it on both sides of the branch. + // We don't want to do this if a test is needed though, because it would interrupt macro-op + // fusion. + arg.Unlock(); + gpr.Flush(~js.op->gprInUse); } + DoMergedBranchCondition(); } } +void Jit64::FinalizeImmediateRC(s32 value) +{ + MOV(64, PPCSTATE_CR(0), Imm32(value)); + + if (CheckMergedBranch(0)) + DoMergedBranchImmediate(value); +} + // we can't do this optimization in the emitter because MOVZX and AND have different effects on // flags. void Jit64::AndWithMask(X64Reg reg, u32 mask) |
