Merge pull request #1077 from FioraAeterna/integeropts2

Two small JIT optimizations
This commit is contained in:
Ryan Houdek 2014-09-15 07:09:11 -05:00
commit 20af50b1c4
3 changed files with 9 additions and 7 deletions

View File

@ -103,7 +103,7 @@ public:
void FinalizeCarryOverflow(bool oe, bool inv = false); void FinalizeCarryOverflow(bool oe, bool inv = false);
void FinalizeCarry(Gen::CCFlags cond); void FinalizeCarry(Gen::CCFlags cond);
void FinalizeCarry(bool ca); void FinalizeCarry(bool ca);
void ComputeRC(const Gen::OpArg & arg); void ComputeRC(const Gen::OpArg & arg, bool sign_extend = true);
// Use to extract bytes from a register using the regcache. offset is in bytes. // Use to extract bytes from a register using the regcache. offset is in bytes.
Gen::OpArg ExtractFromReg(int reg, int offset); Gen::OpArg ExtractFromReg(int reg, int offset);

View File

@ -116,17 +116,21 @@ void Jit64::FinalizeCarryOverflow(bool oe, bool inv)
FinalizeCarry(inv ? CC_NC : CC_C); FinalizeCarry(inv ? CC_NC : CC_C);
} }
void Jit64::ComputeRC(const Gen::OpArg & arg) void Jit64::ComputeRC(const Gen::OpArg & arg, bool sign_extend)
{ {
if (arg.IsImm()) if (arg.IsImm())
{ {
MOV(64, PPCSTATE(cr_val[0]), Imm32((s32)arg.offset)); MOV(64, PPCSTATE(cr_val[0]), Imm32((s32)arg.offset));
} }
else else if (sign_extend)
{ {
MOVSX(64, 32, RSCRATCH, arg); MOVSX(64, 32, RSCRATCH, arg);
MOV(64, PPCSTATE(cr_val[0]), R(RSCRATCH)); MOV(64, PPCSTATE(cr_val[0]), R(RSCRATCH));
} }
else
{
MOV(64, PPCSTATE(cr_val[0]), arg);
}
} }
OpArg Jit64::ExtractFromReg(int reg, int offset) OpArg Jit64::ExtractFromReg(int reg, int offset)
@ -206,7 +210,7 @@ void Jit64::regimmop(int d, int a, bool binary, u32 value, Operation doop, void
if (carry) if (carry)
FinalizeCarry(CC_C); FinalizeCarry(CC_C);
if (Rc) if (Rc)
ComputeRC(gpr.R(d)); ComputeRC(gpr.R(d), doop != And || (value & 0x80000000));
} }
else if (doop == Add) else if (doop == Add)
{ {

View File

@ -95,10 +95,8 @@ void Jit64::psq_l(UGeckoInstruction inst)
MOV(32, R(RSCRATCH2), Imm32(0x3F07)); MOV(32, R(RSCRATCH2), Imm32(0x3F07));
AND(32, R(RSCRATCH2), M(((char *)&GQR(inst.I)) + 2)); AND(32, R(RSCRATCH2), M(((char *)&GQR(inst.I)) + 2));
MOVZX(32, 8, RSCRATCH, R(RSCRATCH2)); MOVZX(32, 8, RSCRATCH, R(RSCRATCH2));
if (inst.W)
OR(32, R(RSCRATCH), Imm8(8));
CALLptr(MScaled(RSCRATCH, SCALE_8, (u32)(u64)asm_routines.pairedLoadQuantized)); CALLptr(MScaled(RSCRATCH, SCALE_8, (u32)(u64)(asm_routines.pairedLoadQuantized + inst.W * 8)));
MEMCHECK_START(false) MEMCHECK_START(false)
CVTPS2PD(fpr.RX(s), R(XMM0)); CVTPS2PD(fpr.RX(s), R(XMM0));