Mercurial > repos > blastem
diff gen_x86.c @ 1216:0649cd8ca097
Cycle accurate MULU/MULS emulation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 04 Feb 2017 00:41:15 -0800 |
parents | 2ec5e6eaf81d |
children | d5a47597b61f |
line wrap: on
line diff
--- a/gen_x86.c Wed Feb 01 21:19:35 2017 -0800 +++ b/gen_x86.c Sat Feb 04 00:41:15 2017 -0800 @@ -31,6 +31,7 @@ #define OP_POP 0x58 #define OP_MOVSXD 0x63 #define PRE_SIZE 0x66 +#define OP_IMUL 0x69 #define OP_JCC 0x70 #define OP_IMMED_ARITH 0x80 #define OP_TEST 0x84 @@ -530,7 +531,7 @@ if (size == SZ_W) { *(out++) = PRE_SIZE; } - if (dst == RAX && !sign_extend) { + if (dst == RAX && !sign_extend && al_opcode) { if (size != SZ_B) { al_opcode |= BIT_SIZE; if (size == SZ_Q) { @@ -1146,6 +1147,15 @@ x86_rrdisp_sizedir(code, OP2_IMUL | (PRE_2BYTE << 8), dst, src_base, disp, size, 0); } +void imul_irr(code_info *code, int32_t val, uint8_t src, uint8_t dst, uint8_t size) +{ + if (size == SZ_B) { + fatal_error("imul immediate only supports 16-bit sizes and up"); + } + + x86_ir(code, OP_IMUL, dst, 0, val, src, size); +} + void not_r(code_info *code, uint8_t dst, uint8_t size) { x86_r_size(code, OP_NOT_NEG, OP_EX_NOT, dst, size);