- fix misc integer opcodes and remove mov statements when they have no effect

This commit is contained in:
Magnus Norddahl 2018-09-11 23:31:32 +02:00
parent 5fab45d275
commit 981950fef0

View file

@ -1448,12 +1448,14 @@ private:
void EmitSLL_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.shl(regD[A], rc);
}
void EmitSLL_RI()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.shl(regD[A], C);
}
@ -1468,12 +1470,14 @@ private:
void EmitSRL_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.shr(regD[A], rc);
}
void EmitSRL_RI()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.shr(regD[A], C);
}
@ -1488,12 +1492,14 @@ private:
void EmitSRA_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.sar(regD[A], rc);
}
void EmitSRA_RI()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.sar(regD[A], C);
}
@ -1508,32 +1514,37 @@ private:
void EmitADD_RR()
{
auto rc = CheckRegD(C, A);
cc.mov(regD[A], konstd[B]);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.add(regD[A], rc);
}
void EmitADD_RK()
{
cc.mov(regD[A], konstd[B]);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.add(regD[A], konstd[C]);
}
void EmitADDI()
{
cc.mov(regD[A], konstd[B]);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.add(regD[A], Cs);
}
void EmitSUB_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.sub(regD[A], rc);
}
void EmitSUB_RK()
{
cc.mov(regD[A], konstd[B]);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.sub(regD[A], konstd[C]);
}
@ -1547,12 +1558,14 @@ private:
void EmitMUL_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.imul(regD[A], rc);
}
void EmitMUL_RK()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.imul(regD[A], konstd[C]);
}
@ -1768,12 +1781,14 @@ private:
void EmitAND_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.and_(regD[A], rc);
}
void EmitAND_RK()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.and_(regD[A], konstd[C]);
}
@ -1781,12 +1796,14 @@ private:
void EmitOR_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.or_(regD[A], rc);
}
void EmitOR_RK()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.or_(regD[A], konstd[C]);
}
@ -1794,12 +1811,14 @@ private:
void EmitXOR_RR()
{
auto rc = CheckRegD(C, A);
if (A != B)
cc.mov(regD[A], regD[B]);
cc.xor_(regD[A], rc);
}
void EmitXOR_RK()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.xor_(regD[A], konstd[C]);
}
@ -1868,6 +1887,7 @@ private:
void EmitNOT()
{
if (A != B)
cc.mov(regD[A], regD[B]);
cc.not_(regD[A]);
}
@ -2011,6 +2031,7 @@ private:
void EmitADDF_RR()
{
auto rc = CheckRegF(C, A);
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.addsd(regF[A], rc);
}
@ -2018,6 +2039,7 @@ private:
void EmitADDF_RK()
{
auto tmp = cc.newIntPtr();
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.mov(tmp, ToMemAddress(&konstf[C]));
cc.addsd(regF[A], asmjit::x86::qword_ptr(tmp));
@ -2026,6 +2048,7 @@ private:
void EmitSUBF_RR()
{
auto rc = CheckRegF(C, A);
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.subsd(regF[A], rc);
}
@ -2033,6 +2056,7 @@ private:
void EmitSUBF_RK()
{
auto tmp = cc.newIntPtr();
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.mov(tmp, ToMemAddress(&konstf[C]));
cc.subsd(regF[A], asmjit::x86::qword_ptr(tmp));
@ -2050,6 +2074,7 @@ private:
void EmitMULF_RR()
{
auto rc = CheckRegF(C, A);
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.mulsd(regF[A], rc);
}
@ -2057,6 +2082,7 @@ private:
void EmitMULF_RK()
{
auto tmp = cc.newIntPtr();
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.mov(tmp, ToMemAddress(&konstf[C]));
cc.mulsd(regF[A], asmjit::x86::qword_ptr(tmp));
@ -2205,6 +2231,7 @@ private:
void EmitMINF_RR()
{
auto rc = CheckRegF(C, A);
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.minsd(regF[A], rc);
}
@ -2221,6 +2248,7 @@ private:
void EmitMAXF_RR()
{
auto rc = CheckRegF(C, A);
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.maxsd(regF[A], rc);
}
@ -2256,6 +2284,7 @@ private:
auto mask = cc.newDoubleConst(asmjit::kConstScopeLocal, -0.0);
auto maskXmm = cc.newXmmSd();
cc.movsd(maskXmm, mask);
if (A != B)
cc.movsd(regF[A], regF[B]);
cc.xorpd(regF[A], maskXmm);
}