Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 7,971 Lines • ▼ Show 20 Lines | if (!Node->getFlags().hasNoNaNs()) { | ||||
// Insert canonicalizes if it's possible we need to quiet to get correct | // Insert canonicalizes if it's possible we need to quiet to get correct | ||||
// sNaN behavior. | // sNaN behavior. | ||||
if (!DAG.isKnownNeverSNaN(Quiet0)) { | if (!DAG.isKnownNeverSNaN(Quiet0)) { | ||||
Quiet0 = DAG.getNode(ISD::FCANONICALIZE, dl, VT, Quiet0, | Quiet0 = DAG.getNode(ISD::FCANONICALIZE, dl, VT, Quiet0, | ||||
Node->getFlags()); | Node->getFlags()); | ||||
} | } | ||||
if (!DAG.isKnownNeverSNaN(Quiet1)) { | if (!DAG.isKnownNeverSNaN(Quiet1)) { | ||||
Quiet1 = DAG.getNode(ISD::FCANONICALIZE, dl, VT, Quiet1, | Quiet1 = DAG.getNode(ISD::FCANONICALIZE, dl, VT, Quiet1, | ||||
Node->getFlags()); | Node->getFlags()); | ||||
spatel: Is this different than
auto *C = isConstOrConstSplatFP(N));
return C && C->isZero();
| |||||
Not Done ReplyInline ActionsOops - invert that isZero() result (we're looking for non-zero constant). spatel: Oops - invert that isZero() result (we're looking for non-zero constant). | |||||
For splats, I think your suggestion would work, and that's what I originally tried to do... but it doesn't work for the BUILD_VECTOR case, where we need to check if any element is a zero. samparker: For splats, I think your suggestion would work, and that's what I originally tried to do... but… | |||||
Not Done ReplyInline ActionsAh, right. It looks like we do have the basic call already: spatel: Ah, right. It looks like we do have the basic call already:
SelectionDAG::isKnownNeverZeroFloat… | |||||
Nice, will do. samparker: Nice, will do. | |||||
} | } | ||||
} | } | ||||
return DAG.getNode(NewOp, dl, VT, Quiet0, Quiet1, Node->getFlags()); | return DAG.getNode(NewOp, dl, VT, Quiet0, Quiet1, Node->getFlags()); | ||||
} | } | ||||
// If the target has FMINIMUM/FMAXIMUM but not FMINNUM/FMAXNUM use that | // If the target has FMINIMUM/FMAXIMUM but not FMINNUM/FMAXNUM use that | ||||
// instead if there are no NaNs. | // instead if there are no NaNs and there can't be an incompatiable zero | ||||
if (Node->getFlags().hasNoNaNs()) { | // compare: at least one operand isn't +/-0, or there are no signed-zeros. | ||||
if (Node->getFlags().hasNoNaNs() && | |||||
(Node->getFlags().hasNoSignedZeros() || | |||||
DAG.isKnownNeverZeroFloat(Node->getOperand(0)) || | |||||
DAG.isKnownNeverZeroFloat(Node->getOperand(1)))) { | |||||
unsigned IEEE2018Op = | unsigned IEEE2018Op = | ||||
Node->getOpcode() == ISD::FMINNUM ? ISD::FMINIMUM : ISD::FMAXIMUM; | Node->getOpcode() == ISD::FMINNUM ? ISD::FMINIMUM : ISD::FMAXIMUM; | ||||
Not Done ReplyInline ActionsCould we also check hasNoSignedZeros() and allow this? spatel: Could we also check hasNoSignedZeros() and allow this? | |||||
if (isOperationLegalOrCustom(IEEE2018Op, VT)) { | if (isOperationLegalOrCustom(IEEE2018Op, VT)) | ||||
return DAG.getNode(IEEE2018Op, dl, VT, Node->getOperand(0), | return DAG.getNode(IEEE2018Op, dl, VT, Node->getOperand(0), | ||||
Node->getOperand(1), Node->getFlags()); | Node->getOperand(1), Node->getFlags()); | ||||
} | } | ||||
} | |||||
if (SDValue SelCC = createSelectForFMINNUM_FMAXNUM(Node, DAG)) | if (SDValue SelCC = createSelectForFMINNUM_FMAXNUM(Node, DAG)) | ||||
return SelCC; | return SelCC; | ||||
return SDValue(); | return SDValue(); | ||||
} | } | ||||
SDValue TargetLowering::expandIS_FPCLASS(EVT ResultVT, SDValue Op, | SDValue TargetLowering::expandIS_FPCLASS(EVT ResultVT, SDValue Op, | ||||
▲ Show 20 Lines • Show All 2,535 Lines • Show Last 20 Lines |
Is this different than