[llvm] [PowerPC] Add special handling for arguments that are smaller than pointer size. (PR #119003)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 11:30:12 PST 2024


================
@@ -7291,7 +7293,17 @@ SDValue PPCTargetLowering::LowerFormalArguments_AIX(
       SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
       SDValue ArgValue =
           DAG.getLoad(ValVT, dl, Chain, FIN, MachinePointerInfo());
-      InVals.push_back(ArgValue);
+
+      // While the ABI specifies the the higher bits of the load should be
+      // zeroed out this is not always the case. For safety this code will zero
+      // extend the loaded value if the size of the argument type is smaller
+      // then the load.
+      if (!ArgVT.isVector() && !ValVT.isVector() &&
+          ArgVT.getScalarSizeInBits() < ValVT.getScalarSizeInBits()) {
+        SDValue ArgValueExt = DAG.getZeroExtendInReg(ArgValue, dl, ArgVT);
----------------
RolandF77 wrote:

The ABI specifies a register image. IOW if the parameter was signed then sign-extension is indicated. Whether signed or unsigned can be found in Flags.

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


More information about the llvm-commits mailing list