@@ -475,7 +475,7 @@ STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_a
475
475
reg_src = get_arg_reg (emit , op_str , pn_args [1 ], 7 );
476
476
asm_thumb_format_4 (emit -> as , op_code , reg_dest , reg_src );
477
477
}
478
- // search table
478
+ // search table for ALU ops
479
479
for (mp_uint_t i = 0 ; i < MP_ARRAY_SIZE (format_4_op_table ); i ++ ) {
480
480
if (strncmp (op_str , format_4_op_table [i ].name , 3 ) == 0 && op_str [3 ] == '\0' ) {
481
481
op_code = 0x4000 | (format_4_op_table [i ].op << 4 );
@@ -504,13 +504,15 @@ STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_a
504
504
op_code = ASM_THUMB_FORMAT_3_SUB ;
505
505
goto op_format_3 ;
506
506
} else if (strcmp (op_str , "movw" ) == 0 ) {
507
- mp_uint_t reg_dest = get_arg_reg (emit , op_str , pn_args [0 ], 15 );
507
+ op_code = ASM_THUMB_OP_MOVW ;
508
+ mp_uint_t reg_dest ;
509
+ op_movw_movt :
510
+ reg_dest = get_arg_reg (emit , op_str , pn_args [0 ], 15 );
508
511
int i_src = get_arg_i (emit , op_str , pn_args [1 ], 0xffff );
509
- asm_thumb_mov_reg_i16 (emit -> as , ASM_THUMB_OP_MOVW , reg_dest , i_src );
512
+ asm_thumb_mov_reg_i16 (emit -> as , op_code , reg_dest , i_src );
510
513
} else if (strcmp (op_str , "movt" ) == 0 ) {
511
- mp_uint_t reg_dest = get_arg_reg (emit , op_str , pn_args [0 ], 15 );
512
- int i_src = get_arg_i (emit , op_str , pn_args [1 ], 0xffff );
513
- asm_thumb_mov_reg_i16 (emit -> as , ASM_THUMB_OP_MOVT , reg_dest , i_src );
514
+ op_code = ASM_THUMB_OP_MOVT ;
515
+ goto op_movw_movt ;
514
516
} else if (strcmp (op_str , "movwt" ) == 0 ) {
515
517
// this is a convenience instruction
516
518
// we clear the MSB since it might be set from extracting the small int value
0 commit comments