Jit_Paired: ps_sum

This commit is contained in:
MerryMage 2018-10-15 21:02:08 +01:00
parent be8fec6244
commit 1550729688
1 changed files with 17 additions and 14 deletions

View File

@ -38,43 +38,46 @@ void Jit64::ps_sum(UGeckoInstruction inst)
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;
int c = inst.FC; int c = inst.FC;
fpr.Lock(a, b, c, d);
OpArg op_a = fpr.R(a); RCOpArg Ra = fpr.Use(a, RCMode::Read);
fpr.BindToRegister(d, d == b || d == c); RCOpArg Rb = fpr.Use(b, RCMode::Read);
RCOpArg Rc = fpr.Use(c, RCMode::Read);
RCX64Reg Rd = fpr.Bind(d, RCMode::Write);
RegCache::Realize(Ra, Rb, Rc, Rd);
X64Reg tmp = XMM1; X64Reg tmp = XMM1;
MOVDDUP(tmp, op_a); // {a.ps0, a.ps0} MOVDDUP(tmp, Ra); // {a.ps0, a.ps0}
ADDPD(tmp, fpr.R(b)); // {a.ps0 + b.ps0, a.ps0 + b.ps1} ADDPD(tmp, Rb); // {a.ps0 + b.ps0, a.ps0 + b.ps1}
switch (inst.SUBOP5) switch (inst.SUBOP5)
{ {
case 10: // ps_sum0: {a.ps0 + b.ps1, c.ps1} case 10: // ps_sum0: {a.ps0 + b.ps1, c.ps1}
UNPCKHPD(tmp, fpr.R(c)); UNPCKHPD(tmp, Rc);
break; break;
case 11: // ps_sum1: {c.ps0, a.ps0 + b.ps1} case 11: // ps_sum1: {c.ps0, a.ps0 + b.ps1}
if (fpr.R(c).IsSimpleReg()) if (Rc.IsSimpleReg())
{ {
if (cpu_info.bSSE4_1) if (cpu_info.bSSE4_1)
{ {
BLENDPD(tmp, fpr.R(c), 1); BLENDPD(tmp, Rc, 1);
} }
else else
{ {
MOVAPD(XMM0, fpr.R(c)); MOVAPD(XMM0, Rc);
SHUFPD(XMM0, R(tmp), 2); SHUFPD(XMM0, R(tmp), 2);
tmp = XMM0; tmp = XMM0;
} }
} }
else else
{ {
MOVLPD(tmp, fpr.R(c)); MOVLPD(tmp, Rc);
} }
break; break;
default: default:
PanicAlert("ps_sum WTF!!!"); PanicAlert("ps_sum WTF!!!");
} }
HandleNaNs(inst, fpr.RX(d), tmp, tmp == XMM1 ? XMM0 : XMM1); HandleNaNs(inst, Rd, tmp, tmp == XMM1 ? XMM0 : XMM1);
ForceSinglePrecision(fpr.RX(d), fpr.R(d)); ForceSinglePrecision(Rd, Rd);
SetFPRFIfNeeded(fpr.RX(d)); SetFPRFIfNeeded(Rd);
fpr.UnlockAll();
} }
void Jit64::ps_muls(UGeckoInstruction inst) void Jit64::ps_muls(UGeckoInstruction inst)