mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Jit_Integer: srawix
This commit is contained in:
@ -1865,49 +1865,51 @@ void Jit64::srawix(UGeckoInstruction inst)
|
|||||||
|
|
||||||
if (amount != 0)
|
if (amount != 0)
|
||||||
{
|
{
|
||||||
gpr.Lock(a, s);
|
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
|
||||||
gpr.BindToRegister(a, a == s, true);
|
RCOpArg Rs = gpr.Use(s, RCMode::Read);
|
||||||
|
RegCache::Realize(Ra, Rs);
|
||||||
|
|
||||||
if (!js.op->wantsCA)
|
if (!js.op->wantsCA)
|
||||||
{
|
{
|
||||||
if (a != s)
|
if (a != s)
|
||||||
MOV(32, gpr.R(a), gpr.R(s));
|
MOV(32, Ra, Rs);
|
||||||
SAR(32, gpr.R(a), Imm8(amount));
|
SAR(32, Ra, Imm8(amount));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MOV(32, R(RSCRATCH), gpr.R(s));
|
MOV(32, R(RSCRATCH), Rs);
|
||||||
if (a != s)
|
if (a != s)
|
||||||
MOV(32, gpr.R(a), R(RSCRATCH));
|
MOV(32, Ra, R(RSCRATCH));
|
||||||
// some optimized common cases that can be done in slightly fewer ops
|
// some optimized common cases that can be done in slightly fewer ops
|
||||||
if (amount == 1)
|
if (amount == 1)
|
||||||
{
|
{
|
||||||
SHR(32, R(RSCRATCH), Imm8(31)); // sign
|
SHR(32, R(RSCRATCH), Imm8(31)); // sign
|
||||||
AND(32, R(RSCRATCH), gpr.R(a)); // (sign && carry)
|
AND(32, R(RSCRATCH), Ra); // (sign && carry)
|
||||||
SAR(32, gpr.R(a), Imm8(1));
|
SAR(32, Ra, Imm8(1));
|
||||||
MOV(8, PPCSTATE(xer_ca),
|
MOV(8, PPCSTATE(xer_ca),
|
||||||
R(RSCRATCH)); // XER.CA = sign && carry, aka (input&0x80000001) == 0x80000001
|
R(RSCRATCH)); // XER.CA = sign && carry, aka (input&0x80000001) == 0x80000001
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SAR(32, gpr.R(a), Imm8(amount));
|
SAR(32, Ra, Imm8(amount));
|
||||||
SHL(32, R(RSCRATCH), Imm8(32 - amount));
|
SHL(32, R(RSCRATCH), Imm8(32 - amount));
|
||||||
TEST(32, R(RSCRATCH), gpr.R(a));
|
TEST(32, R(RSCRATCH), Ra);
|
||||||
FinalizeCarry(CC_NZ);
|
FinalizeCarry(CC_NZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gpr.Lock(a, s);
|
|
||||||
FinalizeCarry(false);
|
FinalizeCarry(false);
|
||||||
gpr.BindToRegister(a, a == s, true);
|
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
|
||||||
|
RCOpArg Rs = gpr.Use(s, RCMode::Read);
|
||||||
|
RegCache::Realize(Ra, Rs);
|
||||||
|
|
||||||
if (a != s)
|
if (a != s)
|
||||||
MOV(32, gpr.R(a), gpr.R(s));
|
MOV(32, Ra, Rs);
|
||||||
}
|
}
|
||||||
if (inst.Rc)
|
if (inst.Rc)
|
||||||
ComputeRC(gpr.R(a));
|
ComputeRC(a);
|
||||||
gpr.UnlockAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// count leading zeroes
|
// count leading zeroes
|
||||||
|
Reference in New Issue
Block a user