emilio added a comment.

In D72742#1822554 <https://reviews.llvm.org/D72742#1822554>, @rnk wrote:

> +@chandlerc @rjmccall
>
> Didn't we work this out already when John added the alignment tracking stuff? 
> I remember this bug involving libjpegturbo standalone assembly receiving a 
> 32-bit argument, and then using the full 64-bit RDI register to read it, but 
> clang stopped zero extending it. I thought the ABI doc was ambiguous at the 
> time, and we studied GCC's behavior, and that is how we arrived at clang's 
> current behavior. I am generally skeptical about changing behavior in this 
> area just because the ABI doc says something now. It keeps changing. What did 
> it say in the past? Shouldn't we pay more attention to that?
>
> Found the libjpegturbo thing:
>  
> https://github.com/libjpeg-turbo/libjpeg-turbo/commit/498d9bc92fcf39124b6f08e57326944dedd2ddd6


That seems somewhat related. This would be a similar change to the one that 
clang did back then, but for the bytes in the lower 32-bits when the argument 
is smaller than that.

The ABI document, afaict, has never defined the inputs to be zero-extended. See 
https://groups.google.com/forum/?hl=en#!topic/x86-64-abi/E8O33onbnGQ for an old 
thread discussing this, and the two bugs that are referenced in the commit 
message (one of them fairly old).

GCC does avoid the zero-extension on the caller sometimes, when not required by 
the language and when its optimizer finds it suitable.


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