-
Notifications
You must be signed in to change notification settings - Fork 15.2k
SelectionDAG/expandFMINIMUMNUM_FMAXIMUMNUM: FCANONICALIZE is needed only for sNaN #108180
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
base: main
Are you sure you want to change the base?
Conversation
|
@llvm/pr-subscribers-llvm-selectiondag Author: YunQiang Su (wzssyqa) ChangesIf we are sure that it is not sNaN, even it may be qNaN, we can use it directly. Full diff: https://github.com/llvm/llvm-project/pull/108180.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 03010c1df00145..042661af1c8f96 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -8614,8 +8614,8 @@ SDValue TargetLowering::expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *Node,
SDValue MinMax =
DAG.getSelectCC(DL, LHS, RHS, LHS, RHS, IsMax ? ISD::SETGT : ISD::SETLT);
// If MinMax is NaN, let's quiet it.
- if (!Flags.hasNoNaNs() && !DAG.isKnownNeverNaN(LHS) &&
- !DAG.isKnownNeverNaN(RHS)) {
+ if (!Flags.hasNoNaNs() && !DAG.isKnownNeverSNaN(LHS) &&
+ !DAG.isKnownNeverSNaN(RHS)) {
MinMax = DAG.getNode(ISD::FCANONICALIZE, DL, VT, MinMax, Flags);
}
|
arsenm
left a comment
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.
Needs test changes
7672436 to
31dcdac
Compare
I only see that we have How to mark a variable to never SNaN while may qNaN? |
|
I guess t hat I am confused by I have a try, while it won't as |
|
isKnownNeverNaN is quite underdeveloped. You can most easily test the no-nan operand case by just having a filler fadd nnan instruction. It would be simpler to do that than pulling in a dependency on some more general nofpclass handling |
SelectionDAGISel::LowerArguments: Pass NoNaN Flags to InVals. `nofpclass` support values nan, snan, qnan, where nan=snan|qnan. So let's use NoSNaNs and NoQNaNs in SDNodeFlags. Thus, we can use it in isKnownNeverNaN.
…nly for sNaN If we are sure that it is not sNaN, even it may be qNaN, we can use it directly.
44833e8 to
d65a025
Compare
If we are sure that it is not sNaN, even it may be qNaN, we can use it directly.