[clang] [llvm] [SystemZ] Do not extend integer arguments in z/OS XPLINK64 ABI (PR #206833)
Zibi Sarbinowski via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 9 11:57:43 PDT 2026
================
@@ -822,9 +822,16 @@ ABIArgInfo ZOSXPLinkABIInfo::classifyArgumentType(QualType Ty, bool IsNamedArg,
return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
RAA == CGCXXABI::RAA_DirectInMemory);
- // Integers and enums are extended to full register width.
+ // Promotable integer arguments are passed without extension attributes.
+ // The XPLINK64 ABI specification mandates that scalar values are widened to
+ // 64 bits only for *return* values, not for arguments; other compilers (e.g.
+ // xlc) do not guarantee the upper bits are sign- or zero-extended on the
+ // caller side. Omitting signext/zeroext here ensures the backend does not
+ // emit a redundant extension instruction on the callee side and avoids
+ // incorrect code when interoperating with xlc. Return values still use
+ // getExtend() because the spec does mandate extension there.
if (isPromotableIntegerTypeForABI(Ty))
- return ABIArgInfo::getExtend(Ty, CGT.ConvertType(Ty));
+ return ABIArgInfo::getDirect(CGT.ConvertType(Ty));
----------------
zibi2 wrote:
right, it should be for sub 64-bit only.
https://github.com/llvm/llvm-project/pull/206833
More information about the cfe-commits
mailing list