[llvm] [CodeGen] Fix legalization of minimum/maximum (PR #206097)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 29 02:13:12 PDT 2026
================
@@ -10122,6 +10122,22 @@ SDValue TargetLowering::expandFMINNUM_FMAXNUM(SDNode *Node,
return SDValue();
}
+static SDValue isSpecificZeroAfterMaybeRounding(SelectionDAG &DAG,
+ const TargetLowering &TLI,
+ SDLoc DL, SDValue Val,
+ FPClassTest FPClass) {
+ EVT VT = Val.getValueType();
+ EVT CCVT = TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+ EVT IntVT = VT.changeTypeToInteger();
+ EVT FloatVT = VT.changeElementType(*DAG.getContext(), MVT::f32);
+ SDValue TestZero = DAG.getTargetConstant(FPClass, DL, MVT::i32);
+ if (!TLI.isTypeLegal(IntVT) &&
+ !TLI.isOperationLegalOrCustom(ISD::IS_FPCLASS, VT))
+ Val = DAG.getNode(ISD::FP_ROUND, DL, FloatVT, Val,
----------------
arsenm wrote:
Technically this should try to find the best type accounting for legal float types, and cheapest conversion to that type
https://github.com/llvm/llvm-project/pull/206097
More information about the llvm-commits
mailing list