@@ -59,6 +59,21 @@ struct _emit_inline_asm_t {
5959 qstr * label_lookup ;
6060};
6161
62+ #if MICROPY_DYNAMIC_COMPILER
63+
64+ static inline bool emit_inline_thumb_allow_float (emit_inline_asm_t * emit ) {
65+ return MP_NATIVE_ARCH_ARMV7EMSP <= mp_dynamic_compiler .native_arch
66+ && mp_dynamic_compiler .native_arch <= MP_NATIVE_ARCH_ARMV7EMDP ;
67+ }
68+
69+ #else
70+
71+ static inline bool emit_inline_thumb_allow_float (emit_inline_asm_t * emit ) {
72+ return MICROPY_EMIT_INLINE_THUMB_FLOAT ;
73+ }
74+
75+ #endif
76+
6277STATIC void emit_inline_thumb_error_msg (emit_inline_asm_t * emit , mp_rom_error_text_t msg ) {
6378 * emit -> error_slot = mp_obj_new_exception_msg (& mp_type_SyntaxError , msg );
6479}
@@ -216,7 +231,6 @@ STATIC mp_uint_t get_arg_special_reg(emit_inline_asm_t *emit, const char *op, mp
216231 return 0 ;
217232}
218233
219- #if MICROPY_EMIT_INLINE_THUMB_FLOAT
220234STATIC mp_uint_t get_arg_vfpreg (emit_inline_asm_t * emit , const char * op , mp_parse_node_t pn ) {
221235 const char * reg_str = get_arg_str (pn );
222236 if (reg_str [0 ] == 's' && reg_str [1 ] != '\0' ) {
@@ -243,7 +257,6 @@ STATIC mp_uint_t get_arg_vfpreg(emit_inline_asm_t *emit, const char *op, mp_pars
243257 MP_ERROR_TEXT ("'%s' expects an FPU register" ), op ));
244258 return 0 ;
245259}
246- #endif
247260
248261STATIC mp_uint_t get_arg_reglist (emit_inline_asm_t * emit , const char * op , mp_parse_node_t pn ) {
249262 // a register list looks like {r0, r1, r2} and is parsed as a Python set
@@ -409,18 +422,17 @@ STATIC const format_9_10_op_t format_9_10_op_table[] = {
409422};
410423#undef X
411424
412- #if MICROPY_EMIT_INLINE_THUMB_FLOAT
413425// actual opcodes are: 0xee00 | op.hi_nibble, 0x0a00 | op.lo_nibble
414- typedef struct _format_vfp_op_t { byte op ;
415- char name [3 ];
426+ typedef struct _format_vfp_op_t {
427+ byte op ;
428+ char name [3 ];
416429} format_vfp_op_t ;
417430STATIC const format_vfp_op_t format_vfp_op_table [] = {
418431 { 0x30 , "add" },
419432 { 0x34 , "sub" },
420433 { 0x20 , "mul" },
421434 { 0x80 , "div" },
422435};
423- #endif
424436
425437// shorthand alias for whether we allow ARMv7-M instructions
426438#define ARMV7M asm_thumb_allow_armv7m(&emit->as)
@@ -439,8 +451,7 @@ STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_a
439451 size_t op_len ;
440452 const char * op_str = (const char * )qstr_data (op , & op_len );
441453
442- #if MICROPY_EMIT_INLINE_THUMB_FLOAT
443- if (op_str [0 ] == 'v' ) {
454+ if (emit_inline_thumb_allow_float (emit ) && op_str [0 ] == 'v' ) {
444455 // floating point operations
445456 if (n_args == 2 ) {
446457 mp_uint_t op_code = 0x0ac0 , op_code_hi ;
@@ -535,7 +546,6 @@ STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_a
535546 }
536547 return ;
537548 }
538- #endif
539549
540550 if (n_args == 0 ) {
541551 if (op == MP_QSTR_nop ) {
0 commit comments