Skip to content
Snippets Groups Projects
  • Damien George's avatar
    10830059
    py/emitnative: Fix x86 native zero checks by comparing full word. · 10830059
    Damien George authored
    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.
    10830059
    History
    py/emitnative: Fix x86 native zero checks by comparing full word.
    Damien George authored
    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.