Reland "[SystemZ][z/OS] Fix f32 variadic argument assertion"
authorMubariz Afzal <mubarizafzal@gmail.com>
Mon, 18 Jul 2022 18:24:20 +0000 (14:24 -0400)
committerNeumann Hon <h.neukc@gmail.com>
Mon, 18 Jul 2022 18:25:17 +0000 (14:25 -0400)
commitc444f037878c61bcc750855c6edbcdac8f0871a5
tree252ff5f9799c777f764dbfdd51c1e59bcb5819bc
parentd04c2b2fd916897cadc88f33ab87582f473600ac
Reland "[SystemZ][z/OS] Fix f32 variadic argument assertion"

This patch relands the f32 vararg assertion on z/OS fix that was reverted previously due to the testcase failing on non-z/OS platforms. It is now passing.

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). Thus it becomes a bitcast from f32 to i64. We don't handle bitcasts for f32s and so this causes an assertion to be thrown.

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.
llvm/lib/Target/SystemZ/SystemZCallingConv.td
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/test/CodeGen/SystemZ/call-zos-vararg.ll