diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-08-04 22:03:49 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-08-04 22:03:49 +1000 |
| commit | 10830059c5d3651abdb2d3532b28a9bb0a9425ee (patch) | |
| tree | db4c54f5f9d54d5833546e345c23f08f1adc1df0 /py/asmarm.h | |
| parent | 4b1e8bdebdf5feb48a51dbf1e584735395069384 (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/asmarm.h')
| -rw-r--r-- | py/asmarm.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/asmarm.h b/py/asmarm.h index 871e35820..5c1e2ba58 100644 --- a/py/asmarm.h +++ b/py/asmarm.h @@ -150,12 +150,12 @@ void asm_arm_bl_ind(asm_arm_t *as, void *fun_ptr, uint fun_id, uint reg_temp); #define ASM_EXIT asm_arm_exit #define ASM_JUMP asm_arm_b_label -#define ASM_JUMP_IF_REG_ZERO(as, reg, label) \ +#define ASM_JUMP_IF_REG_ZERO(as, reg, label, bool_test) \ do { \ asm_arm_cmp_reg_i8(as, reg, 0); \ asm_arm_bcc_label(as, ASM_ARM_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_arm_cmp_reg_i8(as, reg, 0); \ asm_arm_bcc_label(as, ASM_ARM_CC_NE, label); \ |
