This brings us in line with GCC and MSVC behaviour, and saves on code size.
We were already not extending i1 return values to on x86_64 after [0].
The ABI docs are unclear about this situation. The new i386 psABI [1] clearly states (Table 2.4, page 14) that i1, i8, and i16 return values do not need to be extended beyond 8 bits (GCC and MSVC do extend 16-bit values though, so I'm holding off on that). The old i386 psABI [2] does not mention this. I can't find mention of this in the x86_64 ABI [3], but there is a proposal on [4] that matches the behaviour in this patch.
Please let me know what you think.
[0]. http://llvm.org/viewvc/llvm-project?view=revision&revision=127766
[1]. https://01.org/sites/default/files/file_attach/intel386-psabi-1.0.pdf
[2]. https://refspecs.linuxfoundation.org/elf/abi386-4.pdf
[3]. https://refspecs.linuxfoundation.org/elf/x86_64-abi-0.98.pdf
[4]. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46942#c4
This comment doesn't apply anymore?