[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:33 PDT 2026
================
@@ -1276,7 +1492,22 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
MaxLegalDivRemBitWidth >= IntegerType::MAX_INT_BITS;
bool DisableFrem = !FRemExpander::shouldExpandAnyFremType(TLI);
- if (DisableExpandLargeFp && DisableFrem && DisableExpandLargeDivRem)
+ static constexpr std::array ExpandableTypes{MVT::f32, MVT::f64, MVT::f128};
+ auto NeedsExpand = [&](EVT VT, unsigned ISDOp, RTLIB::Libcall LC) {
+ // For f16/bf16 LC is UNKNOWN_LIBCALL, they are handled via promotion.
+ return LC != RTLIB::UNKNOWN_LIBCALL &&
+ TLI.getOperationAction(ISDOp, VT) == TargetLowering::Expand &&
+ Libcalls.getLibcallImpl(LC) == RTLIB::Unsupported;
----------------
arsenm wrote:
Can you make this a proper helper function? Ideally we would first migrate all the targets onto using the LibCall action for these operations. Then the logic would be `Expand || (Libcall && getLibcallImpl() == Unsupported`
https://github.com/llvm/llvm-project/pull/208556
More information about the llvm-commits
mailing list