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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to