#define EBP_INDEX 5
#define ESI_INDEX 6
#define EDI_INDEX 7
-#if defined(__x86_64__)
+#if defined(CPU_x86_64)
#define R8_INDEX 8
#define R9_INDEX 9
#define R10_INDEX 10
/* Handle the _fastcall parameters of ECX and EDX */
#define REG_PAR1 ECX_INDEX
#define REG_PAR2 EDX_INDEX
-#elif defined(__x86_64__)
+#elif defined(CPU_x86_64)
#define REG_PAR1 EDI_INDEX
#define REG_PAR2 ESI_INDEX
#else
#define STACK_OFFSET sizeof(void *)
uae_u8 always_used[]={4,0xff};
-#if defined(__x86_64__)
+#if defined(CPU_x86_64)
uae_s8 can_byte[]={0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,-1};
uae_s8 can_word[]={0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,-1};
#else
* Actual encoding of the instructions on the target CPU *
*************************************************************************/
-STATIC_INLINE uae_u16 swap16(uae_u16 x)
+static inline uae_u16 swap16(uae_u16 x)
{
return ((x&0xff00)>>8)|((x&0x00ff)<<8);
}
-STATIC_INLINE uae_u32 swap32(uae_u32 x)
+static inline uae_u32 swap32(uae_u32 x)
{
return ((x&0xff00)<<8)|((x&0x00ff)<<24)|((x&0xff0000)>>8)|((x&0xff000000)>>24);
}
-STATIC_INLINE int isbyte(uae_s32 x)
+static inline int isbyte(uae_s32 x)
{
return (x>=-128 && x<=127);
}
+static inline int isword(uae_s32 x)
+{
+ return (x>=-32768 && x<=32767);
+}
+
LOWFUNC(NONE,WRITE,1,raw_push_l_r,(R4 r))
{
emit_byte(0x50+r);
}
LENDFUNC(NONE,WRITE,1,raw_push_l_r,(R4 r))
- LOWFUNC(NONE,READ,1,raw_pop_l_r,(R4 r))
+LOWFUNC(NONE,READ,1,raw_pop_l_r,(R4 r))
{
emit_byte(0x58+r);
}
LENDFUNC(NONE,READ,1,raw_pop_l_r,(R4 r))
- LOWFUNC(WRITE,NONE,2,raw_bt_l_ri,(R4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_bt_l_ri,(R4 r, IMM i))
{
emit_byte(0x0f);
emit_byte(0xba);
}
LENDFUNC(WRITE,NONE,2,raw_bt_l_ri,(R4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_bt_l_rr,(R4 r, R4 b))
+LOWFUNC(WRITE,NONE,2,raw_bt_l_rr,(R4 r, R4 b))
{
emit_byte(0x0f);
emit_byte(0xa3);
}
LENDFUNC(WRITE,NONE,2,raw_bt_l_rr,(R4 r, R4 b))
- LOWFUNC(WRITE,NONE,2,raw_btc_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_btc_l_ri,(RW4 r, IMM i))
{
emit_byte(0x0f);
emit_byte(0xba);
}
LENDFUNC(WRITE,NONE,2,raw_btc_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_btc_l_rr,(RW4 r, R4 b))
+LOWFUNC(WRITE,NONE,2,raw_btc_l_rr,(RW4 r, R4 b))
{
emit_byte(0x0f);
emit_byte(0xbb);
LENDFUNC(WRITE,NONE,2,raw_btc_l_rr,(RW4 r, R4 b))
- LOWFUNC(WRITE,NONE,2,raw_btr_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_btr_l_ri,(RW4 r, IMM i))
{
emit_byte(0x0f);
emit_byte(0xba);
}
LENDFUNC(WRITE,NONE,2,raw_btr_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_btr_l_rr,(RW4 r, R4 b))
+LOWFUNC(WRITE,NONE,2,raw_btr_l_rr,(RW4 r, R4 b))
{
emit_byte(0x0f);
emit_byte(0xb3);
}
LENDFUNC(WRITE,NONE,2,raw_btr_l_rr,(RW4 r, R4 b))
- LOWFUNC(WRITE,NONE,2,raw_bts_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_bts_l_ri,(RW4 r, IMM i))
{
emit_byte(0x0f);
emit_byte(0xba);
}
LENDFUNC(WRITE,NONE,2,raw_bts_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_bts_l_rr,(RW4 r, R4 b))
+LOWFUNC(WRITE,NONE,2,raw_bts_l_rr,(RW4 r, R4 b))
{
emit_byte(0x0f);
emit_byte(0xab);
}
LENDFUNC(WRITE,NONE,2,raw_bts_l_rr,(RW4 r, R4 b))
- LOWFUNC(WRITE,NONE,2,raw_sub_w_ri,(RW2 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_sub_w_ri,(RW2 d, IMM i))
{
emit_byte(0x66);
if (isbyte(i)) {
LENDFUNC(WRITE,NONE,2,raw_sub_w_ri,(RW2 d, IMM i))
- LOWFUNC(NONE,WRITE,2,raw_mov_l_mi,(MEMW d, IMM s))
+LOWFUNC(NONE,WRITE,2,raw_mov_l_mi,(MEMW d, IMM s))
{
emit_byte(0xc7);
emit_byte(0x05);
}
LENDFUNC(NONE,WRITE,2,raw_mov_l_mi,(MEMW d, IMM s))
- LOWFUNC(NONE,WRITE,2,raw_mov_w_mi,(MEMW d, IMM s))
+LOWFUNC(NONE,WRITE,2,raw_mov_w_mi,(MEMW d, IMM s))
{
emit_byte(0x66);
emit_byte(0xc7);
}
LENDFUNC(NONE,WRITE,2,raw_mov_w_mi,(MEMW d, IMM s))
- LOWFUNC(NONE,WRITE,2,raw_mov_b_mi,(MEMW d, IMM s))
+LOWFUNC(NONE,WRITE,2,raw_mov_b_mi,(MEMW d, IMM s))
{
emit_byte(0xc6);
emit_byte(0x05);
}
LENDFUNC(NONE,WRITE,2,raw_mov_b_mi,(MEMW d, IMM s))
- LOWFUNC(WRITE,RMW,2,raw_rol_b_mi,(MEMRW d, IMM i))
+LOWFUNC(WRITE,RMW,2,raw_rol_b_mi,(MEMRW d, IMM i))
{
emit_byte(0xc0);
emit_byte(0x05);
}
LENDFUNC(WRITE,RMW,2,raw_rol_b_mi,(MEMRW d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_rol_b_ri,(RW1 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_rol_b_ri,(RW1 r, IMM i))
{
emit_byte(0xc0);
emit_byte(0xc0+r);
}
LENDFUNC(WRITE,NONE,2,raw_rol_b_ri,(RW1 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_rol_w_ri,(RW2 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_rol_w_ri,(RW2 r, IMM i))
{
emit_byte(0x66);
emit_byte(0xc1);
}
LENDFUNC(WRITE,NONE,2,raw_rol_w_ri,(RW2 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_rol_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_rol_l_ri,(RW4 r, IMM i))
{
emit_byte(0xc1);
emit_byte(0xc0+r);
}
LENDFUNC(WRITE,NONE,2,raw_rol_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_rol_l_rr,(RW4 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_rol_l_rr,(RW4 d, R1 r))
{
emit_byte(0xd3);
emit_byte(0xc0+d);
}
LENDFUNC(WRITE,NONE,2,raw_rol_l_rr,(RW4 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_rol_w_rr,(RW2 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_rol_w_rr,(RW2 d, R1 r))
{
emit_byte(0x66);
emit_byte(0xd3);
}
LENDFUNC(WRITE,NONE,2,raw_rol_w_rr,(RW2 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_rol_b_rr,(RW1 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_rol_b_rr,(RW1 d, R1 r))
{
emit_byte(0xd2);
emit_byte(0xc0+d);
}
LENDFUNC(WRITE,NONE,2,raw_rol_b_rr,(RW1 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shll_l_rr,(RW4 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shll_l_rr,(RW4 d, R1 r))
{
emit_byte(0xd3);
emit_byte(0xe0+d);
}
LENDFUNC(WRITE,NONE,2,raw_shll_l_rr,(RW4 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shll_w_rr,(RW2 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shll_w_rr,(RW2 d, R1 r))
{
emit_byte(0x66);
emit_byte(0xd3);
}
LENDFUNC(WRITE,NONE,2,raw_shll_w_rr,(RW2 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shll_b_rr,(RW1 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shll_b_rr,(RW1 d, R1 r))
{
emit_byte(0xd2);
emit_byte(0xe0+d);
}
LENDFUNC(WRITE,NONE,2,raw_shll_b_rr,(RW1 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_ror_b_ri,(RW1 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_ror_b_ri,(RW1 r, IMM i))
{
emit_byte(0xc0);
emit_byte(0xc8+r);
}
LENDFUNC(WRITE,NONE,2,raw_ror_b_ri,(RW1 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_ror_w_ri,(RW2 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_ror_w_ri,(RW2 r, IMM i))
{
emit_byte(0x66);
emit_byte(0xc1);
}
LENDFUNC(WRITE,NONE,2,raw_ror_w_ri,(RW2 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_ror_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_ror_l_ri,(RW4 r, IMM i))
{
emit_byte(0xc1);
emit_byte(0xc8+r);
}
LENDFUNC(WRITE,NONE,2,raw_ror_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_ror_l_rr,(RW4 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_ror_l_rr,(RW4 d, R1 r))
{
emit_byte(0xd3);
emit_byte(0xc8+d);
}
LENDFUNC(WRITE,NONE,2,raw_ror_l_rr,(RW4 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_ror_w_rr,(RW2 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_ror_w_rr,(RW2 d, R1 r))
{
emit_byte(0x66);
emit_byte(0xd3);
}
LENDFUNC(WRITE,NONE,2,raw_ror_w_rr,(RW2 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_ror_b_rr,(RW1 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_ror_b_rr,(RW1 d, R1 r))
{
emit_byte(0xd2);
emit_byte(0xc8+d);
}
LENDFUNC(WRITE,NONE,2,raw_ror_b_rr,(RW1 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shrl_l_rr,(RW4 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shrl_l_rr,(RW4 d, R1 r))
{
emit_byte(0xd3);
emit_byte(0xe8+d);
}
LENDFUNC(WRITE,NONE,2,raw_shrl_l_rr,(RW4 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shrl_w_rr,(RW2 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shrl_w_rr,(RW2 d, R1 r))
{
emit_byte(0x66);
emit_byte(0xd3);
}
LENDFUNC(WRITE,NONE,2,raw_shrl_w_rr,(RW2 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shrl_b_rr,(RW1 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shrl_b_rr,(RW1 d, R1 r))
{
emit_byte(0xd2);
emit_byte(0xe8+d);
}
LENDFUNC(WRITE,NONE,2,raw_shrl_b_rr,(RW1 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shra_l_rr,(RW4 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shra_l_rr,(RW4 d, R1 r))
{
emit_byte(0xd3);
emit_byte(0xf8+d);
}
LENDFUNC(WRITE,NONE,2,raw_shra_l_rr,(RW4 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shra_w_rr,(RW2 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shra_w_rr,(RW2 d, R1 r))
{
emit_byte(0x66);
emit_byte(0xd3);
}
LENDFUNC(WRITE,NONE,2,raw_shra_w_rr,(RW2 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shra_b_rr,(RW1 d, R1 r))
+LOWFUNC(WRITE,NONE,2,raw_shra_b_rr,(RW1 d, R1 r))
{
emit_byte(0xd2);
emit_byte(0xf8+d);
}
LENDFUNC(WRITE,NONE,2,raw_shra_b_rr,(RW1 d, R1 r))
- LOWFUNC(WRITE,NONE,2,raw_shll_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shll_l_ri,(RW4 r, IMM i))
{
emit_byte(0xc1);
emit_byte(0xe0+r);
}
LENDFUNC(WRITE,NONE,2,raw_shll_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shll_w_ri,(RW2 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shll_w_ri,(RW2 r, IMM i))
{
emit_byte(0x66);
emit_byte(0xc1);
}
LENDFUNC(WRITE,NONE,2,raw_shll_w_ri,(RW2 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shll_b_ri,(RW1 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shll_b_ri,(RW1 r, IMM i))
{
emit_byte(0xc0);
emit_byte(0xe0+r);
}
LENDFUNC(WRITE,NONE,2,raw_shll_b_ri,(RW1 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shrl_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shrl_l_ri,(RW4 r, IMM i))
{
emit_byte(0xc1);
emit_byte(0xe8+r);
}
LENDFUNC(WRITE,NONE,2,raw_shrl_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shrl_w_ri,(RW2 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shrl_w_ri,(RW2 r, IMM i))
{
emit_byte(0x66);
emit_byte(0xc1);
}
LENDFUNC(WRITE,NONE,2,raw_shrl_w_ri,(RW2 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shrl_b_ri,(RW1 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shrl_b_ri,(RW1 r, IMM i))
{
emit_byte(0xc0);
emit_byte(0xe8+r);
}
LENDFUNC(WRITE,NONE,2,raw_shrl_b_ri,(RW1 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shra_l_ri,(RW4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shra_l_ri,(RW4 r, IMM i))
{
emit_byte(0xc1);
emit_byte(0xf8+r);
}
LENDFUNC(WRITE,NONE,2,raw_shra_l_ri,(RW4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shra_w_ri,(RW2 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shra_w_ri,(RW2 r, IMM i))
{
emit_byte(0x66);
emit_byte(0xc1);
}
LENDFUNC(WRITE,NONE,2,raw_shra_w_ri,(RW2 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_shra_b_ri,(RW1 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_shra_b_ri,(RW1 r, IMM i))
{
emit_byte(0xc0);
emit_byte(0xf8+r);
}
LENDFUNC(WRITE,NONE,2,raw_shra_b_ri,(RW1 r, IMM i))
- LOWFUNC(WRITE,NONE,1,raw_sahf,(R2 dummy_ah))
+LOWFUNC(WRITE,NONE,1,raw_sahf,(R2 dummy_ah))
{
emit_byte(0x9e);
}
LENDFUNC(WRITE,NONE,1,raw_sahf,(R2 dummy_ah))
- LOWFUNC(NONE,NONE,1,raw_cpuid,(R4 dummy_eax))
+LOWFUNC(NONE,NONE,1,raw_cpuid,(R4 dummy_eax))
{
emit_byte(0x0f);
emit_byte(0xa2);
}
LENDFUNC(NONE,NONE,1,raw_cpuid,(R4 dummy_eax))
- LOWFUNC(READ,NONE,1,raw_lahf,(W2 dummy_ah))
+LOWFUNC(READ,NONE,1,raw_lahf,(W2 dummy_ah))
{
emit_byte(0x9f);
}
LENDFUNC(READ,NONE,1,raw_lahf,(W2 dummy_ah))
- LOWFUNC(READ,NONE,2,raw_setcc,(W1 d, IMM cc))
+LOWFUNC(READ,NONE,2,raw_setcc,(W1 d, IMM cc))
{
emit_byte(0x0f);
emit_byte(0x90+cc);
}
LENDFUNC(READ,NONE,2,raw_setcc,(W1 d, IMM cc))
- LOWFUNC(READ,WRITE,2,raw_setcc_m,(MEMW d, IMM cc))
+LOWFUNC(READ,WRITE,2,raw_setcc_m,(MEMW d, IMM cc))
{
emit_byte(0x0f);
emit_byte(0x90+cc);
}
LENDFUNC(READ,WRITE,2,raw_setcc_m,(MEMW d, IMM cc))
- LOWFUNC(READ,NONE,3,raw_cmov_b_rr,(RW1 d, R1 s, IMM cc))
+LOWFUNC(READ,NONE,3,raw_cmov_b_rr,(RW1 d, R1 s, IMM cc))
{
/* replacement using branch and mov */
int uncc=(cc^1);
}
LENDFUNC(READ,NONE,3,raw_cmov_b_rr,(RW1 d, R1 s, IMM cc))
- LOWFUNC(READ,NONE,3,raw_cmov_w_rr,(RW2 d, R2 s, IMM cc))
+LOWFUNC(READ,NONE,3,raw_cmov_w_rr,(RW2 d, R2 s, IMM cc))
{
if (have_cmov) {
emit_byte(0x66);
}
LENDFUNC(READ,NONE,3,raw_cmov_w_rr,(RW2 d, R2 s, IMM cc))
- LOWFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
+LOWFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
{
if (have_cmov) {
emit_byte(0x0f);
}
LENDFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
- LOWFUNC(WRITE,NONE,2,raw_bsf_l_rr,(W4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_bsf_l_rr,(W4 d, R4 s))
{
emit_byte(0x0f);
emit_byte(0xbc);
}
LENDFUNC(WRITE,NONE,2,raw_bsf_l_rr,(W4 d, R4 s))
- LOWFUNC(NONE,NONE,2,raw_sign_extend_16_rr,(W4 d, R2 s))
+LOWFUNC(NONE,NONE,2,raw_sign_extend_16_rr,(W4 d, R2 s))
{
emit_byte(0x0f);
emit_byte(0xbf);
}
LENDFUNC(NONE,NONE,2,raw_sign_extend_16_rr,(W4 d, R2 s))
- LOWFUNC(NONE,NONE,2,raw_sign_extend_8_rr,(W4 d, R1 s))
+LOWFUNC(NONE,NONE,2,raw_sign_extend_8_rr,(W4 d, R1 s))
{
emit_byte(0x0f);
emit_byte(0xbe);
}
LENDFUNC(NONE,NONE,2,raw_sign_extend_8_rr,(W4 d, R1 s))
- LOWFUNC(NONE,NONE,2,raw_zero_extend_16_rr,(W4 d, R2 s))
+LOWFUNC(NONE,NONE,2,raw_zero_extend_16_rr,(W4 d, R2 s))
{
emit_byte(0x0f);
emit_byte(0xb7);
}
LENDFUNC(NONE,NONE,2,raw_zero_extend_16_rr,(W4 d, R2 s))
- LOWFUNC(NONE,NONE,2,raw_zero_extend_8_rr,(W4 d, R1 s))
+LOWFUNC(NONE,NONE,2,raw_zero_extend_8_rr,(W4 d, R1 s))
{
emit_byte(0x0f);
emit_byte(0xb6);
}
LENDFUNC(NONE,NONE,2,raw_zero_extend_8_rr,(W4 d, R1 s))
- LOWFUNC(NONE,NONE,2,raw_imul_32_32,(RW4 d, R4 s))
+LOWFUNC(NONE,NONE,2,raw_imul_32_32,(RW4 d, R4 s))
{
emit_byte(0x0f);
emit_byte(0xaf);
}
LENDFUNC(NONE,NONE,2,raw_imul_32_32,(RW4 d, R4 s))
- LOWFUNC(NONE,NONE,2,raw_imul_64_32,(RW4 d, RW4 s))
+LOWFUNC(NONE,NONE,2,raw_imul_64_32,(RW4 d, RW4 s))
{
#ifdef JIT_DEBUG
if (d!=MUL_NREG1 || s!=MUL_NREG2) {
}
LENDFUNC(NONE,NONE,2,raw_imul_64_32,(RW4 d, RW4 s))
- LOWFUNC(NONE,NONE,2,raw_mul_64_32,(RW4 d, RW4 s))
+LOWFUNC(NONE,NONE,2,raw_mul_64_32,(RW4 d, RW4 s))
{
#ifdef JIT_DEBUG
if (d!=MUL_NREG1 || s!=MUL_NREG2) {
}
LENDFUNC(NONE,NONE,2,raw_mul_64_32,(RW4 d, RW4 s))
- LOWFUNC(NONE,NONE,2,raw_mov_b_rr,(W1 d, R1 s))
+LOWFUNC(NONE,NONE,2,raw_mov_b_rr,(W1 d, R1 s))
{
emit_byte(0x88);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(NONE,NONE,2,raw_mov_b_rr,(W1 d, R1 s))
- LOWFUNC(NONE,NONE,2,raw_mov_w_rr,(W2 d, R2 s))
+LOWFUNC(NONE,NONE,2,raw_mov_w_rr,(W2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x89);
}
LENDFUNC(NONE,NONE,2,raw_mov_w_rr,(W2 d, R2 s))
- LOWFUNC(NONE,READ,3,raw_mov_l_rrm_indexed,(W4 d, R4 baser, R4 index))
+LOWFUNC(NONE,READ,3,raw_mov_l_rrm_indexed,(W4 d, R4 baser, R4 index))
{
emit_byte(0x8b);
if (baser==5) {
}
LENDFUNC(NONE,READ,3,raw_mov_l_rrm_indexed,(W4 d, R4 baser, R4 index))
- LOWFUNC(NONE,READ,3,raw_mov_w_rrm_indexed,(W2 d, R4 baser, R4 index))
+LOWFUNC(NONE,READ,3,raw_mov_w_rrm_indexed,(W2 d, R4 baser, R4 index))
{
emit_byte(0x66);
emit_byte(0x8b);
}
LENDFUNC(NONE,READ,3,raw_mov_w_rrm_indexed,(W2 d, R4 baser, R4 index))
- LOWFUNC(NONE,READ,3,raw_mov_b_rrm_indexed,(W1 d, R4 baser, R4 index))
+LOWFUNC(NONE,READ,3,raw_mov_b_rrm_indexed,(W1 d, R4 baser, R4 index))
{
emit_byte(0x8a);
if (baser==5) {
}
LENDFUNC(NONE,READ,3,raw_mov_b_rrm_indexed,(W1 d, R4 baser, R4 index))
- LOWFUNC(NONE,WRITE,3,raw_mov_l_mrr_indexed,(R4 baser, R4 index, R4 s))
+LOWFUNC(NONE,WRITE,3,raw_mov_l_mrr_indexed,(R4 baser, R4 index, R4 s))
{
emit_byte(0x89);
if (baser==5) {
}
LENDFUNC(NONE,WRITE,3,raw_mov_l_mrr_indexed,(R4 baser, R4 index, R4 s))
- LOWFUNC(NONE,WRITE,3,raw_mov_w_mrr_indexed,(R4 baser, R4 index, R2 s))
+LOWFUNC(NONE,WRITE,3,raw_mov_w_mrr_indexed,(R4 baser, R4 index, R2 s))
{
emit_byte(0x66);
emit_byte(0x89);
}
LENDFUNC(NONE,WRITE,3,raw_mov_w_mrr_indexed,(R4 baser, R4 index, R2 s))
- LOWFUNC(NONE,WRITE,3,raw_mov_b_mrr_indexed,(R4 baser, R4 index, R1 s))
+LOWFUNC(NONE,WRITE,3,raw_mov_b_mrr_indexed,(R4 baser, R4 index, R1 s))
{
emit_byte(0x88);
if (baser==5) {
}
LENDFUNC(NONE,WRITE,3,raw_mov_b_mrr_indexed,(R4 baser, R4 index, R1 s))
- LOWFUNC(NONE,READ,3,raw_mov_l_rm_indexed,(W4 d, IMM base, R4 index))
+LOWFUNC(NONE,READ,3,raw_mov_l_rm_indexed,(W4 d, IMM base, R4 index))
{
emit_byte(0x8b);
emit_byte(0x04+8*d);
}
LENDFUNC(NONE,READ,3,raw_mov_l_rm_indexed,(W4 d, IMM base, R4 index))
- LOWFUNC(NONE,READ,4,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM cond))
+LOWFUNC(NONE,READ,4,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM cond))
{
if (have_cmov) {
emit_byte(0x0f);
}
LENDFUNC(NONE,READ,4,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM cond))
- LOWFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond))
+LOWFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond))
{
if (have_cmov) {
emit_byte(0x0f);
}
LENDFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond))
- LOWFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d, R4 s, IMM offset))
+LOWFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d, R4 s, IMM offset))
{
emit_byte(0x8b);
emit_byte(0x40+8*d+s);
}
LENDFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d, R4 s, IMM offset))
- LOWFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d, R4 s, IMM offset))
+LOWFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d, R4 s, IMM offset))
{
emit_byte(0x66);
emit_byte(0x8b);
}
LENDFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d, R4 s, IMM offset))
- LOWFUNC(NONE,READ,3,raw_mov_b_rR,(W1 d, R4 s, IMM offset))
+LOWFUNC(NONE,READ,3,raw_mov_b_rR,(W1 d, R4 s, IMM offset))
{
emit_byte(0x8a);
emit_byte(0x40+8*d+s);
}
LENDFUNC(NONE,READ,3,raw_mov_b_rR,(W1 d, R4 s, IMM offset))
- LOWFUNC(NONE,READ,3,raw_mov_l_brR,(W4 d, R4 s, IMM offset))
+LOWFUNC(NONE,READ,3,raw_mov_l_brR,(W4 d, R4 s, IMM offset))
{
emit_byte(0x8b);
emit_byte(0x80+8*d+s);
}
LENDFUNC(NONE,READ,3,raw_mov_l_brR,(W4 d, R4 s, IMM offset))
- LOWFUNC(NONE,READ,3,raw_mov_w_brR,(W2 d, R4 s, IMM offset))
+LOWFUNC(NONE,READ,3,raw_mov_w_brR,(W2 d, R4 s, IMM offset))
{
emit_byte(0x66);
emit_byte(0x8b);
}
LENDFUNC(NONE,READ,3,raw_mov_w_brR,(W2 d, R4 s, IMM offset))
- LOWFUNC(NONE,READ,3,raw_mov_b_brR,(W1 d, R4 s, IMM offset))
+LOWFUNC(NONE,READ,3,raw_mov_b_brR,(W1 d, R4 s, IMM offset))
{
emit_byte(0x8a);
emit_byte(0x80+8*d+s);
}
LENDFUNC(NONE,READ,3,raw_mov_b_brR,(W1 d, R4 s, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d, IMM i, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d, IMM i, IMM offset))
{
emit_byte(0xc7);
emit_byte(0x40+d);
}
LENDFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d, IMM i, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d, IMM i, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d, IMM i, IMM offset))
{
emit_byte(0x66);
emit_byte(0xc7);
}
LENDFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d, IMM i, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d, IMM i, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d, IMM i, IMM offset))
{
emit_byte(0xc6);
emit_byte(0x40+d);
}
LENDFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d, IMM i, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d, R4 s, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d, R4 s, IMM offset))
{
emit_byte(0x89);
emit_byte(0x40+8*s+d);
}
LENDFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d, R4 s, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d, R2 s, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d, R2 s, IMM offset))
{
emit_byte(0x66);
emit_byte(0x89);
}
LENDFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d, R2 s, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_b_Rr,(R4 d, R1 s, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_b_Rr,(R4 d, R1 s, IMM offset))
{
emit_byte(0x88);
emit_byte(0x40+8*s+d);
}
LENDFUNC(NONE,WRITE,3,raw_mov_b_Rr,(R4 d, R1 s, IMM offset))
- LOWFUNC(NONE,NONE,3,raw_lea_l_brr,(W4 d, R4 s, IMM offset))
+LOWFUNC(NONE,NONE,3,raw_lea_l_brr,(W4 d, R4 s, IMM offset))
{
emit_byte(0x8d);
emit_byte(0x80+8*d+s);
}
LENDFUNC(NONE,NONE,3,raw_lea_l_brr,(W4 d, R4 s, IMM offset))
- LOWFUNC(NONE,NONE,5,raw_lea_l_brr_indexed,(W4 d, R4 s, R4 index, IMM factor, IMM offset))
+LOWFUNC(NONE,NONE,5,raw_lea_l_brr_indexed,(W4 d, R4 s, R4 index, IMM factor, IMM offset))
{
emit_byte(0x8d);
if (!offset) {
}
LENDFUNC(NONE,NONE,5,raw_lea_l_brr_indexed,(W4 d, R4 s, R4 index, IMM factor, IMM offset))
- LOWFUNC(NONE,NONE,3,raw_lea_l_rr_indexed,(W4 d, R4 s, R4 index))
+LOWFUNC(NONE,NONE,3,raw_lea_l_rr_indexed,(W4 d, R4 s, R4 index))
{
emit_byte(0x8d);
if (s==5) {
}
LENDFUNC(NONE,NONE,3,raw_lea_l_rr_indexed,(W4 d, R4 s, R4 index))
- LOWFUNC(NONE,WRITE,3,raw_mov_l_bRr,(R4 d, R4 s, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_l_bRr,(R4 d, R4 s, IMM offset))
{
emit_byte(0x89);
emit_byte(0x80+8*s+d);
}
LENDFUNC(NONE,WRITE,3,raw_mov_l_bRr,(R4 d, R4 s, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_w_bRr,(R4 d, R2 s, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_w_bRr,(R4 d, R2 s, IMM offset))
{
emit_byte(0x66);
emit_byte(0x89);
}
LENDFUNC(NONE,WRITE,3,raw_mov_w_bRr,(R4 d, R2 s, IMM offset))
- LOWFUNC(NONE,WRITE,3,raw_mov_b_bRr,(R4 d, R1 s, IMM offset))
+LOWFUNC(NONE,WRITE,3,raw_mov_b_bRr,(R4 d, R1 s, IMM offset))
{
emit_byte(0x88);
emit_byte(0x80+8*s+d);
}
LENDFUNC(NONE,WRITE,3,raw_mov_b_bRr,(R4 d, R1 s, IMM offset))
- LOWFUNC(NONE,NONE,1,raw_bswap_32,(RW4 r))
+LOWFUNC(NONE,NONE,1,raw_bswap_32,(RW4 r))
{
emit_byte(0x0f);
emit_byte(0xc8+r);
}
LENDFUNC(NONE,NONE,1,raw_bswap_32,(RW4 r))
- LOWFUNC(WRITE,NONE,1,raw_bswap_16,(RW2 r))
+LOWFUNC(WRITE,NONE,1,raw_bswap_16,(RW2 r))
{
emit_byte(0x66);
emit_byte(0xc1);
}
LENDFUNC(WRITE,NONE,1,raw_bswap_16,(RW2 r))
- LOWFUNC(NONE,NONE,2,raw_mov_l_rr,(W4 d, R4 s))
+LOWFUNC(NONE,NONE,2,raw_mov_l_rr,(W4 d, R4 s))
{
emit_byte(0x89);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(NONE,NONE,2,raw_mov_l_rr,(W4 d, R4 s))
- LOWFUNC(NONE,WRITE,2,raw_mov_l_mr,(IMM d, R4 s))
+LOWFUNC(NONE,WRITE,2,raw_mov_l_mr,(IMM d, R4 s))
{
emit_byte(0x89);
emit_byte(0x05+8*s);
}
LENDFUNC(NONE,WRITE,2,raw_mov_l_mr,(IMM d, R4 s))
- LOWFUNC(NONE,READ,2,raw_mov_l_rm,(W4 d, MEMR s))
+LOWFUNC(NONE,READ,2,raw_mov_l_rm,(W4 d, MEMR s))
{
emit_byte(0x8b);
emit_byte(0x05+8*d);
}
LENDFUNC(NONE,READ,2,raw_mov_l_rm,(W4 d, MEMR s))
- LOWFUNC(NONE,WRITE,2,raw_mov_w_mr,(IMM d, R2 s))
+LOWFUNC(NONE,WRITE,2,raw_mov_w_mr,(IMM d, R2 s))
{
emit_byte(0x66);
emit_byte(0x89);
}
LENDFUNC(NONE,WRITE,2,raw_mov_w_mr,(IMM d, R2 s))
- LOWFUNC(NONE,READ,2,raw_mov_w_rm,(W2 d, IMM s))
+LOWFUNC(NONE,READ,2,raw_mov_w_rm,(W2 d, IMM s))
{
emit_byte(0x66);
emit_byte(0x8b);
}
LENDFUNC(NONE,READ,2,raw_mov_w_rm,(W2 d, IMM s))
- LOWFUNC(NONE,WRITE,2,raw_mov_b_mr,(IMM d, R1 s))
+LOWFUNC(NONE,WRITE,2,raw_mov_b_mr,(IMM d, R1 s))
{
emit_byte(0x88);
emit_byte(0x05+8*s);
}
LENDFUNC(NONE,WRITE,2,raw_mov_b_mr,(IMM d, R1 s))
- LOWFUNC(NONE,READ,2,raw_mov_b_rm,(W1 d, IMM s))
+LOWFUNC(NONE,READ,2,raw_mov_b_rm,(W1 d, IMM s))
{
emit_byte(0x8a);
emit_byte(0x05+8*d);
}
LENDFUNC(NONE,READ,2,raw_mov_b_rm,(W1 d, IMM s))
- LOWFUNC(NONE,NONE,2,raw_mov_l_ri,(W4 d, IMM s))
+LOWFUNC(NONE,NONE,2,raw_mov_l_ri,(W4 d, IMM s))
{
emit_byte(0xb8+d);
emit_long(s);
}
LENDFUNC(NONE,NONE,2,raw_mov_l_ri,(W4 d, IMM s))
- LOWFUNC(NONE,NONE,2,raw_mov_w_ri,(W2 d, IMM s))
+LOWFUNC(NONE,NONE,2,raw_mov_w_ri,(W2 d, IMM s))
{
emit_byte(0x66);
emit_byte(0xb8+d);
}
LENDFUNC(NONE,NONE,2,raw_mov_w_ri,(W2 d, IMM s))
- LOWFUNC(NONE,NONE,2,raw_mov_b_ri,(W1 d, IMM s))
+LOWFUNC(NONE,NONE,2,raw_mov_b_ri,(W1 d, IMM s))
{
emit_byte(0xb0+d);
emit_byte(s);
}
LENDFUNC(NONE,NONE,2,raw_mov_b_ri,(W1 d, IMM s))
- LOWFUNC(RMW,RMW,2,raw_adc_l_mi,(MEMRW d, IMM s))
+LOWFUNC(RMW,RMW,2,raw_adc_l_mi,(MEMRW d, IMM s))
{
emit_byte(0x81);
emit_byte(0x15);
}
LENDFUNC(RMW,RMW,2,raw_adc_l_mi,(MEMRW d, IMM s))
- LOWFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
{
emit_byte(0x81);
emit_byte(0x05);
}
LENDFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
- LOWFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
{
emit_byte(0x66);
emit_byte(0x81);
}
LENDFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
- LOWFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
{
emit_byte(0x80);
emit_byte(0x05);
}
LENDFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
- LOWFUNC(WRITE,NONE,2,raw_test_l_ri,(R4 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_test_l_ri,(R4 d, IMM i))
{
emit_byte(0xf7);
emit_byte(0xc0+d);
}
LENDFUNC(WRITE,NONE,2,raw_test_l_ri,(R4 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_test_l_rr,(R4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_test_l_rr,(R4 d, R4 s))
{
emit_byte(0x85);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_test_l_rr,(R4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_test_w_rr,(R2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_test_w_rr,(R2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x85);
}
LENDFUNC(WRITE,NONE,2,raw_test_w_rr,(R2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_test_b_rr,(R1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_test_b_rr,(R1 d, R1 s))
{
emit_byte(0x84);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_test_b_rr,(R1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_and_l_ri,(RW4 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_and_l_ri,(RW4 d, IMM i))
{
emit_byte(0x81);
emit_byte(0xe0+d);
}
LENDFUNC(WRITE,NONE,2,raw_and_l_ri,(RW4 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_and_w_ri,(RW2 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_and_w_ri,(RW2 d, IMM i))
{
emit_byte(0x66);
emit_byte(0x81);
}
LENDFUNC(WRITE,NONE,2,raw_and_w_ri,(RW2 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_and_l,(RW4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_and_l,(RW4 d, R4 s))
{
emit_byte(0x21);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_and_l,(RW4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_and_w,(RW2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_and_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x21);
}
LENDFUNC(WRITE,NONE,2,raw_and_w,(RW2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_and_b,(RW1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_and_b,(RW1 d, R1 s))
{
emit_byte(0x20);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_and_b,(RW1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_or_l_ri,(RW4 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_or_l_ri,(RW4 d, IMM i))
{
emit_byte(0x81);
emit_byte(0xc8+d);
}
LENDFUNC(WRITE,NONE,2,raw_or_l_ri,(RW4 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_or_l,(RW4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_or_l,(RW4 d, R4 s))
{
emit_byte(0x09);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_or_l,(RW4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_or_w,(RW2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_or_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x09);
}
LENDFUNC(WRITE,NONE,2,raw_or_w,(RW2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_or_b,(RW1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_or_b,(RW1 d, R1 s))
{
emit_byte(0x08);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_or_b,(RW1 d, R1 s))
- LOWFUNC(RMW,NONE,2,raw_adc_l,(RW4 d, R4 s))
+LOWFUNC(RMW,NONE,2,raw_adc_l,(RW4 d, R4 s))
{
emit_byte(0x11);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(RMW,NONE,2,raw_adc_l,(RW4 d, R4 s))
- LOWFUNC(RMW,NONE,2,raw_adc_w,(RW2 d, R2 s))
+LOWFUNC(RMW,NONE,2,raw_adc_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x11);
}
LENDFUNC(RMW,NONE,2,raw_adc_w,(RW2 d, R2 s))
- LOWFUNC(RMW,NONE,2,raw_adc_b,(RW1 d, R1 s))
+LOWFUNC(RMW,NONE,2,raw_adc_b,(RW1 d, R1 s))
{
emit_byte(0x10);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(RMW,NONE,2,raw_adc_b,(RW1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_add_l,(RW4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_add_l,(RW4 d, R4 s))
{
emit_byte(0x01);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_add_l,(RW4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_add_w,(RW2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_add_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x01);
}
LENDFUNC(WRITE,NONE,2,raw_add_w,(RW2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_add_b,(RW1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_add_b,(RW1 d, R1 s))
{
emit_byte(0x00);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_add_b,(RW1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_sub_l_ri,(RW4 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_sub_l_ri,(RW4 d, IMM i))
{
if (isbyte(i)) {
emit_byte(0x83);
}
LENDFUNC(WRITE,NONE,2,raw_sub_l_ri,(RW4 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_sub_b_ri,(RW1 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_sub_b_ri,(RW1 d, IMM i))
{
emit_byte(0x80);
emit_byte(0xe8+d);
}
LENDFUNC(WRITE,NONE,2,raw_sub_b_ri,(RW1 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_add_l_ri,(RW4 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_add_l_ri,(RW4 d, IMM i))
{
if (isbyte(i)) {
emit_byte(0x83);
}
LENDFUNC(WRITE,NONE,2,raw_add_l_ri,(RW4 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_add_w_ri,(RW2 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_add_w_ri,(RW2 d, IMM i))
{
if (isbyte(i)) {
emit_byte(0x66);
}
LENDFUNC(WRITE,NONE,2,raw_add_w_ri,(RW2 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_add_b_ri,(RW1 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_add_b_ri,(RW1 d, IMM i))
{
emit_byte(0x80);
emit_byte(0xc0+d);
}
LENDFUNC(WRITE,NONE,2,raw_add_b_ri,(RW1 d, IMM i))
- LOWFUNC(RMW,NONE,2,raw_sbb_l,(RW4 d, R4 s))
+LOWFUNC(RMW,NONE,2,raw_sbb_l,(RW4 d, R4 s))
{
emit_byte(0x19);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(RMW,NONE,2,raw_sbb_l,(RW4 d, R4 s))
- LOWFUNC(RMW,NONE,2,raw_sbb_w,(RW2 d, R2 s))
+LOWFUNC(RMW,NONE,2,raw_sbb_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x19);
}
LENDFUNC(RMW,NONE,2,raw_sbb_w,(RW2 d, R2 s))
- LOWFUNC(RMW,NONE,2,raw_sbb_b,(RW1 d, R1 s))
+LOWFUNC(RMW,NONE,2,raw_sbb_b,(RW1 d, R1 s))
{
emit_byte(0x18);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(RMW,NONE,2,raw_sbb_b,(RW1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_sub_l,(RW4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_sub_l,(RW4 d, R4 s))
{
emit_byte(0x29);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_sub_l,(RW4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_sub_w,(RW2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_sub_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x29);
}
LENDFUNC(WRITE,NONE,2,raw_sub_w,(RW2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_sub_b,(RW1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_sub_b,(RW1 d, R1 s))
{
emit_byte(0x28);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_sub_b,(RW1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_cmp_l,(R4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_cmp_l,(R4 d, R4 s))
{
emit_byte(0x39);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_cmp_l,(R4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_cmp_l_ri,(R4 r, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_cmp_l_ri,(R4 r, IMM i))
{
emit_byte(0x81);
emit_byte(0xf8+r);
}
LENDFUNC(WRITE,NONE,2,raw_cmp_l_ri,(R4 r, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_cmp_w,(R2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_cmp_w,(R2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x39);
}
LENDFUNC(WRITE,NONE,2,raw_cmp_w,(R2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_cmp_b_ri,(R1 d, IMM i))
+LOWFUNC(WRITE,NONE,2,raw_cmp_b_ri,(R1 d, IMM i))
{
emit_byte(0x80);
emit_byte(0xf8+d);
}
LENDFUNC(WRITE,NONE,2,raw_cmp_b_ri,(R1 d, IMM i))
- LOWFUNC(WRITE,NONE,2,raw_cmp_b,(R1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_cmp_b,(R1 d, R1 s))
{
emit_byte(0x38);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_cmp_b,(R1 d, R1 s))
- LOWFUNC(WRITE,NONE,2,raw_xor_l,(RW4 d, R4 s))
+LOWFUNC(WRITE,NONE,2,raw_xor_l,(RW4 d, R4 s))
{
emit_byte(0x31);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_xor_l,(RW4 d, R4 s))
- LOWFUNC(WRITE,NONE,2,raw_xor_w,(RW2 d, R2 s))
+LOWFUNC(WRITE,NONE,2,raw_xor_w,(RW2 d, R2 s))
{
emit_byte(0x66);
emit_byte(0x31);
}
LENDFUNC(WRITE,NONE,2,raw_xor_w,(RW2 d, R2 s))
- LOWFUNC(WRITE,NONE,2,raw_xor_b,(RW1 d, R1 s))
+LOWFUNC(WRITE,NONE,2,raw_xor_b,(RW1 d, R1 s))
{
emit_byte(0x30);
emit_byte(0xc0+8*s+d);
}
LENDFUNC(WRITE,NONE,2,raw_xor_b,(RW1 d, R1 s))
- LOWFUNC(WRITE,RMW,2,raw_sub_l_mi,(MEMRW d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_sub_l_mi,(MEMRW d, IMM s))
{
emit_byte(0x81);
emit_byte(0x2d);
}
LENDFUNC(WRITE,RMW,2,raw_sub_l_mi,(MEMRW d, IMM s))
- LOWFUNC(WRITE,READ,2,raw_cmp_l_mi,(MEMR d, IMM s))
+LOWFUNC(WRITE,READ,2,raw_cmp_l_mi,(MEMR d, IMM s))
{
emit_byte(0x81);
emit_byte(0x3d);
}
LENDFUNC(WRITE,READ,2,raw_cmp_l_mi,(MEMR d, IMM s))
- LOWFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r1, RW4 r2))
+LOWFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r1, RW4 r2))
{
emit_byte(0x87);
emit_byte(0xc0+8*r1+r2);
}
LENDFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r1, RW4 r2))
- LOWFUNC(READ,WRITE,0,raw_pushfl,(void))
+LOWFUNC(READ,WRITE,0,raw_pushfl,(void))
{
emit_byte(0x9c);
}
LENDFUNC(READ,WRITE,0,raw_pushfl,(void))
- LOWFUNC(WRITE,READ,0,raw_popfl,(void))
+LOWFUNC(WRITE,READ,0,raw_popfl,(void))
{
emit_byte(0x9d);
}
LENDFUNC(WRITE,READ,0,raw_popfl,(void))
- /*************************************************************************
- * Unoptimizable stuff --- jump *
- *************************************************************************/
+/*************************************************************************
+ * Unoptimizable stuff --- jump *
+ *************************************************************************/
- STATIC_INLINE void raw_call_r(R4 r)
+static inline void raw_call_r(R4 r)
{
emit_byte(0xff);
emit_byte(0xd0+r);
}
-STATIC_INLINE void raw_jmp_r(R4 r)
+static inline void raw_jmp_r(R4 r)
{
emit_byte(0xff);
emit_byte(0xe0+r);
}
-STATIC_INLINE void raw_jmp_m_indexed(uae_u32 base, uae_u32 r, uae_u32 m)
+static inline void raw_jmp_m_indexed(uae_u32 base, uae_u32 r, uae_u32 m)
{
int sib;
emit_long(base);
}
-STATIC_INLINE void raw_jmp_m(uae_u32 base)
+static inline void raw_jmp_m(uae_u32 base)
{
emit_byte(0xff);
emit_byte(0x25);
emit_long(base);
}
-STATIC_INLINE void raw_call(uae_u32 t)
+static inline void raw_call(uae_u32 t)
{
emit_byte(0xe8);
emit_long(t-(uae_u32)target-4);
}
-STATIC_INLINE void raw_jmp(uae_u32 t)
+static inline void raw_jmp(uae_u32 t)
{
emit_byte(0xe9);
emit_long(t-(uae_u32)target-4);
}
-STATIC_INLINE void raw_jl(uae_u32 t)
+static inline void raw_jl(uae_u32 t)
{
emit_byte(0x0f);
emit_byte(0x8c);
- emit_long(t-(uae_u32)target-4);
+ emit_long(t-(uintptr)target-4);
}
-STATIC_INLINE void raw_jz(uae_u32 t)
+static inline void raw_jz(uae_u32 t)
{
emit_byte(0x0f);
emit_byte(0x84);
- emit_long(t-(uae_u32)target-4);
+ emit_long(t-(uintptr)target-4);
}
-STATIC_INLINE void raw_jnz(uae_u32 t)
+static inline void raw_jnz(uae_u32 t)
{
emit_byte(0x0f);
emit_byte(0x85);
- emit_long(t-(uae_u32)target-4);
+ emit_long(t-(uintptr)target-4);
}
-STATIC_INLINE void raw_jnz_l_oponly(void)
+static inline void raw_jnz_l_oponly(void)
{
emit_byte(0x0f);
emit_byte(0x85);
}
-STATIC_INLINE void raw_jcc_l_oponly(int cc)
+static inline void raw_jcc_l_oponly(int cc)
{
emit_byte(0x0f);
emit_byte(0x80+cc);
}
-STATIC_INLINE void raw_jnz_b_oponly(void)
+static inline void raw_jnz_b_oponly(void)
{
emit_byte(0x75);
}
-STATIC_INLINE void raw_jz_b_oponly(void)
+static inline void raw_jz_b_oponly(void)
{
emit_byte(0x74);
}
-STATIC_INLINE void raw_jmp_l_oponly(void)
+static inline void raw_jmp_l_oponly(void)
{
emit_byte(0xe9);
}
-STATIC_INLINE void raw_jmp_b_oponly(void)
+static inline void raw_jmp_b_oponly(void)
{
emit_byte(0xeb);
}
-STATIC_INLINE void raw_ret(void)
+static inline void raw_ret(void)
{
emit_byte(0xc3);
}
-STATIC_INLINE void raw_nop(void)
+static inline void raw_nop(void)
{
emit_byte(0x90);
}
#define FLAG_NREG1 0 /* Set to -1 if any register will do */
-STATIC_INLINE void raw_flags_to_reg(int r)
+static inline void raw_flags_to_reg(int r)
{
raw_lahf(0); /* Most flags in AH */
//raw_setcc(r,0); /* V flag in AL */
}
#define FLAG_NREG2 0 /* Set to -1 if any register will do */
-STATIC_INLINE void raw_reg_to_flags(int r)
+static inline void raw_reg_to_flags(int r)
{
raw_cmp_b_ri(r,-127); /* set V */
raw_sahf(0);
/* Apparently, there are enough instructions between flag store and
flag reload to avoid the partial memory stall */
-STATIC_INLINE void raw_load_flagreg(uae_u32 target, uae_u32 r)
+static inline void raw_load_flagreg(uae_u32 target, uae_u32 r)
{
#if 1
- raw_mov_l_rm(target,(uae_u32)live.state[r].mem);
+ raw_mov_l_rm(target,(uintptr)live.state[r].mem);
#else
- raw_mov_b_rm(target,(uae_u32)live.state[r].mem);
- raw_mov_b_rm(target+4,((uae_u32)live.state[r].mem)+1);
+ raw_mov_b_rm(target,(uintptr)live.state[r].mem);
+ raw_mov_b_rm(target+4,((uintptr)live.state[r].mem)+1);
#endif
}
/* FLAGX is word-sized */
-STATIC_INLINE void raw_load_flagx(uae_u32 target, uae_u32 r)
+static inline void raw_load_flagx(uae_u32 target, uae_u32 r)
{
if (live.nat[target].canword)
- raw_mov_w_rm(target,(uae_u32)live.state[r].mem);
+ raw_mov_w_rm(target,(uintptr)live.state[r].mem);
else
- raw_mov_l_rm(target,(uae_u32)live.state[r].mem);
+ raw_mov_l_rm(target,(uintptr)live.state[r].mem);
}
#define NATIVE_FLAG_Z 0x40
#define NATIVE_CC_EQ 4
-STATIC_INLINE void raw_flags_set_zero(int f, int r, int t)
+static inline void raw_flags_set_zero(int f, int r, int t)
{
// FIXME: this is really suboptimal
raw_pushfl();
raw_popfl();
}
-STATIC_INLINE void raw_inc_sp(int off)
+static inline void raw_inc_sp(int off)
{
raw_add_l_ri(4,off);
}
/*************************************************************************
-* Handling mistaken direct memory access *
-*************************************************************************/
+ * Handling mistaken direct memory access (removed from ARAnyM sources) *
+ *************************************************************************/
#ifdef UAE
#include "exception_handler.cpp"
#endif
+void compiler_status() {
+ jit_log("compiled code starts at %p, current at %08x", compiled_code, (unsigned int)(current_compile_p - compiled_code));
+}
/*************************************************************************
* Checking for CPU features *
X86_PROCESSOR_K6,
X86_PROCESSOR_ATHLON,
X86_PROCESSOR_PENTIUM4,
- X86_PROCESSOR_K8,
+ X86_PROCESSOR_X86_64,
X86_PROCESSOR_max
};
c->x86_vendor = X86_VENDOR_UNKNOWN;
}
-static void cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
+static void
+cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
{
const int CPUID_SPACE = 4096;
- uae_u8* cpuid_space = (uae_u8*)cache_alloc(CPUID_SPACE);
- if (cpuid_space == 0)
- abort ();
+ uae_u8* cpuid_space = (uae_u8 *)cache_alloc(CPUID_SPACE);
+ if (cpuid_space == 0) {
+ jit_abort("Could not allocate cpuid_space");
+ }
static uae_u32 s_op, s_eax, s_ebx, s_ecx, s_edx;
uae_u8* tmp=get_target();
cache_free (cpuid_space);
}
-static void raw_init_cpu(void)
+static void
+raw_init_cpu(void)
{
struct cpuinfo_x86 *c = &cpuinfo;
uae_u32 xlvl;
cpuid(0x80000000, &xlvl, NULL, NULL, NULL);
if ( (xlvl & 0xffff0000) == 0x80000000 ) {
if ( xlvl >= 0x80000001 ) {
- uae_u32 features;
- cpuid(0x80000001, NULL, NULL, NULL, &features);
+ uae_u32 features, extra_features;
+ cpuid(0x80000001, NULL, NULL, &extra_features, &features);
if (features & (1 << 29)) {
/* Assume x86-64 if long mode is supported */
- c->x86_processor = X86_PROCESSOR_K8;
+ c->x86_processor = X86_PROCESSOR_X86_64;
}
+ if (extra_features & (1 << 0))
+ have_lahf_lm = true;
}
}
/* Have CMOV support? */
have_cmov = c->x86_hwcap & (1 << 15);
-#if 0
/* Can the host CPU suffer from partial register stalls? */
have_rat_stall = (c->x86_vendor == X86_VENDOR_INTEL);
+#if 1
/* It appears that partial register writes are a bad idea even on
AMD K7 cores, even though they are not supposed to have the
dreaded rat stall. Why? Anyway, that's why we lie about it ;-) */
if (c->x86_processor == X86_PROCESSOR_ATHLON)
- have_rat_stall = 1;
+ have_rat_stall = true;
#endif
have_rat_stall = 1;
}
#if 0
-static int target_check_bsf(void)
+static bool target_check_bsf(void)
{
- int mismatch = 0;
+ bool mismatch = false;
for (int g_ZF = 0; g_ZF <= 1; g_ZF++) {
for (int g_CF = 0; g_CF <= 1; g_CF++) {
for (int g_OF = 0; g_OF <= 1; g_OF++) {
for (int g_SF = 0; g_SF <= 1; g_SF++) {
for (int value = -1; value <= 1; value++) {
unsigned long flags = (g_SF << 7) | (g_OF << 11) | (g_ZF << 6) | g_CF;
- unsigned long tmp = value;
+ long tmp = value;
__asm__ __volatile__ ("push %0; popf; bsf %1,%1; pushf; pop %0"
: "+r" (flags), "+r" (tmp) : : "cc");
int OF = (flags >> 11) & 1;
}
}}}}
if (mismatch)
- write_log (_T("Target CPU defines all flags on BSF instruction\n"));
+ jit_log("Target CPU defines all flags on BSF instruction");
return !mismatch;
}
#endif
-#if 0
-
-/*************************************************************************
-* Checking for CPU features *
-*************************************************************************/
-
-typedef struct {
- uae_u32 eax;
- uae_u32 ecx;
- uae_u32 edx;
- uae_u32 ebx;
-} x86_regs;
-
-
-/* This could be so much easier if it could make assumptions about the
-compiler... */
-
-static uae_u32 cpuid_ptr;
-static uae_u32 cpuid_level;
-
-static x86_regs cpuid(uae_u32 level)
-{
- x86_regs answer;
- uae_u8 *cpuid_space;
- void* tmp=get_target();
-
- cpuid_ptr=(uae_u32)&answer;
- cpuid_level=level;
-
- cpuid_space = cache_alloc (256);
- set_target(cpuid_space);
- raw_push_l_r(0); /* eax */
- raw_push_l_r(1); /* ecx */
- raw_push_l_r(2); /* edx */
- raw_push_l_r(3); /* ebx */
- raw_push_l_r(7); /* edi */
- raw_mov_l_rm(0,(uae_u32)&cpuid_level);
- raw_cpuid(0);
- raw_mov_l_rm(7,(uae_u32)&cpuid_ptr);
- raw_mov_l_Rr(7,0,0);
- raw_mov_l_Rr(7,1,4);
- raw_mov_l_Rr(7,2,8);
- raw_mov_l_Rr(7,3,12);
- raw_pop_l_r(7);
- raw_pop_l_r(3);
- raw_pop_l_r(2);
- raw_pop_l_r(1);
- raw_pop_l_r(0);
- raw_ret();
- set_target(tmp);
-
- ((cpuop_func*)cpuid_space)(0);
- cache_free (cpuid_space);
- return answer;
-}
-
-static void raw_init_cpu(void)
-{
- x86_regs x;
- uae_u32 maxlev;
-
- x=cpuid(0);
- maxlev=x.eax;
- write_log (_T("Max CPUID level=%d Processor is %c%c%c%c%c%c%c%c%c%c%c%c\n"),
- maxlev,
- x.ebx,
- x.ebx>>8,
- x.ebx>>16,
- x.ebx>>24,
- x.edx,
- x.edx>>8,
- x.edx>>16,
- x.edx>>24,
- x.ecx,
- x.ecx>>8,
- x.ecx>>16,
- x.ecx>>24
- );
- have_rat_stall=(x.ecx==0x6c65746e);
-
- if (maxlev>=1) {
- x=cpuid(1);
- if (x.edx&(1<<15))
- have_cmov=1;
- }
- have_rat_stall=1;
-#if 0
- if (!have_cmov)
- have_rat_stall=0;
-#endif
-#if 0
- write_log (_T("have_cmov=%d, avoid_cmov=%d, have_rat_stall=%d\n"),
- have_cmov,currprefs.avoid_cmov,have_rat_stall);
- if (currprefs.avoid_cmov) {
- write_log (_T("Disabling cmov use despite processor claiming to support it!\n"));
- have_cmov=0;
- }
-#else
- /* Dear Bernie, I don't want to keep around options which are useless, and not
- represented in the GUI anymore... Is this okay? */
- write_log (_T("have_cmov=%d, have_rat_stall=%d\n"), have_cmov, have_rat_stall);
-#endif
-#if 0 /* For testing of non-cmov code! */
- have_cmov=0;
-#endif
-#if 0 /* It appears that partial register writes are a bad idea even on
- AMD K7 cores, even though they are not supposed to have the
- dreaded rat stall. Why? Anyway, that's why we lie about it ;-) */
- if (have_cmov)
- have_rat_stall=1;
-#endif
-}
-#endif
-
/*************************************************************************
* FPU stuff *
*************************************************************************/
-STATIC_INLINE void raw_fp_init(void)
+static inline void raw_fp_init(void)
{
int i;
live.tos=-1; /* Stack is empty */
}
-STATIC_INLINE void raw_fp_cleanup_drop(void)
+static inline void raw_fp_cleanup_drop(void)
{
#if 0
/* using FINIT instead of popping all the entries.
raw_fp_init();
}
-STATIC_INLINE void make_tos(int r)
+static inline void make_tos(int r)
{
int p,q;
live.spos[q]=p;
}
-STATIC_INLINE int stackpos(int r)
+static inline int stackpos(int r)
{
if (live.spos[r]<0)
abort();
if (live.tos<live.spos[r]) {
- write_log (_T("JIT: Looking for spos for fnreg %d\n"),r);
- abort();
+ jit_abort("Looking for spos for fnreg %d",r);
}
return live.tos-live.spos[r];
}
an argument, because I would expect all arguments to be on the stack already, won't they?
Thus, usereg(s) is always useless and also for every FRW d it's too late here now. PeterK
*/
-STATIC_INLINE void usereg(int r)
+static inline void usereg(int r)
{
-
- if (live.spos[r]<0) {
- // write_log (_T("usereg wants to push reg %d onto the x87 stack calling make_tos\n"), r);
+ if (live.spos[r]<0)
make_tos(r);
- }
}
-/* This is called with one FP value in a reg *above* tos,
-which it will pop off the stack if necessary */
-STATIC_INLINE void tos_make(int r)
+/* This is called with one FP value in a reg *above* tos, which it will
+ pop off the stack if necessary */
+static inline void tos_make(int r)
{
if (live.spos[r]<0) {
live.tos++;
return;
}
emit_byte(0xdd);
- emit_byte(0xd8+(live.tos+1)-live.spos[r]);
- /* store top of stack in reg and pop it*/
+ emit_byte(0xd8+(live.tos+1)-live.spos[r]); /* store top of stack in reg,
+ and pop it*/
}
}
LENDFUNC(NONE,WRITE,2,raw_fmov_mr,(MEMW m, FR r))
- LOWFUNC(NONE,WRITE,2,raw_fmov_mr_drop,(MEMW m, FR r))
+LOWFUNC(NONE,WRITE,2,raw_fmov_mr_drop,(MEMW m, FR r))
{
make_tos(r);
emit_byte(0xdd);
}
LENDFUNC(NONE,WRITE,2,raw_fmov_mr,(MEMW m, FR r))
- LOWFUNC(NONE,READ,2,raw_fmov_rm,(FW r, MEMR m))
+LOWFUNC(NONE,READ,2,raw_fmov_rm,(FW r, MEMR m))
{
emit_byte(0xdd);
emit_byte(0x05);
}
LENDFUNC(NONE,READ,2,raw_fmov_rm,(FW r, MEMR m))
- LOWFUNC(NONE,READ,2,raw_fmovi_rm,(FW r, MEMR m))
+LOWFUNC(NONE,READ,2,raw_fmovi_rm,(FW r, MEMR m))
{
emit_byte(0xdb);
emit_byte(0x05);
}
LENDFUNC(NONE,READ,2,raw_fmovi_rm,(FW r, MEMR m))
- LOWFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMW m, FR r, double *bounds))
+LOWFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMW m, FR r, double *bounds))
{
/* Clamp value to the given range and convert to integer.
ideally, the clamping should be done using two FCMOVs, but
}
LENDFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMW m, FR r, double *bounds))
- LOWFUNC(NONE,READ,2,raw_fmovs_rm,(FW r, MEMR m))
+LOWFUNC(NONE,READ,2,raw_fmovs_rm,(FW r, MEMR m))
{
emit_byte(0xd9);
emit_byte(0x05);
}
LENDFUNC(NONE,READ,2,raw_fmovs_rm,(FW r, MEMR m))
- LOWFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r))
+LOWFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r))
{
make_tos(r);
emit_byte(0xd9);
}
LENDFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r))
- LOWFUNC(NONE,NONE,1,raw_fcuts_r,(FRW r))
+LOWFUNC(NONE,NONE,1,raw_fcuts_r,(FRW r))
{
make_tos(r); /* TOS = r */
emit_byte(0x83);
}
LENDFUNC(NONE,NONE,1,raw_fcuts_r,(FRW r))
- LOWFUNC(NONE,NONE,1,raw_fcut_r,(FRW r))
+LOWFUNC(NONE,NONE,1,raw_fcut_r,(FRW r))
{
make_tos(r); /* TOS = r */
emit_byte(0x83);
}
LENDFUNC(NONE,NONE,1,raw_fcut_r,(FRW r))
- LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r))
+LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r))
{
int rs;
}
LENDFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r))
- LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr_drop,(MEMW m, FR r))
+LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr_drop,(MEMW m, FR r))
{
make_tos(r);
emit_byte(0xdb); /* store and pop it */
}
LENDFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r))
- LOWFUNC(NONE,READ,2,raw_fmov_ext_rm,(FW r, MEMR m))
+LOWFUNC(NONE,READ,2,raw_fmov_ext_rm,(FW r, MEMR m))
{
emit_byte(0xdb);
emit_byte(0x2d);
}
LENDFUNC(NONE,READ,2,raw_fmov_ext_rm,(FW r, MEMR m))
- LOWFUNC(NONE,NONE,1,raw_fmov_pi,(FW r))
+LOWFUNC(NONE,NONE,1,raw_fmov_pi,(FW r))
{
emit_byte(0xd9);
emit_byte(0xeb);
}
LENDFUNC(NONE,NONE,1,raw_fmov_pi,(FW r))
- LOWFUNC(NONE,NONE,1,raw_fmov_log10_2,(FW r))
+LOWFUNC(NONE,NONE,1,raw_fmov_log10_2,(FW r))
{
emit_byte(0xd9);
emit_byte(0xec);
}
LENDFUNC(NONE,NONE,1,raw_fmov_log10_2,(FW r))
- LOWFUNC(NONE,NONE,1,raw_fmov_log2_e,(FW r))
+LOWFUNC(NONE,NONE,1,raw_fmov_log2_e,(FW r))
{
emit_byte(0xd9);
emit_byte(0xea);
}
LENDFUNC(NONE,NONE,1,raw_fmov_log2_e,(FW r))
- LOWFUNC(NONE,NONE,1,raw_fmov_loge_2,(FW r))
+LOWFUNC(NONE,NONE,1,raw_fmov_loge_2,(FW r))
{
emit_byte(0xd9);
emit_byte(0xed);
}
LENDFUNC(NONE,NONE,1,raw_fmov_loge_2,(FW r))
- LOWFUNC(NONE,NONE,1,raw_fmov_1,(FW r))
+LOWFUNC(NONE,NONE,1,raw_fmov_1,(FW r))
{
emit_byte(0xd9);
emit_byte(0xe8);
}
LENDFUNC(NONE,NONE,1,raw_fmov_1,(FW r))
- LOWFUNC(NONE,NONE,1,raw_fmov_0,(FW r))
+LOWFUNC(NONE,NONE,1,raw_fmov_0,(FW r))
{
emit_byte(0xd9);
emit_byte(0xee);
}
LENDFUNC(NONE,NONE,1,raw_fmov_0,(FW r))
- LOWFUNC(NONE,NONE,2,raw_fmov_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fmov_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fmov_rr,(FW d, FR s))
- LOWFUNC(NONE,READ,2,raw_fldcw_m_indexed,(R4 index, IMM base))
+LOWFUNC(NONE,READ,2,raw_fldcw_m_indexed,(R4 index, IMM base))
{
emit_byte(0xd9);
emit_byte(0xa8+index);
}
LENDFUNC(NONE,READ,2,raw_fldcw_m_indexed,(R4 index, IMM base))
- LOWFUNC(NONE,NONE,2,raw_fsqrt_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fsqrt_rr,(FW d, FR s))
{
int ds;
if (d!=s) {
ds=stackpos(s);
emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld x */
+ emit_byte(0xc0+ds); /* duplicate source */
emit_byte(0xd9);
- emit_byte(0xfa); /* fsqrt sqrt(x) */
+ emit_byte(0xfa); /* take square root */
tos_make(d); /* store to destination */
}
else {
make_tos(d);
emit_byte(0xd9);
- emit_byte(0xfa); /* fsqrt y=sqrt(x) */
+ emit_byte(0xfa); /* take square root */
}
}
LENDFUNC(NONE,NONE,2,raw_fsqrt_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fabs_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fabs_rr,(FW d, FR s))
{
int ds;
if (d!=s) {
ds=stackpos(s);
emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld x */
+ emit_byte(0xc0+ds); /* duplicate source */
emit_byte(0xd9);
- emit_byte(0xe1); /* fabs abs(x) */
+ emit_byte(0xe1); /* take fabs */
tos_make(d); /* store to destination */
}
else {
make_tos(d);
emit_byte(0xd9);
- emit_byte(0xe1); /* fabs y=abs(x) */
+ emit_byte(0xe1); /* take fabs */
}
}
LENDFUNC(NONE,NONE,2,raw_fabs_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_frndint_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_frndint_rr,(FW d, FR s))
{
int ds;
if (d!=s) {
ds=stackpos(s);
emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld x */
+ emit_byte(0xc0+ds); /* duplicate source */
emit_byte(0xd9);
- emit_byte(0xfc); /* frndint int(x) */
+ emit_byte(0xfc); /* take frndint */
tos_make(d); /* store to destination */
}
else {
make_tos(d);
emit_byte(0xd9);
- emit_byte(0xfc); /* frndint y=int(x) */
+ emit_byte(0xfc); /* take frndint */
}
}
LENDFUNC(NONE,NONE,2,raw_frndint_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fgetexp_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fgetexp_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fgetexp_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fgetman_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fgetman_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fgetman_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fsin_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fsin_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fsin_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fcos_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fcos_rr,(FW d, FR s))
{
int ds;
if (d!=s) {
ds=stackpos(s);
emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld x */
+ emit_byte(0xc0+ds); /* duplicate source */
emit_byte(0xd9);
- emit_byte(0xff); /* fcos cos(x) */
+ emit_byte(0xff); /* take cos */
tos_make(d); /* store to destination */
}
else {
make_tos(d);
emit_byte(0xd9);
- emit_byte(0xff); /* fcos y=cos(x) */
+ emit_byte(0xff); /* take cos */
}
}
LENDFUNC(NONE,NONE,2,raw_fcos_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_ftan_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_ftan_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_ftan_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,3,raw_fsincos_rr,(FW d, FW c, FR s))
+LOWFUNC(NONE,NONE,3,raw_fsincos_rr,(FW d, FW c, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fscale_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_ftwotox_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_ftwotox_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_ftwotox_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fetox_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fetox_rr,(FW d, FR s))
{
int ds;
else {
ds=stackpos(s);
emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld x */
+ emit_byte(0xc0+ds); /* duplicate source */
}
emit_byte(0xd9);
emit_byte(0xea); /* fldl2e log2(e) */
}
LENDFUNC(NONE,NONE,2,raw_fetox_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fetoxM1_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fetoxM1_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fetoxM1_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_ftentox_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_ftentox_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_ftentox_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_flog2_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_flog2_rr,(FW d, FR s))
{
int ds;
else {
ds=stackpos(s);
emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld x */
+ emit_byte(0xc0+ds); /* duplicate source */
}
emit_byte(0xd9);
- emit_byte(0xe8); /* fld1 1 */
+ emit_byte(0xe8); /* push '1' */
emit_byte(0xd9);
- emit_byte(0xc9); /* fxch swap 1 with x */
+ emit_byte(0xc9); /* swap top two */
emit_byte(0xd9);
- emit_byte(0xf1); /* fyl2x 1*log2(x) */
+ emit_byte(0xf1); /* take 1*log2(x) */
if (s!=d)
- tos_make(d); /* store y=log2(x) */
+ tos_make(d); /* store to destination */
}
LENDFUNC(NONE,NONE,2,raw_flog2_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_flogN_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_flogN_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_flogN_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_flogNP1_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_flogNP1_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_flogNP1_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_flog10_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_flog10_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_flog10_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fasin_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fasin_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_facos_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fatan_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fatan_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fatan_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fatanh_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fatanh_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fatanh_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
{
int ds,tr;
}
LENDFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
{
int ds,tr;
}
LENDFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
{
int ds,tr;
}
LENDFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fneg_rr,(FW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fneg_rr,(FW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fneg_rr,(FW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fadd_rr,(FRW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fadd_rr,(FRW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fadd_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fsub_rr,(FRW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fsub_rr,(FRW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fsub_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fcmp_rr,(FR d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fcmp_rr,(FR d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fcmp_rr,(FR d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fmul_rr,(FRW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fmul_rr,(FRW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fmul_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_fdiv_rr,(FRW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_fdiv_rr,(FRW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_fdiv_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_frem_rr,(FRW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_frem_rr,(FRW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_frem_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,2,raw_frem1_rr,(FRW d, FR s))
+LOWFUNC(NONE,NONE,2,raw_frem1_rr,(FRW d, FR s))
{
int ds;
}
LENDFUNC(NONE,NONE,2,raw_frem1_rr,(FRW d, FR s))
- LOWFUNC(NONE,NONE,1,raw_ftst_r,(FR r))
+LOWFUNC(NONE,NONE,1,raw_ftst_r,(FR r))
{
make_tos(r);
emit_byte(0xd9); /* ftst */
}
LENDFUNC(NONE,NONE,1,raw_ftst_r,(FR r))
- STATIC_INLINE void raw_fflags_into_flags(int r)
+static inline void raw_fflags_into_flags(int r)
{
int p;