[llvm] [GISel][RISCV] Anyextend before copying f16 -> i32/i64 (PR #94993)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 09:18:31 PDT 2024


================
@@ -102,9 +102,14 @@ struct RISCVOutgoingValueHandler : public CallLowering::OutgoingValueHandler {
 
   void assignValueToReg(Register ValVReg, Register PhysReg,
                         const CCValAssign &VA) override {
-    // If we're passing an f32 value into an i64, anyextend before copying.
-    if (VA.getLocVT() == MVT::i64 && VA.getValVT() == MVT::f32)
-      ValVReg = MIRBuilder.buildAnyExt(LLT::scalar(64), ValVReg).getReg(0);
+    // If we're passing a smaller fp value into a larger integer register,
+    // anyextend before copying.
+    if ((VA.getLocVT() == MVT::i64 && VA.getValVT() == MVT::f32) ||
+        ((VA.getLocVT() == MVT::i32 || VA.getLocVT() == MVT::i64) &&
+         VA.getValVT() == MVT::f16)) {
+      LLT DstTy = LLT::scalar(VA.getLocVT().getScalarSizeInBits());
----------------
topperc wrote:

getScalarSizeInBits() -> getSizeInBits(). We already know its a scalar.

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


More information about the llvm-commits mailing list