[clang] [llvm] [SystemZ] Do not extend integer arguments in z/OS XPLINK64 ABI (PR #206833)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 07:24:38 PDT 2026


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

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

There's still a direct contradiction in your latest statement:

>The requirement is that the upper 32 bits are zero. The XPLINK64 ABI spec (z/OS Language Environment Vendor Interfaces) states that integer arguments smaller than 64 bits are passed zero-extended into the full 64-bit GPR. So a caller passing int -1 must put 0x00000000ffffffff in the register, not 0xffffffffffffffff.

contradicts:
>So the "what does the upper half need to contain" answer is: anything — the callee fixes it regardless. The upper half content from the caller is irrelevant to xlc callees.

Either the upper half is irrelevant or it has to be 0.  What is it?

>For -1, this produces 0xffffffffffffffff in the GPR. The xlc callee's prologue LGFR R2,R2 then re-sign-extends 0xffffffffffffffff → still 0xffffffffffffffff, which is wrong for what should be 0x00000000ffffffff (zero-extended -1).

If the caller passed 0x00000000ffffffff, it would still be the same 0xffffffffffffffff after a LGFR R2,R2.

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 ...

https://github.com/llvm/llvm-project/pull/206833


More information about the llvm-commits mailing list