Common/Emitter: Inline _xMovRtoR into xImpl_Mov operator

Signed-off-by: SternXD <stern@sidestore.io>
This commit is contained in:
SternXD
2026-06-06 01:01:51 -04:00
committed by Ty
parent d187c61599
commit 7978370b39
3 changed files with 7 additions and 15 deletions
-2
View File
@@ -30,8 +30,6 @@ namespace x86Emitter
extern void EmitRex(SIMDInstructionInfo info, const xRegisterBase& reg1, const xRegisterBase& reg2); extern void EmitRex(SIMDInstructionInfo info, const xRegisterBase& reg1, const xRegisterBase& reg2);
extern void EmitRex(SIMDInstructionInfo info, const xRegisterBase& reg1, const xIndirectVoid& sib); extern void EmitRex(SIMDInstructionInfo info, const xRegisterBase& reg1, const xIndirectVoid& sib);
extern void _xMovRtoR(const xRegisterInt& to, const xRegisterInt& from);
template <typename T> template <typename T>
inline void xWrite(T val) inline void xWrite(T val)
{ {
+1 -7
View File
@@ -22,7 +22,7 @@
namespace x86Emitter namespace x86Emitter
{ {
void _xMovRtoR(const xRegisterInt& to, const xRegisterInt& from) void xImpl_Mov::operator()(const xRegisterInt& to, const xRegisterInt& from) const
{ {
pxAssert(to.GetOperandSize() == from.GetOperandSize()); pxAssert(to.GetOperandSize() == from.GetOperandSize());
@@ -32,12 +32,6 @@ namespace x86Emitter
xOpWrite(from.GetPrefix16(), from.Is8BitOp() ? 0x88 : 0x89, from, to); xOpWrite(from.GetPrefix16(), from.Is8BitOp() ? 0x88 : 0x89, from, to);
} }
void xImpl_Mov::operator()(const xRegisterInt& to, const xRegisterInt& from) const
{
// FIXME WTF?
_xMovRtoR(to, from);
}
void xImpl_Mov::operator()(const xIndirectVoid& dest, const xRegisterInt& from) const void xImpl_Mov::operator()(const xIndirectVoid& dest, const xRegisterInt& from) const
{ {
// mov eax has a special from when writing directly to a DISP32 address // mov eax has a special from when writing directly to a DISP32 address
+6 -6
View File
@@ -1045,7 +1045,7 @@ const xRegister32
} }
else if (displacement_size == 0) else if (displacement_size == 0)
{ {
_xMovRtoR(to, src.Index.MatchSizeTo(to)); xMOV(to, src.Index.MatchSizeTo(to));
return; return;
} }
else if (!preserve_flags) else if (!preserve_flags)
@@ -1053,7 +1053,7 @@ const xRegister32
// encode as MOV and ADD combo. Make sure to use the immediate on the // encode as MOV and ADD combo. Make sure to use the immediate on the
// ADD since it can encode as an 8-bit sign-extended value. // ADD since it can encode as an 8-bit sign-extended value.
_xMovRtoR(to, src.Index.MatchSizeTo(to)); xMOV(to, src.Index.MatchSizeTo(to));
xADD(to, src.Displacement); xADD(to, src.Displacement);
return; return;
} }
@@ -1071,7 +1071,7 @@ const xRegister32
// (this does not apply to older model P4s with the broken barrel shifter, // (this does not apply to older model P4s with the broken barrel shifter,
// but we currently aren't optimizing for that target anyway). // but we currently aren't optimizing for that target anyway).
_xMovRtoR(to, src.Index); xMOV(to, src.Index);
xSHL(to, src.Scale); xSHL(to, src.Scale);
return; return;
} }
@@ -1085,14 +1085,14 @@ const xRegister32
if (src.Index == rsp) if (src.Index == rsp)
{ {
// ESP is not encodable as an index (ix86 ignores it), thus: // ESP is not encodable as an index (ix86 ignores it), thus:
_xMovRtoR(to, src.Base.MatchSizeTo(to)); // will do the trick! xMOV(to, src.Base.MatchSizeTo(to)); // will do the trick!
if (src.Displacement) if (src.Displacement)
xADD(to, src.Displacement); xADD(to, src.Displacement);
return; return;
} }
else if (src.Displacement == 0) else if (src.Displacement == 0)
{ {
_xMovRtoR(to, src.Base.MatchSizeTo(to)); xMOV(to, src.Base.MatchSizeTo(to));
xADD(to, src.Index.MatchSizeTo(to)); xADD(to, src.Index.MatchSizeTo(to));
return; return;
} }
@@ -1102,7 +1102,7 @@ const xRegister32
// special case handling of ESP as Index, which is replaceable with // special case handling of ESP as Index, which is replaceable with
// a single MOV even when preserve_flags is set! :D // a single MOV even when preserve_flags is set! :D
_xMovRtoR(to, src.Base.MatchSizeTo(to)); xMOV(to, src.Base.MatchSizeTo(to));
return; return;
} }
} }