Jit: Move cntlzwx to ConstantPropagation

This commit is contained in:
JosJuice 2023-08-24 14:31:42 +02:00
parent b506cb2ad8
commit 92a5a46b2c
3 changed files with 10 additions and 19 deletions

View File

@ -2649,14 +2649,9 @@ void Jit64::cntlzwx(UGeckoInstruction inst)
int s = inst.RS; int s = inst.RS;
bool needs_test = false; bool needs_test = false;
if (gpr.IsImm(s))
{
gpr.SetImmediate32(a, static_cast<u32>(std::countl_zero(gpr.Imm32(s))));
}
else
{ {
RCX64Reg Ra = gpr.Bind(a, RCMode::Write); RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
RCOpArg Rs = gpr.Use(s, RCMode::Read); RCOpArg Rs = gpr.UseNoImm(s, RCMode::Read);
RegCache::Realize(Ra, Rs); RegCache::Realize(Ra, Rs);
if (cpu_info.bLZCNT) if (cpu_info.bLZCNT)

View File

@ -519,19 +519,10 @@ void JitArm64::cntlzwx(UGeckoInstruction inst)
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.IsImm(s)) gpr.BindToRegister(a, a == s);
{ CLZ(gpr.R(a), gpr.R(s));
gpr.SetImmediate(a, static_cast<u32>(std::countl_zero(gpr.GetImm(s)))); if (inst.Rc)
if (inst.Rc) ComputeRC0(gpr.R(a));
ComputeRC0(gpr.GetImm(a));
}
else
{
gpr.BindToRegister(a, a == s);
CLZ(gpr.R(a), gpr.R(s));
if (inst.Rc)
ComputeRC0(gpr.R(a));
}
} }
void JitArm64::negx(UGeckoInstruction inst) void JitArm64::negx(UGeckoInstruction inst)

View File

@ -3,6 +3,8 @@
#include "Core/PowerPC/JitCommon/ConstantPropagation.h" #include "Core/PowerPC/JitCommon/ConstantPropagation.h"
#include <bit>
#include "Core/PowerPC/PPCTables.h" #include "Core/PowerPC/PPCTables.h"
namespace JitCommon namespace JitCommon
@ -107,6 +109,9 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstructio
switch (inst.SUBOP10) switch (inst.SUBOP10)
{ {
case 26: // cntlzwx
a = std::countl_zero(s);
break;
case 922: // extshx case 922: // extshx
a = s32(s16(s)); a = s32(s16(s));
break; break;