Jit64: use domain-appropriate instructions

This commit is contained in:
Tillmann Karras 2015-11-18 20:32:20 +01:00
parent 55cb358b4c
commit 62d3423ccf
2 changed files with 15 additions and 15 deletions

View File

@ -139,18 +139,18 @@ void Jit64::HandleNaNs(UGeckoInstruction inst, X64Reg xmm_out, X64Reg xmm, X64Re
SwitchToFarCode(); SwitchToFarCode();
SetJumpTarget(handle_nan); SetJumpTarget(handle_nan);
MOVAPD(tmp, R(clobber)); MOVAPD(tmp, R(clobber));
PANDN(clobber, R(xmm)); ANDNPD(clobber, R(xmm));
PAND(tmp, M(psGeneratedQNaN)); ANDPD(tmp, M(psGeneratedQNaN));
POR(tmp, R(clobber)); ORPD(tmp, R(clobber));
MOVAPD(xmm, R(tmp)); MOVAPD(xmm, R(tmp));
for (u32 x : inputs) for (u32 x : inputs)
{ {
MOVAPD(clobber, fpr.R(x)); MOVAPD(clobber, fpr.R(x));
CMPPD(clobber, R(clobber), CMP_ORD); CMPPD(clobber, R(clobber), CMP_ORD);
MOVAPD(tmp, R(clobber)); MOVAPD(tmp, R(clobber));
PANDN(clobber, fpr.R(x)); ANDNPD(clobber, fpr.R(x));
PAND(xmm, R(tmp)); ANDPD(xmm, R(tmp));
POR(xmm, R(clobber)); ORPD(xmm, R(clobber));
} }
FixupBranch done = J(true); FixupBranch done = J(true);
SwitchToNearCode(); SwitchToNearCode();
@ -331,7 +331,7 @@ void Jit64::fmaddXX(UGeckoInstruction inst)
ADDSD(XMM1, fpr.R(b)); ADDSD(XMM1, fpr.R(b));
} }
if (inst.SUBOP5 == 31) //nmadd if (inst.SUBOP5 == 31) //nmadd
PXOR(XMM1, M(packed ? psSignBits2 : psSignBits)); XORPD(XMM1, M(packed ? psSignBits2 : psSignBits));
} }
fpr.BindToRegister(d, !single); fpr.BindToRegister(d, !single);
if (single) if (single)
@ -365,13 +365,13 @@ void Jit64::fsign(UGeckoInstruction inst)
switch (inst.SUBOP10) switch (inst.SUBOP10)
{ {
case 40: // neg case 40: // neg
avx_op(&XEmitter::VPXOR, &XEmitter::PXOR, fpr.RX(d), src, M(packed ? psSignBits2 : psSignBits), packed); avx_op(&XEmitter::VXORPD, &XEmitter::XORPD, fpr.RX(d), src, M(packed ? psSignBits2 : psSignBits), packed);
break; break;
case 136: // nabs case 136: // nabs
avx_op(&XEmitter::VPOR, &XEmitter::POR, fpr.RX(d), src, M(packed ? psSignBits2 : psSignBits), packed); avx_op(&XEmitter::VORPD, &XEmitter::ORPD, fpr.RX(d), src, M(packed ? psSignBits2 : psSignBits), packed);
break; break;
case 264: // abs case 264: // abs
avx_op(&XEmitter::VPAND, &XEmitter::PAND, fpr.RX(d), src, M(packed ? psAbsMask2 : psAbsMask), packed); avx_op(&XEmitter::VANDPD, &XEmitter::ANDPD, fpr.RX(d), src, M(packed ? psAbsMask2 : psAbsMask), packed);
break; break;
default: default:
PanicAlert("fsign bleh"); PanicAlert("fsign bleh");
@ -394,7 +394,7 @@ void Jit64::fselx(UGeckoInstruction inst)
bool packed = inst.OPCD == 4; // ps_sel bool packed = inst.OPCD == 4; // ps_sel
fpr.Lock(a, b, c, d); fpr.Lock(a, b, c, d);
PXOR(XMM0, R(XMM0)); XORPD(XMM0, R(XMM0));
// This condition is very tricky; there's only one right way to handle both the case of // This condition is very tricky; there's only one right way to handle both the case of
// negative/positive zero and NaN properly. // negative/positive zero and NaN properly.
// (a >= -0.0 ? c : b) transforms into (0 > a ? b : c), hence the NLE. // (a >= -0.0 ? c : b) transforms into (0 > a ? b : c), hence the NLE.
@ -411,9 +411,9 @@ void Jit64::fselx(UGeckoInstruction inst)
else else
{ {
MOVAPD(XMM1, R(XMM0)); MOVAPD(XMM1, R(XMM0));
PAND(XMM0, fpr.R(b)); ANDPD(XMM0, fpr.R(b));
PANDN(XMM1, fpr.R(c)); ANDNPD(XMM1, fpr.R(c));
POR(XMM1, R(XMM0)); ORPD(XMM1, R(XMM0));
} }
fpr.BindToRegister(d, !packed); fpr.BindToRegister(d, !packed);

View File

@ -415,7 +415,7 @@ void Jit64::dcbz(UGeckoInstruction inst)
// FIXME: Work out why the AGP disc writes out of bounds // FIXME: Work out why the AGP disc writes out of bounds
if (!SConfig::GetInstance().bWii) if (!SConfig::GetInstance().bWii)
AND(32, R(RSCRATCH), Imm32(Memory::RAM_MASK)); AND(32, R(RSCRATCH), Imm32(Memory::RAM_MASK));
PXOR(XMM0, R(XMM0)); XORPS(XMM0, R(XMM0));
MOVAPS(MComplex(RMEM, RSCRATCH, SCALE_1, 0), XMM0); MOVAPS(MComplex(RMEM, RSCRATCH, SCALE_1, 0), XMM0);
MOVAPS(MComplex(RMEM, RSCRATCH, SCALE_1, 16), XMM0); MOVAPS(MComplex(RMEM, RSCRATCH, SCALE_1, 16), XMM0);
SetJumpTarget(exit); SetJumpTarget(exit);