llvm.org GIT mirror llvm / 66d9648
Propagate fmf for setcc/select folds Summary: This change facilitates propagating fmf which was placed on setcc from fcmp through folds with selects so that back ends can model this path for arithmetic folds on selects in SDAG. Reviewers: qcolombet, spatel Reviewed By: qcolombet Subscribers: nemanjai, jsji Differential Revision: https://reviews.llvm.org/D62552 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362439 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Berg 3 months ago
2 changed file(s) with 12 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
79407940 }
79417941
79427942 if (TLI.isOperationLegal(ISD::SELECT_CC, VT) ||
7943 (!LegalOperations && TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT)))
7944 return DAG.getNode(ISD::SELECT_CC, DL, VT, Cond0, Cond1, N1, N2,
7945 N0.getOperand(2));
7943 (!LegalOperations &&
7944 TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT))) {
7945 // Any flags available in a select/setcc fold will be on the setcc as they
7946 // migrated from fcmp
7947 const SDNodeFlags Flags = N0.getNode()->getFlags();
7948 SDValue SelectNode = DAG.getNode(ISD::SELECT_CC, DL, VT, Cond0, Cond1, N1,
7949 N2, N0.getOperand(2));
7950 SelectNode->setFlags(Flags);
7951 return SelectNode;
7952 }
79467953
79477954 return SimplifySelect(DL, N0, N1, N2);
79487955 }
374374 ; fcmp can have fast-math-flags.
375375
376376 ; FMFDEBUG-LABEL: Optimized lowered selection DAG: %bb.0 'fcmp_nnan:'
377 ; FMFDEBUG: select_cc {{t[0-9]+}}
377 ; FMFDEBUG: select_cc nnan {{t[0-9]+}}
378378 ; FMFDEBUG: Type-legalized selection DAG: %bb.0 'fcmp_nnan:'
379379
380380 ; GLOBALDEBUG-LABEL: Optimized lowered selection DAG: %bb.0 'fcmp_nnan:'
381 ; GLOBALDEBUG: select_cc {{t[0-9]+}}
381 ; GLOBALDEBUG: select_cc nnan {{t[0-9]+}}
382382 ; GLOBALDEBUG: Type-legalized selection DAG: %bb.0 'fcmp_nnan:'
383383
384384 define double @fcmp_nnan(double %a, double %y, double %z) {