Jit64: optimize floating-point/paired-single arith
The "else if (b != d)" branch was dead code and only works if b == d. Now the last else block with two temporary XMM registers is not needed anymore.
This commit is contained in:
parent
b4513313bb
commit
c234dc97c0
|
@ -25,33 +25,28 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool dupe, void (XEm
|
||||||
fpr.BindToRegister(d, true);
|
fpr.BindToRegister(d, true);
|
||||||
(this->*op)(fpr.RX(d), fpr.R(b));
|
(this->*op)(fpr.RX(d), fpr.R(b));
|
||||||
}
|
}
|
||||||
else if (d == b && reversible)
|
else if (d == b)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(d, true);
|
if (reversible)
|
||||||
(this->*op)(fpr.RX(d), fpr.R(a));
|
{
|
||||||
|
fpr.BindToRegister(d, true);
|
||||||
|
(this->*op)(fpr.RX(d), fpr.R(a));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MOVSD(XMM0, fpr.R(b));
|
||||||
|
fpr.BindToRegister(d, !dupe);
|
||||||
|
MOVSD(fpr.RX(d), fpr.R(a));
|
||||||
|
(this->*op)(fpr.RX(d), Gen::R(XMM0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (a != d && b != d)
|
else
|
||||||
{
|
{
|
||||||
// Sources different from d, can use rather quick solution
|
// Sources different from d, can use rather quick solution
|
||||||
fpr.BindToRegister(d, !dupe);
|
fpr.BindToRegister(d, !dupe);
|
||||||
MOVSD(fpr.RX(d), fpr.R(a));
|
MOVSD(fpr.RX(d), fpr.R(a));
|
||||||
(this->*op)(fpr.RX(d), fpr.R(b));
|
(this->*op)(fpr.RX(d), fpr.R(b));
|
||||||
}
|
}
|
||||||
else if (b != d)
|
|
||||||
{
|
|
||||||
fpr.BindToRegister(d, !dupe);
|
|
||||||
MOVSD(XMM0, fpr.R(b));
|
|
||||||
MOVSD(fpr.RX(d), fpr.R(a));
|
|
||||||
(this->*op)(fpr.RX(d), Gen::R(XMM0));
|
|
||||||
}
|
|
||||||
else // Other combo, must use two temps :(
|
|
||||||
{
|
|
||||||
MOVSD(XMM0, fpr.R(a));
|
|
||||||
MOVSD(XMM1, fpr.R(b));
|
|
||||||
fpr.BindToRegister(d, !dupe);
|
|
||||||
(this->*op)(XMM0, Gen::R(XMM1));
|
|
||||||
MOVSD(fpr.RX(d), Gen::R(XMM0));
|
|
||||||
}
|
|
||||||
if (dupe)
|
if (dupe)
|
||||||
{
|
{
|
||||||
ForceSinglePrecisionS(fpr.RX(d));
|
ForceSinglePrecisionS(fpr.RX(d));
|
||||||
|
@ -83,7 +78,7 @@ void Jit64::fp_arith_s(UGeckoInstruction inst)
|
||||||
// Causing problems for GC - Starfox Assault (invisible boss at the end of level 1)
|
// Causing problems for GC - Starfox Assault (invisible boss at the end of level 1)
|
||||||
if (inst.SUBOP5 == 21) {
|
if (inst.SUBOP5 == 21) {
|
||||||
Default(inst); return;
|
Default(inst); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst.SUBOP5 == 26) {
|
if (inst.SUBOP5 == 26) {
|
||||||
// frsqrtex
|
// frsqrtex
|
||||||
|
|
|
@ -152,33 +152,28 @@ void Jit64::tri_op(int d, int a, int b, bool reversible, void (XEmitter::*op)(X6
|
||||||
fpr.BindToRegister(d, true);
|
fpr.BindToRegister(d, true);
|
||||||
(this->*op)(fpr.RX(d), fpr.R(b));
|
(this->*op)(fpr.RX(d), fpr.R(b));
|
||||||
}
|
}
|
||||||
else if (d == b && reversible)
|
else if (d == b)
|
||||||
{
|
{
|
||||||
fpr.BindToRegister(d, true);
|
if (reversible)
|
||||||
(this->*op)(fpr.RX(d), fpr.R(a));
|
{
|
||||||
|
fpr.BindToRegister(d, true);
|
||||||
|
(this->*op)(fpr.RX(d), fpr.R(a));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MOVAPD(XMM0, fpr.R(b));
|
||||||
|
fpr.BindToRegister(d, false);
|
||||||
|
MOVAPD(fpr.RX(d), fpr.R(a));
|
||||||
|
(this->*op)(fpr.RX(d), Gen::R(XMM0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (a != d && b != d)
|
else
|
||||||
{
|
{
|
||||||
//sources different from d, can use rather quick solution
|
//sources different from d, can use rather quick solution
|
||||||
fpr.BindToRegister(d, false);
|
fpr.BindToRegister(d, false);
|
||||||
MOVAPD(fpr.RX(d), fpr.R(a));
|
MOVAPD(fpr.RX(d), fpr.R(a));
|
||||||
(this->*op)(fpr.RX(d), fpr.R(b));
|
(this->*op)(fpr.RX(d), fpr.R(b));
|
||||||
}
|
}
|
||||||
else if (b != d)
|
|
||||||
{
|
|
||||||
fpr.BindToRegister(d, false);
|
|
||||||
MOVAPD(XMM0, fpr.R(b));
|
|
||||||
MOVAPD(fpr.RX(d), fpr.R(a));
|
|
||||||
(this->*op)(fpr.RX(d), Gen::R(XMM0));
|
|
||||||
}
|
|
||||||
else //Other combo, must use two temps :(
|
|
||||||
{
|
|
||||||
MOVAPD(XMM0, fpr.R(a));
|
|
||||||
MOVAPD(XMM1, fpr.R(b));
|
|
||||||
fpr.BindToRegister(d, false);
|
|
||||||
(this->*op)(XMM0, Gen::R(XMM1));
|
|
||||||
MOVAPD(fpr.RX(d), Gen::R(XMM0));
|
|
||||||
}
|
|
||||||
ForceSinglePrecisionP(fpr.RX(d));
|
ForceSinglePrecisionP(fpr.RX(d));
|
||||||
fpr.UnlockAll();
|
fpr.UnlockAll();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue