[PATCH] D119868: [SystemZ][z/OS] Fix f32 variadic argument assertion

Mubariz Afzal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 11:16:07 PST 2022


mubarizafzal created this revision.
mubarizafzal added reviewers: Kai, uweigand.
Herald added a subscriber: hiraditya.
mubarizafzal requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The tablegen lines that specify the XPLINK64 calling convention for promoting an f32 vararg to an f64 are effectively overwritten by the following tablegen line which bitcast an f64 vararg to an i64 (so that it can be used in the GPRs) . It becomes a bitcast from f32 to i64. Since we don't handle a bitcast for f32s this caused an assertion.

We fix this by simplifying the tablegen lines to explicity show this behaviour, and allow the f32 in the bitcast case by first promoting it to an f64.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119868

Files:
  llvm/lib/Target/SystemZ/SystemZCallingConv.td


Index: llvm/lib/Target/SystemZ/SystemZCallingConv.td
===================================================================
--- llvm/lib/Target/SystemZ/SystemZCallingConv.td
+++ llvm/lib/Target/SystemZ/SystemZCallingConv.td
@@ -225,9 +225,10 @@
   // XPLINK64 ABI compliant code widens integral types smaller than i64
   // to i64 before placing the parameters either on the stack or in registers.
   CCIfType<[i32], CCIfExtend<CCPromoteToType<i64>>>,
-  // Promote f32 to f64 and bitcast to i64, if it needs to be passed in GPRS.
-  CCIfType<[f32], CCIfNotFixed<CCPromoteToType<f64>>>,
-  CCIfType<[f64], CCIfNotFixed<CCBitConvertToType<i64>>>,
+  // Promote f32 to f64 and bitcast to i64, if it needs to be passed in GPRs.
+  // Although we assign the f32 vararg to be bitcast, it will first be promoted
+  // to an f64 within convertValVTToLocVT().
+  CCIfType<[f32, f64], CCIfNotFixed<CCBitConvertToType<i64>>>,
   // long double, can only be passed in GPR2 and GPR3, if available,
   // hence R2Q
   CCIfType<[f128], CCIfNotFixed<CCCustom<"CC_XPLINK64_Allocate128BitVararg">>>,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119868.408966.patch
Type: text/x-patch
Size: 1080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220215/b484df3e/attachment-0001.bin>


More information about the llvm-commits mailing list