summaryrefslogtreecommitdiff
path: root/py/asmthumb.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-08-04 22:03:49 +1000
committerDamien George <damien.p.george@gmail.com>2018-08-04 22:03:49 +1000
commit10830059c5d3651abdb2d3532b28a9bb0a9425ee (patch)
treedb4c54f5f9d54d5833546e345c23f08f1adc1df0 /py/asmthumb.h
parent4b1e8bdebdf5feb48a51dbf1e584735395069384 (diff)
py/emitnative: Fix x86 native zero checks by comparing full word.
On x86 archs (both 32 and 64 bit) a bool return value only sets the 8-bit al register, and the higher bits of the ax register have an undefined value. When testing the return value of such cases it is required to just test al for zero/non-zero. On the other hand, checking for truth or zero/non-zero on an integer return value requires checking all bits of the register. These two cases must be distinguished and handled correctly in generated native code. This patch makes sure of this. For other supported native archs (ARM, Thumb2, Xtensa) there is no such distinction and this patch does not change anything for them.
Diffstat (limited to 'py/asmthumb.h')
-rw-r--r--py/asmthumb.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/asmthumb.h b/py/asmthumb.h
index 8a7df5d50..9d25b973f 100644
--- a/py/asmthumb.h
+++ b/py/asmthumb.h
@@ -267,12 +267,12 @@ void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp
#define ASM_EXIT asm_thumb_exit
#define ASM_JUMP asm_thumb_b_label
-#define ASM_JUMP_IF_REG_ZERO(as, reg, label) \
+#define ASM_JUMP_IF_REG_ZERO(as, reg, label, bool_test) \
do { \
asm_thumb_cmp_rlo_i8(as, reg, 0); \
asm_thumb_bcc_label(as, ASM_THUMB_CC_EQ, label); \
} while (0)
-#define ASM_JUMP_IF_REG_NONZERO(as, reg, label) \
+#define ASM_JUMP_IF_REG_NONZERO(as, reg, label, bool_test) \
do { \
asm_thumb_cmp_rlo_i8(as, reg, 0); \
asm_thumb_bcc_label(as, ASM_THUMB_CC_NE, label); \