Skip to content

SelectionDAG: ExpandFMINNUM_FMAXNUM: FCANONICALIZE is not needed for FMINNUM_IEEE #139007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8511,23 +8511,9 @@ SDValue TargetLowering::expandFMINNUM_FMAXNUM(SDNode *Node,
Node->getOpcode() == ISD::FMINNUM ? ISD::FMINNUM_IEEE : ISD::FMAXNUM_IEEE;

if (isOperationLegalOrCustom(NewOp, VT)) {
SDValue Quiet0 = Node->getOperand(0);
SDValue Quiet1 = Node->getOperand(1);

if (!Node->getFlags().hasNoNaNs()) {
// Insert canonicalizes if it's possible we need to quiet to get correct
// sNaN behavior.
if (!DAG.isKnownNeverSNaN(Quiet0)) {
Quiet0 = DAG.getNode(ISD::FCANONICALIZE, dl, VT, Quiet0,
Node->getFlags());
}
if (!DAG.isKnownNeverSNaN(Quiet1)) {
Quiet1 = DAG.getNode(ISD::FCANONICALIZE, dl, VT, Quiet1,
Node->getFlags());
}
}

return DAG.getNode(NewOp, dl, VT, Quiet0, Quiet1, Node->getFlags());
SDValue N0 = Node->getOperand(0);
SDValue N1 = Node->getOperand(1);
return DAG.getNode(NewOp, dl, VT, N0, N1, Node->getFlags());
}

// If the target has FMINIMUM/FMAXIMUM but not FMINNUM/FMAXNUM use that
Expand Down
Loading