From e285036455d753a4c89db2dde34d465d5b022aec Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 16 Jan 2016 22:40:50 +0100 Subject: [PATCH] x86emitter: shift: extend it to 64 bits type --- common/include/x86emitter/implement/dwshift.h | 11 ++++--- common/src/x86emitter/x86emitter.cpp | 29 +++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/common/include/x86emitter/implement/dwshift.h b/common/include/x86emitter/implement/dwshift.h index 63953f72be..edba5703a0 100644 --- a/common/include/x86emitter/implement/dwshift.h +++ b/common/include/x86emitter/implement/dwshift.h @@ -32,13 +32,12 @@ struct xImpl_DwordShift { u16 OpcodeBase; - void operator()( const xRegister32& to, const xRegister32& from, const xRegisterCL& clreg ) const; - void operator()( const xRegister16& to, const xRegister16& from, const xRegisterCL& clreg ) const; - void operator()( const xRegister32& to, const xRegister32& from, u8 shiftcnt ) const; - void operator()( const xRegister16& to, const xRegister16& from, u8 shiftcnt ) const; + void operator()( const xRegister16or32or64& to, const xRegister16or32or64& from, const xRegisterCL& clreg ) const; - void operator()( const xIndirectVoid& dest,const xRegister16or32& from, const xRegisterCL& clreg ) const; - void operator()( const xIndirectVoid& dest,const xRegister16or32& from, u8 shiftcnt ) const; + void operator()( const xRegister16or32or64& to, const xRegister16or32or64& from, u8 shiftcnt ) const; + + void operator()( const xIndirectVoid& dest,const xRegister16or32or64& from, const xRegisterCL& clreg ) const; + void operator()( const xIndirectVoid& dest,const xRegister16or32or64& from, u8 shiftcnt ) const; }; } // End namespace x86Emitter diff --git a/common/src/x86emitter/x86emitter.cpp b/common/src/x86emitter/x86emitter.cpp index 2717c04e40..b0067111f5 100644 --- a/common/src/x86emitter/x86emitter.cpp +++ b/common/src/x86emitter/x86emitter.cpp @@ -991,28 +991,27 @@ void xImpl_IncDec::operator()( const xIndirect32orLess& to ) const EmitSibMagic( isDec ? 1 : 0, to ); } -void xImpl_DwordShift::operator()( const xRegister32& to, const xRegister32& from, const xRegisterCL& /* clreg */ ) const { xOpWrite0F( OpcodeBase+1, to, from ); } -void xImpl_DwordShift::operator()( const xRegister16& to, const xRegister16& from, const xRegisterCL& /* clreg */ ) const { xOpWrite0F( 0x66, OpcodeBase+1, to, from ); } -void xImpl_DwordShift::operator()( const xRegister32& to, const xRegister32& from, u8 shiftcnt ) const -{ - if( shiftcnt != 0 ) - xOpWrite0F( OpcodeBase, to, from, shiftcnt ); -} -void xImpl_DwordShift::operator()( const xRegister16& to, const xRegister16& from, u8 shiftcnt ) const -{ - if( shiftcnt != 0 ) - xOpWrite0F( 0x66, OpcodeBase, to, from, shiftcnt ); +void xImpl_DwordShift::operator()( const xRegister16or32or64& to, const xRegister16or32or64& from, const xRegisterCL& /* clreg */ ) const { + pxAssert( to->GetOperandSize() == from->GetOperandSize() ); + xOpWrite0F( from->GetPrefix16(), OpcodeBase+1, to, from ); } -void xImpl_DwordShift::operator()( const xIndirectVoid& dest, const xRegister16or32& from, const xRegisterCL& /* clreg */ ) const +void xImpl_DwordShift::operator()( const xRegister16or32or64& to, const xRegister16or32or64& from, u8 shiftcnt ) const { - xOpWrite0F( (from->GetOperandSize() == 2) ? 0x66 : 0x00, OpcodeBase + 1, from, dest ); + pxAssert( to->GetOperandSize() == from->GetOperandSize() ); + if( shiftcnt != 0 ) + xOpWrite0F( from->GetPrefix16(), OpcodeBase, to, from, shiftcnt ); } -void xImpl_DwordShift::operator()( const xIndirectVoid& dest, const xRegister16or32& from, u8 shiftcnt ) const +void xImpl_DwordShift::operator()( const xIndirectVoid& dest, const xRegister16or32or64& from, const xRegisterCL& /* clreg */ ) const +{ + xOpWrite0F( from->GetPrefix16(), OpcodeBase + 1, from, dest ); +} + +void xImpl_DwordShift::operator()( const xIndirectVoid& dest, const xRegister16or32or64& from, u8 shiftcnt ) const { if( shiftcnt != 0 ) - xOpWrite0F( (from->GetOperandSize() == 2) ? 0x66 : 0x00, OpcodeBase, from, dest, shiftcnt ); + xOpWrite0F( from->GetPrefix16(), OpcodeBase, from, dest, shiftcnt ); } const xImpl_Test xTEST = { };