ARM64 Emitter: Optimize MOVI2R by always starting with a MOVZ, killing the register dependency in the out-of-order engine of the CPU.

This commit is contained in:
Henrik Rydgard committed 2015-04-06 18:13:06 +02:00
1 parent 58b059ca14
commit 80a813bcbd
1 file changed
+5 -5
+5 -5
View File
@@ -1787,7 +1787,9 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize)
{
unsigned int parts = Is64Bit(Rd) ? 4 : 2;
BitSet32 upload_part(0);
bool need_movz = false;
// Always start with a movz! Kills the dependency on the register.
bool use_movz = true;
if (!imm)
{
@@ -1814,8 +1816,6 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize)
{
if ((imm >> (i * 16)) & 0xFFFF)
upload_part[i] = 1;
else
need_movz = true;
}
}
@@ -1851,10 +1851,10 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize)
for (unsigned i = 0; i < parts; ++i)
{
if (need_movz && upload_part[i])
if (use_movz && upload_part[i])
{
MOVZ(Rd, (imm >> (i * 16)) & 0xFFFF, (ShiftAmount)i);
need_movz = false;
use_movz = false;
}
else
{