llvm.org GIT mirror llvm / 0d51300
Propagate fmf for setcc in SDAG for select folds git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362448 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Berg 3 months ago
3 changed file(s) with 16 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
34443444 DAG.getConstant(0, dl, Tmp1.getValueType()),
34453445 Tmp2, Tmp3, ISD::SETNE);
34463446 }
3447 Tmp1->setFlags(Node->getFlags());
34473448 Results.push_back(Tmp1);
34483449 break;
34493450 case ISD::BR_JT: {
35273528 // condition code, create a new SETCC node.
35283529 if (Tmp3.getNode())
35293530 Tmp1 = DAG.getNode(ISD::SETCC, dl, Node->getValueType(0),
3530 Tmp1, Tmp2, Tmp3);
3531 Tmp1, Tmp2, Tmp3, Node->getFlags());
35313532
35323533 // If we expanded the SETCC by inverting the condition code, then wrap
35333534 // the existing SETCC in a NOT to restore the intended condition.
35553556 DAG.getConstant(TrueValue, dl, VT),
35563557 DAG.getConstant(0, dl, VT),
35573558 Tmp3);
3559 Tmp1->setFlags(Node->getFlags());
35583560 Results.push_back(Tmp1);
35593561 break;
35603562 }
35763578 "expanded.");
35773579 EVT CCVT =
35783580 TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), CmpVT);
3579 SDValue Cond = DAG.getNode(ISD::SETCC, dl, CCVT, Tmp1, Tmp2, CC);
3581 SDValue Cond = DAG.getNode(ISD::SETCC, dl, CCVT, Tmp1, Tmp2, CC, Node->getFlags());
35803582 Results.push_back(DAG.getSelect(dl, VT, Cond, Tmp3, Tmp4));
35813583 break;
35823584 }
42454247 Tmp3 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(2));
42464248 // Perform the larger operation, then round down.
42474249 Tmp1 = DAG.getSelect(dl, NVT, Tmp1, Tmp2, Tmp3);
4250 Tmp1->setFlags(Node->getFlags());
42484251 if (TruncOp != ISD::FP_ROUND)
42494252 Tmp1 = DAG.getNode(TruncOp, dl, Node->getValueType(0), Tmp1);
42504253 else
42754278 }
42764279 Tmp1 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(0));
42774280 Tmp2 = DAG.getNode(ExtOp, dl, NVT, Node->getOperand(1));
4278 Results.push_back(DAG.getNode(ISD::SETCC, dl, Node->getValueType(0),
4279 Tmp1, Tmp2, Node->getOperand(2)));
4281 Results.push_back(DAG.getNode(ISD::SETCC, dl, Node->getValueType(0), Tmp1,
4282 Tmp2, Node->getOperand(2), Node->getFlags()));
42804283 break;
42814284 }
42824285 case ISD::BR_CC: {
706706 auto &OpIdEntry = PromotedIntegers[getTableId(Op)];
707707 assert((OpIdEntry == 0) && "Node is already promoted!");
708708 OpIdEntry = getTableId(Result);
709 Result->setFlags(Op->getFlags());
709710
710711 DAG.transferDbgValues(Op, Result);
711712 }
2727 ret float %f8
2828 }
2929
30 ; CHECK: Optimized type-legalized selection DAG: %bb.0 'fmf_setcc:'
31 ; CHECK: t13: i8 = setcc nnan ninf nsz arcp contract afn reassoc t2, ConstantFP:f32<0.000000e+00>, setlt:ch
32
33 define float @fmf_setcc(float %x, float %y) {
34 %cmp = fcmp fast ult float %x, 0.0
35 %ret = select i1 %cmp, float %x, float %y
36 ret float %ret
37 }