================
@@ -825,9 +822,17 @@ 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.
- if (isPromotableIntegerTypeForABI(Ty))
- return ABIArgInfo::getExtend(Ty, CGT.ConvertType(Ty));
+ // Sub-64-bit integer arguments undergo normal C integer promotion (8/16-bit
+ // types are widened to 32 bits) but are NOT sign- or zero-extended to 64
+ // bits. The XPLINK64 ABI specification mandates 64-bit widening only for
+ // return values; other compilers (e.g. xlc) leave the upper 32 bits of an
+ // argument register unspecified, so emitting signext/zeroext on parameters
+ // would produce incorrect code when interoperating with xlc.
+ // 64-bit types (long, unsigned long) are already register-width and are
+ // passed unmodified via getDirect().
+ if (isPromotableIntegerTypeForABI(Ty) && getContext().getTypeSize(Ty) < 64)
----------------
uweigand wrote:
The size check is a bit confusing - 64-bit types should always return false
from `isPromotableIntegerTypeForABI` as there's nothing to promote?
https://github.com/llvm/llvm-project/pull/206833
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits