diff --git a/src/common/x64/emitter.cpp b/src/common/x64/emitter.cpp index 410dd22a..ef569667 100644 --- a/src/common/x64/emitter.cpp +++ b/src/common/x64/emitter.cpp @@ -1401,10 +1401,16 @@ void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a) void XEmitter::WriteSSEOp(u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extrabytes) { + WriteSSEOp_opBits(32, opPrefix, op, regOp, arg, extrabytes); +} + +void XEmitter::WriteSSEOp_opBits(int opBits, u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extrabytes) +{ + ASSERT(opBits == 32 || opBits == 64); if (opPrefix) Write8(opPrefix); arg.operandReg = regOp; - arg.WriteRex(this, 0, 0); + arg.WriteRex(this, opBits, 0); Write8(0x0F); if (op > 0xFF) Write8((op >> 8) & 0xFF); @@ -1641,8 +1647,8 @@ void XEmitter::CVTSD2SS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x5A, void XEmitter::CVTSS2SD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x5A, regOp, arg);} void XEmitter::CVTSD2SI(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x2D, regOp, arg);} void XEmitter::CVTSS2SI(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x2D, regOp, arg);} -void XEmitter::CVTSI2SD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x2A, regOp, arg);} -void XEmitter::CVTSI2SS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x2A, regOp, arg);} +void XEmitter::CVTSI2SD(int opBits, X64Reg regOp, const OpArg& arg) {WriteSSEOp_opBits(opBits, 0xF2, 0x2A, regOp, arg);} +void XEmitter::CVTSI2SS(int opBits, X64Reg regOp, const OpArg& arg) {WriteSSEOp_opBits(opBits, 0xF3, 0x2A, regOp, arg);} void XEmitter::CVTDQ2PD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0xE6, regOp, arg);} void XEmitter::CVTDQ2PS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, 0x5B, regOp, arg);} diff --git a/src/common/x64/emitter.h b/src/common/x64/emitter.h index 763ffb3b..baa30695 100644 --- a/src/common/x64/emitter.h +++ b/src/common/x64/emitter.h @@ -344,6 +344,7 @@ private: void WriteBitTest(int bits, const OpArg& dest, const OpArg& index, int ext); void WriteMXCSR(OpArg arg, int ext); void WriteSSEOp(u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extrabytes = 0); + void WriteSSEOp_opBits(int opBits, u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extrabytes = 0); void WriteSSSE3Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes = 0); void WriteSSE41Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes = 0); void WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes = 0); @@ -714,9 +715,9 @@ public: void CVTPS2PD(X64Reg dest, const OpArg& src); void CVTPD2PS(X64Reg dest, const OpArg& src); void CVTSS2SD(X64Reg dest, const OpArg& src); - void CVTSI2SS(X64Reg dest, const OpArg& src); + void CVTSI2SS(int opBits, X64Reg dest, const OpArg& src); void CVTSD2SS(X64Reg dest, const OpArg& src); - void CVTSI2SD(X64Reg dest, const OpArg& src); + void CVTSI2SD(int opBits, X64Reg dest, const OpArg& src); void CVTDQ2PD(X64Reg regOp, const OpArg& arg); void CVTPD2DQ(X64Reg regOp, const OpArg& arg); void CVTDQ2PS(X64Reg regOp, const OpArg& arg);