mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
py/asmthumb: Make ARMv7-M instruction use dynamically selectable.
This commit adjusts the asm_thumb_xxx functions so they can be dynamically configured to use ARMv7-M instructions or not. This is available when MICROPY_DYNAMIC_COMPILER is enabled, and then controlled by the value of mp_dynamic_compiler.native_arch. If MICROPY_DYNAMIC_COMPILER is disabled the previous behaviour is retained: the functions emit ARMv7-M instructions only if MICROPY_EMIT_THUMB_ARMV7M is enabled. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -2421,48 +2421,48 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
|
||||
asm_x86_setcc_r8(emit->as, ops[op_idx], REG_RET);
|
||||
#elif N_THUMB
|
||||
asm_thumb_cmp_rlo_rlo(emit->as, REG_ARG_2, reg_rhs);
|
||||
#if MICROPY_EMIT_THUMB_ARMV7M
|
||||
static uint16_t ops[6 + 6] = {
|
||||
// unsigned
|
||||
ASM_THUMB_OP_ITE_CC,
|
||||
ASM_THUMB_OP_ITE_HI,
|
||||
ASM_THUMB_OP_ITE_EQ,
|
||||
ASM_THUMB_OP_ITE_LS,
|
||||
ASM_THUMB_OP_ITE_CS,
|
||||
ASM_THUMB_OP_ITE_NE,
|
||||
// signed
|
||||
ASM_THUMB_OP_ITE_LT,
|
||||
ASM_THUMB_OP_ITE_GT,
|
||||
ASM_THUMB_OP_ITE_EQ,
|
||||
ASM_THUMB_OP_ITE_LE,
|
||||
ASM_THUMB_OP_ITE_GE,
|
||||
ASM_THUMB_OP_ITE_NE,
|
||||
};
|
||||
asm_thumb_op16(emit->as, ops[op_idx]);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 1);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 0);
|
||||
#else
|
||||
static uint16_t ops[6 + 6] = {
|
||||
// unsigned
|
||||
ASM_THUMB_CC_CC,
|
||||
ASM_THUMB_CC_HI,
|
||||
ASM_THUMB_CC_EQ,
|
||||
ASM_THUMB_CC_LS,
|
||||
ASM_THUMB_CC_CS,
|
||||
ASM_THUMB_CC_NE,
|
||||
// signed
|
||||
ASM_THUMB_CC_LT,
|
||||
ASM_THUMB_CC_GT,
|
||||
ASM_THUMB_CC_EQ,
|
||||
ASM_THUMB_CC_LE,
|
||||
ASM_THUMB_CC_GE,
|
||||
ASM_THUMB_CC_NE,
|
||||
};
|
||||
asm_thumb_bcc_rel9(emit->as, ops[op_idx], 6);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 0);
|
||||
asm_thumb_b_rel12(emit->as, 4);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 1);
|
||||
#endif
|
||||
if (asm_thumb_allow_armv7m(emit->as)) {
|
||||
static uint16_t ops[6 + 6] = {
|
||||
// unsigned
|
||||
ASM_THUMB_OP_ITE_CC,
|
||||
ASM_THUMB_OP_ITE_HI,
|
||||
ASM_THUMB_OP_ITE_EQ,
|
||||
ASM_THUMB_OP_ITE_LS,
|
||||
ASM_THUMB_OP_ITE_CS,
|
||||
ASM_THUMB_OP_ITE_NE,
|
||||
// signed
|
||||
ASM_THUMB_OP_ITE_LT,
|
||||
ASM_THUMB_OP_ITE_GT,
|
||||
ASM_THUMB_OP_ITE_EQ,
|
||||
ASM_THUMB_OP_ITE_LE,
|
||||
ASM_THUMB_OP_ITE_GE,
|
||||
ASM_THUMB_OP_ITE_NE,
|
||||
};
|
||||
asm_thumb_op16(emit->as, ops[op_idx]);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 1);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 0);
|
||||
} else {
|
||||
static uint16_t ops[6 + 6] = {
|
||||
// unsigned
|
||||
ASM_THUMB_CC_CC,
|
||||
ASM_THUMB_CC_HI,
|
||||
ASM_THUMB_CC_EQ,
|
||||
ASM_THUMB_CC_LS,
|
||||
ASM_THUMB_CC_CS,
|
||||
ASM_THUMB_CC_NE,
|
||||
// signed
|
||||
ASM_THUMB_CC_LT,
|
||||
ASM_THUMB_CC_GT,
|
||||
ASM_THUMB_CC_EQ,
|
||||
ASM_THUMB_CC_LE,
|
||||
ASM_THUMB_CC_GE,
|
||||
ASM_THUMB_CC_NE,
|
||||
};
|
||||
asm_thumb_bcc_rel9(emit->as, ops[op_idx], 6);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 0);
|
||||
asm_thumb_b_rel12(emit->as, 4);
|
||||
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 1);
|
||||
}
|
||||
#elif N_ARM
|
||||
asm_arm_cmp_reg_reg(emit->as, REG_ARG_2, reg_rhs);
|
||||
static uint ccs[6 + 6] = {
|
||||
|
||||
Reference in New Issue
Block a user