x86emitter: rewrite remaining function to use generic template

This commit is contained in:
Gregory Hainaut 2016-01-17 16:42:39 +01:00
parent fc5e293ef6
commit 9ac22ee9aa
1 changed files with 8 additions and 16 deletions

View File

@ -921,29 +921,21 @@ __emitinline void xLEA( xRegister16 to, const xIndirectVoid& src, bool preserve_
void xImpl_Test::operator()( const xRegisterInt& to, const xRegisterInt& from ) const void xImpl_Test::operator()( const xRegisterInt& to, const xRegisterInt& from ) const
{ {
pxAssert( to.GetOperandSize() == from.GetOperandSize() ); pxAssert( to.GetOperandSize() == from.GetOperandSize() );
to.prefix16(); xOpWrite( to.GetPrefix16(), to.Is8BitOp() ? 0x84 : 0x85, from, to );
xWrite8( to.Is8BitOp() ? 0x84 : 0x85 );
EmitSibMagic( from, to );
} }
void xImpl_Test::operator()( const xIndirect64orLess& dest, int imm ) const void xImpl_Test::operator()( const xIndirect64orLess& dest, int imm ) const
{ {
dest.prefix16(); xOpWrite( dest.GetPrefix16(), dest.Is8BitOp() ? 0xf6 : 0xf7, 0, dest );
xWrite8( dest.Is8BitOp() ? 0xf6 : 0xf7 );
EmitSibMagic( 0, dest );
dest.xWriteImm( imm ); dest.xWriteImm( imm );
} }
void xImpl_Test::operator()( const xRegisterInt& to, int imm ) const void xImpl_Test::operator()( const xRegisterInt& to, int imm ) const
{ {
to.prefix16(); if( to.IsAccumulator() ) {
xOpAccWrite( to.GetPrefix16(), to.Is8BitOp() ? 0xa8 : 0xa9, 0, to );
if( to.IsAccumulator() ) } else {
xWrite8( to.Is8BitOp() ? 0xa8 : 0xa9 ); xOpWrite( to.GetPrefix16(), to.Is8BitOp() ? 0xf6 : 0xf7, 0, to );
else
{
xWrite8( to.Is8BitOp() ? 0xf6 : 0xf7 );
EmitSibMagic( 0, to );
} }
to.xWriteImm( imm ); to.xWriteImm( imm );
} }
@ -961,8 +953,8 @@ void xImpl_IncDec::operator()( const xRegisterInt& to ) const
{ {
if( to.Is8BitOp() ) if( to.Is8BitOp() )
{ {
xWrite8( 0xfe ); u8 regfield = isDec ? 1 : 0;
EmitSibMagic( isDec ? 1 : 0, to ); xOpWrite( to.GetPrefix16(), 0xfe, regfield, to);
} }
else else
{ {