Second take on fixing ARM64 MMX opcodes

This commit is contained in:
Cacodemon345
2025-11-04 17:05:16 +06:00
parent c00a82c58c
commit 93d478691f
3 changed files with 25 additions and 8 deletions

View File

@@ -660,6 +660,9 @@ uop_gen_reg_src2_pointer(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int sr
uop->p = p;
}
extern int codegen_mmx_enter(void);
extern int codegen_fp_enter(void);
#define uop_LOAD_FUNC_ARG_REG(ir, arg, reg) uop_gen_reg_src1(UOP_LOAD_FUNC_ARG_0 + arg, ir, reg)
#define uop_LOAD_FUNC_ARG_IMM(ir, arg, imm) uop_gen_imm(UOP_LOAD_FUNC_ARG_0_IMM + arg, ir, imm)
@@ -726,15 +729,19 @@ uop_gen_reg_src2_pointer(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int sr
#define uop_FP_ENTER(ir) \
do { \
if (!codegen_fpu_entered) \
uop_gen_imm(UOP_FP_ENTER, ir, cpu_state.oldpc); \
if (!codegen_fpu_entered) { \
uop_CALL_FUNC_RESULT(ir, IREG_temp0, codegen_fp_enter); \
uop_CMP_IMM_JZ(ir, IREG_temp0, 1, codegen_exit_rout); \
} \
codegen_fpu_entered = 1; \
codegen_mmx_entered = 0; \
} while (0)
#define uop_MMX_ENTER(ir) \
do { \
if (!codegen_mmx_entered) \
uop_gen_imm(UOP_MMX_ENTER, ir, cpu_state.oldpc); \
if (!codegen_mmx_entered) { \
uop_CALL_FUNC_RESULT(ir, IREG_temp0, codegen_mmx_enter); \
uop_CMP_IMM_JZ(ir, IREG_temp0, 1, codegen_exit_rout); \
} \
codegen_mmx_entered = 1; \
codegen_fpu_entered = 0; \
} while (0)

View File

@@ -114,10 +114,6 @@ int codegen_can_unroll_full(codeblock_t *block, ir_data_t *ir, uint32_t next_pc,
static inline int
codegen_can_unroll(codeblock_t *block, ir_data_t *ir, uint32_t next_pc, uint32_t dest_addr)
{
/* TODO: Re-enable this again after fixing mysterious crashes on ARM64 with MMX instructions used. */
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
return 0;
#endif
if (block->flags & CODEBLOCK_BYTE_MASK)
return 0;

View File

@@ -242,6 +242,20 @@ static uint64_t tsc_old = 0;
int32_t acycs = 0;
# endif
int
codegen_mmx_enter(void)
{
MMX_ENTER();
return 0;
}
int
codegen_fp_enter(void)
{
FP_ENTER();
return 0;
}
void
update_tsc(void)
{