[PATCH] D72742: Don't assume promotable integers are zero/sign-extended already in x86-64 ABI.
Emilio Cobos Álvarez via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 15 04:47:58 PST 2020
emilio added a comment.
The relevant discussion is here <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92821#c2>. From the "Parameter Passing" section in https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf, there's no mention of sign-extension requirements for arguments.
> The only related thing is
> "When a value of type _Bool is returned or passed in a register or on the stack,
> bit 0 contains the truth value and bits 1 to 7 shall be zero."
> with a footnote:
> "Other bits are left unspecified, hence the consumer side of those values can rely on it being 0 or 1 when truncated to 8 bit."
which says that _Bool has only significant low 8 bits and the rest is unspecified.
Then Michael Matz (one of the editors of that document) clarifies below:
> Yes, we (intentionally) haven't required any extensions to happen for arguments
or return values smaller than 64bit (e.g. we haven't even specified that arguments <= 32bit would be zero-extended in the high bits, as would have been
natural with the instruction set). If LLVM relies on that it would be a bug.
There's more information on that bug and related ones, but I think the above should be enough :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72742/new/
https://reviews.llvm.org/D72742
More information about the cfe-commits
mailing list