@@ -297,12 +297,8 @@ bool asm_thumb_b_n_label(asm_thumb_t *as, uint label) {
297297 mp_uint_t dest = get_label_dest (as , label );
298298 mp_int_t rel = dest - as -> code_offset ;
299299 rel -= 4 ; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
300- if (SIGNED_FIT12 (rel )) {
301- asm_thumb_op16 (as , OP_B_N (rel ));
302- return true;
303- } else {
304- return false;
305- }
300+ asm_thumb_op16 (as , OP_B_N (rel ));
301+ return as -> pass != ASM_THUMB_PASS_EMIT || SIGNED_FIT12 (rel );
306302}
307303
308304#define OP_BCC_N (cond , byte_offset ) (0xd000 | ((cond) << 8) | (((byte_offset) >> 1) & 0x00ff))
@@ -316,12 +312,8 @@ bool asm_thumb_bcc_nw_label(asm_thumb_t *as, int cond, uint label, bool wide) {
316312 mp_int_t rel = dest - as -> code_offset ;
317313 rel -= 4 ; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
318314 if (!wide ) {
319- if (SIGNED_FIT9 (rel )) {
320- asm_thumb_op16 (as , OP_BCC_N (cond , rel ));
321- return true;
322- } else {
323- return false;
324- }
315+ asm_thumb_op16 (as , OP_BCC_N (cond , rel ));
316+ return as -> pass != ASM_THUMB_PASS_EMIT || SIGNED_FIT9 (rel );
325317 } else {
326318 asm_thumb_op32 (as , OP_BCC_W_HI (cond , rel ), OP_BCC_W_LO (rel ));
327319 return true;
@@ -335,12 +327,8 @@ bool asm_thumb_bl_label(asm_thumb_t *as, uint label) {
335327 mp_uint_t dest = get_label_dest (as , label );
336328 mp_int_t rel = dest - as -> code_offset ;
337329 rel -= 4 ; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
338- if (SIGNED_FIT23 (rel )) {
339- asm_thumb_op32 (as , OP_BL_HI (rel ), OP_BL_LO (rel ));
340- return true;
341- } else {
342- return false;
343- }
330+ asm_thumb_op32 (as , OP_BL_HI (rel ), OP_BL_LO (rel ));
331+ return as -> pass != ASM_THUMB_PASS_EMIT || SIGNED_FIT23 (rel );
344332}
345333
346334void asm_thumb_mov_reg_i32 (asm_thumb_t * as , uint reg_dest , mp_uint_t i32 ) {
0 commit comments