Jit: Move cntlzwx to ConstantPropagation

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

View File

@ -2649,14 +2649,9 @@ void Jit64::cntlzwx(UGeckoInstruction inst)
int s = inst.RS;
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);
RCOpArg Rs = gpr.Use(s, RCMode::Read);
RCOpArg Rs = gpr.UseNoImm(s, RCMode::Read);
RegCache::Realize(Ra, Rs);
if (cpu_info.bLZCNT)

View File

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

View File

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