diff options
author | Ville Linde <villedevs@gmail.com> | 2016-04-02 21:10:29 +0300 |
---|---|---|
committer | Ville Linde <villedevs@gmail.com> | 2016-04-02 21:20:39 +0300 |
commit | 3af8030bb6aa9d319e659f9909a2b881e0278f55 (patch) | |
tree | e386a6b50c04dee9da7b42558089d5fce6b1e05d /src/devices/cpu | |
parent | b2578a2283b6fdf81d4db99ba96c660f1a93f03e (diff) |
x86emit: fix REX order with all SSE prefixes (nw)
Diffstat (limited to 'src/devices/cpu')
-rw-r--r-- | src/devices/cpu/x86emit.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/devices/cpu/x86emit.h b/src/devices/cpu/x86emit.h index e57e19e65d5..d9ac810c905 100644 --- a/src/devices/cpu/x86emit.h +++ b/src/devices/cpu/x86emit.h @@ -1273,6 +1273,11 @@ inline void emit_op(x86code *&emitptr, UINT32 op, UINT8 opsize, UINT8 reg, UINT8 if (opsize == OP_16BIT) emit_byte(emitptr, PREFIX_OPSIZE); + bool has_prefix = (op & 0xff0000) == 0x660000 || (op & 0xff0000) == 0xf20000 || (op & 0xff0000) == 0xf30000; + + if (has_prefix) + emit_byte(emitptr, op >> 16); + #if (X86EMIT_SIZE == 64) { UINT8 rex; @@ -1287,7 +1292,7 @@ inline void emit_op(x86code *&emitptr, UINT32 op, UINT8 opsize, UINT8 reg, UINT8 assert(opsize != OP_64BIT); #endif - if ((op & 0xff0000) != 0) + if ((op & 0xff0000) != 0 && !has_prefix) emit_byte(emitptr, op >> 16); if ((op & 0xff00) != 0) emit_byte(emitptr, op >> 8); @@ -2936,10 +2941,10 @@ inline void emit_movd_m32_r128(x86code *&emitptr, x86_memref memref, UINT8 sreg) #if (X86EMIT_SIZE == 64) -inline void emit_movq_r128_r64(x86code *&emitptr, UINT8 dreg, UINT8 sreg) { emit_byte(emitptr, 0x66); emit_op_modrm_reg(emitptr, OP_MOVD_Pd_Ed, OP_64BIT, dreg, sreg); } -inline void emit_movq_r128_m64(x86code *&emitptr, UINT8 dreg, x86_memref memref) { emit_byte(emitptr, 0x66); emit_op_modrm_mem(emitptr, OP_MOVD_Pd_Ed, OP_64BIT, dreg, memref); } -inline void emit_movq_r64_r128(x86code *&emitptr, UINT8 dreg, UINT8 sreg) { emit_byte(emitptr, 0x66); emit_op_modrm_reg(emitptr, OP_MOVD_Ed_Pd, OP_64BIT, sreg, dreg); } -inline void emit_movq_m64_r128(x86code *&emitptr, x86_memref memref, UINT8 sreg) { emit_byte(emitptr, 0x66); emit_op_modrm_mem(emitptr, OP_MOVD_Ed_Pd, OP_64BIT, sreg, memref); } +inline void emit_movq_r128_r64(x86code *&emitptr, UINT8 dreg, UINT8 sreg) { emit_op_modrm_reg(emitptr, OP_MOVD_Vd_Ed, OP_64BIT, dreg, sreg); } +inline void emit_movq_r128_m64(x86code *&emitptr, UINT8 dreg, x86_memref memref) { emit_op_modrm_mem(emitptr, OP_MOVD_Vd_Ed, OP_64BIT, dreg, memref); } +inline void emit_movq_r64_r128(x86code *&emitptr, UINT8 dreg, UINT8 sreg) { emit_op_modrm_reg(emitptr, OP_MOVD_Ed_Vd, OP_64BIT, sreg, dreg); } +inline void emit_movq_m64_r128(x86code *&emitptr, x86_memref memref, UINT8 sreg) { emit_op_modrm_mem(emitptr, OP_MOVD_Ed_Vd, OP_64BIT, sreg, memref); } #endif |