@@ -7451,7 +7451,8 @@ TargetLowering::prepareSREMEqFold(EVT SETCCVT, SDValue REMNode,
74517451}
74527452
74537453SDValue TargetLowering::getSqrtInputTest (SDValue Op, SelectionDAG &DAG,
7454- const DenormalMode &Mode) const {
7454+ const DenormalMode &Mode,
7455+ SDNodeFlags Flags) const {
74557456 SDLoc DL (Op);
74567457 EVT VT = Op.getValueType ();
74577458 EVT CCVT = getSetCCResultType (DAG.getDataLayout (), *DAG.getContext (), VT);
@@ -7462,7 +7463,10 @@ SDValue TargetLowering::getSqrtInputTest(SDValue Op, SelectionDAG &DAG,
74627463 if (Mode.Input == DenormalMode::PreserveSign ||
74637464 Mode.Input == DenormalMode::PositiveZero) {
74647465 // Test = X == 0.0
7465- return DAG.getSetCC (DL, CCVT, Op, FPZero, ISD::SETEQ);
7466+ SDValue Test = DAG.getSetCC (DL, CCVT, Op, FPZero, ISD::SETEQ);
7467+ // Propagate fast-math flags from fcmp.
7468+ Test->setFlags (Flags);
7469+ return Test;
74667470 }
74677471
74687472 // Testing it with denormal inputs to avoid wrong estimate.
@@ -7471,8 +7475,11 @@ SDValue TargetLowering::getSqrtInputTest(SDValue Op, SelectionDAG &DAG,
74717475 const fltSemantics &FltSem = VT.getFltSemantics ();
74727476 APFloat SmallestNorm = APFloat::getSmallestNormalized (FltSem);
74737477 SDValue NormC = DAG.getConstantFP (SmallestNorm, DL, VT);
7474- SDValue Fabs = DAG.getNode (ISD::FABS, DL, VT, Op);
7475- return DAG.getSetCC (DL, CCVT, Fabs, NormC, ISD::SETLT);
7478+ SDValue Fabs = DAG.getNode (ISD::FABS, DL, VT, Op, Flags);
7479+ SDValue Test = DAG.getSetCC (DL, CCVT, Fabs, NormC, ISD::SETLT);
7480+ // Propagate fast-math flags from fcmp.
7481+ Test->setFlags (Flags);
7482+ return Test;
74767483}
74777484
74787485SDValue TargetLowering::getNegatedExpression (SDValue Op, SelectionDAG &DAG,
0 commit comments