[llvm] [CodeGen] Add scalarization fallback for multi-result scalable intrinsics (PR #218634)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 10:38:48 PDT 2026


=?utf-8?q?Mattéo?= Rizza Murgier,=?utf-8?q?Mattéo?= Rizza Murgier
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/218634 at github.com>


================
@@ -808,6 +809,37 @@ bool PreISelIntrinsicLowering::lowerIntrinsics(Module &M) const {
         return lowerUnaryVectorIntrinsicAsLoop(M, CI);
       });
       break;
+    case Intrinsic::modf:
+    case Intrinsic::sincos:
+    case Intrinsic::sincospi:
+      Changed |= forEachCall(F, [&](CallInst *CI) {
+        Type *Ty = CI->getArgOperand(0)->getType();
+        if (!TM || !isa<ScalableVectorType>(Ty))
+          return false;
+        const TargetLowering *TL = TM->getSubtargetImpl(F)->getTargetLowering();
+        unsigned Op = TL->IntrinsicIDToISD(F.getIntrinsicID());
+        assert(Op != ISD::DELETED_NODE && "unsupported intrinsic");
+        EVT VT = EVT::getEVT(Ty);
+        if (!TL->isOperationExpand(Op, VT))
----------------
arsenm wrote:

Technically the logic should be if the action is LibCall, and if the lib call is unavailable check expand. The conversion of targets to use LibCall actions never really happened though, and every target uses Expand to a function call 

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


More information about the llvm-commits mailing list