[llvm] add `frexp`/`ldexp` expansion in `ExpandIrInsts` (PR #208556)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 12:31:34 PDT 2026


================
@@ -1311,13 +1542,32 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
                  MaxLegalDivRemBitWidth;
     case Instruction::Call: {
       auto *II = dyn_cast<IntrinsicInst>(&I);
-      if (II && (II->getIntrinsicID() == Intrinsic::fptoui_sat ||
-                 II->getIntrinsicID() == Intrinsic::fptosi_sat)) {
+      if (!II)
+        return false;
+      switch (II->getIntrinsicID()) {
+      case Intrinsic::fptoui_sat:
+      case Intrinsic::fptosi_sat:
         return !DisableExpandLargeFp &&
                cast<IntegerType>(Ty->getScalarType())->getIntegerBitWidth() >
                    MaxLegalFpConvertBitWidth;
+      case Intrinsic::ldexp: {
+        // the IEEE check skips fp80/ppcf128/vectors.
+        Type *FpTy = II->getArgOperand(0)->getType();
+        if (DisableLdexp || !FpTy->isIEEELikeFPTy())
----------------
arsenm wrote:

The vector case shouldn't be too much trouble to handle (at least the dumb scalarize way)

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


More information about the llvm-commits mailing list