================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to