https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91174

--- Comment #3 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Antony Polukhin from comment #2)
> (In reply to Florian Weimer from comment #1)
> > For which ABI do you propose the change?  It's not correct for GNU/Linux:
> 
> As far as I understand the proposed change does not touch ABI. `lea eax,
> [rdi + 48]` is equivalent to `movzx+add`

According to the x86-64 psABI, for bool, only the lower 8 bits of the register
are defined when passing a bool value.  This means that the movzx instruction
is not optional because the int result needs all 32 bits defined.

GCC already uses lea in cases where the upper 24 bits do not matter, as in this
example:

char test (bool x) {
    return '0' + x;
}

Reply via email to