-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[TargetLowering] Consider fast-math flags in getSqrtInputTest
#163061
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
Changes from 2 commits
c887ade
7f7915c
fbdf78d
758d2f8
f0e33b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7451,7 +7451,8 @@ TargetLowering::prepareSREMEqFold(EVT SETCCVT, SDValue REMNode, | |
} | ||
|
||
SDValue TargetLowering::getSqrtInputTest(SDValue Op, SelectionDAG &DAG, | ||
const DenormalMode &Mode) const { | ||
const DenormalMode &Mode, | ||
SDNodeFlags Flags) const { | ||
SDLoc DL(Op); | ||
EVT VT = Op.getValueType(); | ||
EVT CCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT); | ||
|
@@ -7462,7 +7463,10 @@ SDValue TargetLowering::getSqrtInputTest(SDValue Op, SelectionDAG &DAG, | |
if (Mode.Input == DenormalMode::PreserveSign || | ||
Mode.Input == DenormalMode::PositiveZero) { | ||
// Test = X == 0.0 | ||
return DAG.getSetCC(DL, CCVT, Op, FPZero, ISD::SETEQ); | ||
SDValue Test = DAG.getSetCC(DL, CCVT, Op, FPZero, ISD::SETEQ); | ||
// Propagate fast-math flags from fcmp. | ||
Test->setFlags(Flags); | ||
|
||
return Test; | ||
} | ||
|
||
// Testing it with denormal inputs to avoid wrong estimate. | ||
|
@@ -7471,8 +7475,11 @@ SDValue TargetLowering::getSqrtInputTest(SDValue Op, SelectionDAG &DAG, | |
const fltSemantics &FltSem = VT.getFltSemantics(); | ||
APFloat SmallestNorm = APFloat::getSmallestNormalized(FltSem); | ||
SDValue NormC = DAG.getConstantFP(SmallestNorm, DL, VT); | ||
SDValue Fabs = DAG.getNode(ISD::FABS, DL, VT, Op); | ||
return DAG.getSetCC(DL, CCVT, Fabs, NormC, ISD::SETLT); | ||
SDValue Fabs = DAG.getNode(ISD::FABS, DL, VT, Op, Flags); | ||
SDValue Test = DAG.getSetCC(DL, CCVT, Fabs, NormC, ISD::SETLT); | ||
// Propagate fast-math flags from fcmp. | ||
Test->setFlags(Flags); | ||
return Test; | ||
} | ||
|
||
SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.