mirror of https://github.com/PCSX2/pcsx2.git
x86emitter: extend test & bitscan type
Factorize the code to support any types
This commit is contained in:
parent
e285036455
commit
39a6bda52d
|
@ -25,9 +25,7 @@ namespace x86Emitter {
|
||||||
//
|
//
|
||||||
struct xImpl_Test
|
struct xImpl_Test
|
||||||
{
|
{
|
||||||
void operator()( const xRegister8& to, const xRegister8& from ) const;
|
void operator()( const xRegisterInt& to, const xRegisterInt& from ) const;
|
||||||
void operator()( const xRegister16& to, const xRegister16& from ) const;
|
|
||||||
void operator()( const xRegister32& to, const xRegister32& from ) const;
|
|
||||||
void operator()( const xIndirect32orLess& dest, int imm ) const;
|
void operator()( const xIndirect32orLess& dest, int imm ) const;
|
||||||
void operator()( const xRegisterInt& to, int imm ) const;
|
void operator()( const xRegisterInt& to, int imm ) const;
|
||||||
};
|
};
|
||||||
|
@ -50,9 +48,8 @@ struct xImpl_BitScan
|
||||||
// 0xbc [fwd] / 0xbd [rev]
|
// 0xbc [fwd] / 0xbd [rev]
|
||||||
u16 Opcode;
|
u16 Opcode;
|
||||||
|
|
||||||
void operator()( const xRegister32& to, const xRegister32& from ) const;
|
void operator()( const xRegister16or32or64& to, const xRegister16or32or64& from ) const;
|
||||||
void operator()( const xRegister16& to, const xRegister16& from ) const;
|
void operator()( const xRegister16or32or64& to, const xIndirectVoid& sibsrc ) const;
|
||||||
void operator()( const xRegister16or32& to, const xIndirectVoid& sibsrc ) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -922,22 +922,11 @@ __emitinline void xLEA( xRegister16 to, const xIndirectVoid& src, bool preserve_
|
||||||
// =====================================================================================================
|
// =====================================================================================================
|
||||||
// TEST / INC / DEC
|
// TEST / INC / DEC
|
||||||
// =====================================================================================================
|
// =====================================================================================================
|
||||||
void xImpl_Test::operator()( const xRegister8& to, const xRegister8& from ) const
|
void xImpl_Test::operator()( const xRegisterInt& to, const xRegisterInt& from ) const
|
||||||
{
|
|
||||||
xWrite8( 0x84 );
|
|
||||||
EmitSibMagic( from, to );
|
|
||||||
}
|
|
||||||
|
|
||||||
void xImpl_Test::operator()( const xRegister16& to, const xRegister16& from ) const
|
|
||||||
{
|
{
|
||||||
|
pxAssert( to.GetOperandSize() == from.GetOperandSize() );
|
||||||
to.prefix16();
|
to.prefix16();
|
||||||
xWrite8( 0x85 );
|
xWrite8( to.Is8BitOp() ? 0x84 : 0x85 );
|
||||||
EmitSibMagic( from, to );
|
|
||||||
}
|
|
||||||
|
|
||||||
void xImpl_Test::operator()( const xRegister32& to, const xRegister32& from ) const
|
|
||||||
{
|
|
||||||
xWrite8( 0x85 );
|
|
||||||
EmitSibMagic( from, to );
|
EmitSibMagic( from, to );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,11 +952,13 @@ void xImpl_Test::operator()( const xRegisterInt& to, int imm ) const
|
||||||
to.xWriteImm( imm );
|
to.xWriteImm( imm );
|
||||||
}
|
}
|
||||||
|
|
||||||
void xImpl_BitScan::operator()( const xRegister32& to, const xRegister32& from ) const { xOpWrite0F( Opcode, to, from ); }
|
void xImpl_BitScan::operator()( const xRegister16or32or64& to, const xRegister16or32or64& from ) const {
|
||||||
void xImpl_BitScan::operator()( const xRegister16& to, const xRegister16& from ) const { xOpWrite0F( 0x66, Opcode, to, from ); }
|
pxAssert( to->GetOperandSize() == from->GetOperandSize() );
|
||||||
void xImpl_BitScan::operator()( const xRegister16or32& to, const xIndirectVoid& sibsrc ) const
|
xOpWrite0F( from->GetPrefix16(), Opcode, to, from );
|
||||||
|
}
|
||||||
|
void xImpl_BitScan::operator()( const xRegister16or32or64& to, const xIndirectVoid& sibsrc ) const
|
||||||
{
|
{
|
||||||
xOpWrite0F( (to->GetOperandSize() == 2) ? 0x66 : 0x00, Opcode, to, sibsrc );
|
xOpWrite0F( to->GetPrefix16(), Opcode, to, sibsrc );
|
||||||
}
|
}
|
||||||
|
|
||||||
void xImpl_IncDec::operator()( const xRegisterInt& to ) const
|
void xImpl_IncDec::operator()( const xRegisterInt& to ) const
|
||||||
|
|
Loading…
Reference in New Issue