[LLVMdev] x86-64 sign extension for parameters and return values

Chris Lattner clattner at apple.com
Thu Feb 23 15:08:08 PST 2012


On Feb 23, 2012, at 1:54 PM, Eli Friedman wrote:

>> The LLVM model implies the the caller always has to sign extend for
>> signed promotion to argument registers and that the callee always has
>> to sign extend for signed promotion to return value registers.  The
>> GCC model seems more reasonable and efficient to me because whoever is
>> actually using the values gets to choose whether a sign extension is
>> done (or not done at all).
>> 
>> Could someone explain the LLVM implementation to me?
>> 
>> [1] http://www.x86-64.org/documentation/abi.pdf
> 
> Sorry about the delayed response; I was sort of expecting someone else
> to respond.  It looks like a rather nasty issue, and deserves some
> attention.
> 
> LLVM has traditionally assumed that all integer argument and return
> types narrower than int are promoted to int on all architectures.
> Nobody has actually noticed any issues with this before now, as far as
> I know.

FYI, this is vaguely related:
http://nondot.org/~sabre/LLVMNotes/ExtendedIntegerResults.txt

It was brought up by people that cared about 16-bit targets but where int was 32-bit.  I don't think that anyone actively cares about this at the moment, but it would be nice to clean this up someday.

-Chris



More information about the llvm-dev mailing list