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

----------------
zibi2 wrote:

> If the ABI does indeed say that all small integer arguments are passed 
> zero-extended, then we can certainly implement that in a caller. The question 
> is then, can we also rely on that property when compiling a callee? If so, we 
> should simply emit zeroext markers from clang always ...

The spec does not explicitly state this. What we have is:

1. clang-as-caller zero-extends — enforced by CCPromoteToType<i64> / 
ZERO_EXTEND in our fix, confirmed by the cross-compiler test above.

1. Old xlc-as-caller does not — it writes only R1L (32-bit sub-register), upper 
half undefined.

So we cannot emit zeroext on callee parameters because interoperability with 
old xlc callers requires tolerating an undefined upper half. The xlc callee 
assembly confirms this is fine, xlc derives the correct value from the low 32 
bits via LGF on reload, never reading the upper half. clang-as-callee should do 
the same: getDirect (no extend attribute), use the value at its natural 32-bit 
width.

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