[flang-commits] [flang] [clang] [compiler-rt] [clang-tools-extra] [llvm] [Legalizer] Expand fmaximum and fminimum (PR #67301)
Simon Pilgrim via flang-commits
flang-commits at lists.llvm.org
Tue Dec 12 01:53:55 PST 2023
================
@@ -8262,6 +8262,64 @@ SDValue TargetLowering::expandFMINNUM_FMAXNUM(SDNode *Node,
return SDValue();
}
+SDValue TargetLowering::expandFMINIMUM_FMAXIMUM(SDNode *N,
+ SelectionDAG &DAG) const {
+ SDLoc DL(N);
+ SDValue LHS = N->getOperand(0);
+ SDValue RHS = N->getOperand(1);
+ unsigned Opc = N->getOpcode();
+ EVT VT = N->getValueType(0);
+ EVT CCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
+ bool IsMax = Opc == ISD::FMAXIMUM;
+
+ if (VT.isVector() &&
+ isOperationLegalOrCustomOrPromote(Opc, VT.getScalarType()))
+ return SDValue();
+
+ // First, implement comparison not propagating NaN. If no native fmin or fmax
+ // available, use plain select with setcc instead.
+ SDValue MinMax;
+ if (isOperationLegalOrCustom(IsMax ? ISD::FMAXNUM_IEEE : ISD::FMINNUM_IEEE,
----------------
RKSimon wrote:
(style) Pull out the IsMax? opcodes into separate lines to reduce duplication and line width
https://github.com/llvm/llvm-project/pull/67301
More information about the flang-commits
mailing list