Smaller ComputeMemoryAddress/Offset sequence
Replace a movzx after setae in both ComputeMemoryAddressOffset and ComputeMemoryAddress with a xor_ of eax prior to the cmp. This reduces the length in bytes of both sequences by 1, and should be a moderate ICache usage reduction thanks to the frequency of these sequences.
This commit is contained in:
parent
93584b831e
commit
931d45bdd6
|
@ -52,9 +52,9 @@ RegExp ComputeMemoryAddressOffset(X64Emitter& e, const T& guest,
|
||||||
if (xe::memory::allocation_granularity() > 0x1000) {
|
if (xe::memory::allocation_granularity() > 0x1000) {
|
||||||
// Emulate the 4 KB physical address offset in 0xE0000000+ when can't do
|
// Emulate the 4 KB physical address offset in 0xE0000000+ when can't do
|
||||||
// it via memory mapping.
|
// it via memory mapping.
|
||||||
|
e.xor_(e.eax, e.eax);
|
||||||
e.cmp(guest.reg().cvt32(), 0xE0000000 - offset_const);
|
e.cmp(guest.reg().cvt32(), 0xE0000000 - offset_const);
|
||||||
e.setae(e.al);
|
e.setae(e.al);
|
||||||
e.movzx(e.eax, e.al);
|
|
||||||
e.shl(e.eax, 12);
|
e.shl(e.eax, 12);
|
||||||
e.add(e.eax, guest.reg().cvt32());
|
e.add(e.eax, guest.reg().cvt32());
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,9 +89,9 @@ RegExp ComputeMemoryAddress(X64Emitter& e, const T& guest) {
|
||||||
if (xe::memory::allocation_granularity() > 0x1000) {
|
if (xe::memory::allocation_granularity() > 0x1000) {
|
||||||
// Emulate the 4 KB physical address offset in 0xE0000000+ when can't do
|
// Emulate the 4 KB physical address offset in 0xE0000000+ when can't do
|
||||||
// it via memory mapping.
|
// it via memory mapping.
|
||||||
|
e.xor_(e.eax, e.eax);
|
||||||
e.cmp(guest.reg().cvt32(), 0xE0000000);
|
e.cmp(guest.reg().cvt32(), 0xE0000000);
|
||||||
e.setae(e.al);
|
e.setae(e.al);
|
||||||
e.movzx(e.eax, e.al);
|
|
||||||
e.shl(e.eax, 12);
|
e.shl(e.eax, 12);
|
||||||
e.add(e.eax, guest.reg().cvt32());
|
e.add(e.eax, guest.reg().cvt32());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue