================

----------------
uweigand wrote:

> You are right that my framing was imprecise. The real distinction is between 
> a partial register write and a full register write.
> 
> CCAssignToRegAndStack<[R1L,...]> assigns the argument to the 32-bit 
> sub-register R1L, so the caller only writes the low 32 bits of the GPR. The 
> upper 32 bits are never touched by the call sequence.
> 
> CCPromoteToType with ANY_EXTEND assigns the argument to the full 64-bit 
> register R1D. On SystemZ, ANY_EXTEND i32→i64 lowers to a zero-filling 
> instruction (LLILL/LLILF), so the caller writes all 64 bits.

But `ANY_EXTEND` is not required or guaranteed to do that - this could change 
at any time!
 
> xlc requires the caller to have written the full 64-bit register. R1L 
> violates that because the upper half is never written. ANY_EXTEND satisfies 
> it because the full register is written.

It doesn't make sense to say it is a requirement that the upper half is 
"written" - what does that even mean?  *What value* is supposed to be written?

Can you be specific in what callees compiled with these compiler versions 
actually expect to see in the upper half of the register?  Is it always zero?  
Is it zero- or sign-extended depending on the type?   Anything else?

It appears to me that we have two conflicting requirements here.   On the one 
hand, you say that in a callee we cannot rely on an i32 argument to always be 
extended to i64 because some old (caller) code doesn't do that.  On the other 
hand, you say as a caller we must extend i32 arguments to i64 because some old 
(callee) code expects that.   What if that old caller code calls that old 
callee code?  That would already not work correctly, right?


https://github.com/llvm/llvm-project/pull/206833
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to