[llvm] SelectionDAG: Use qNaN constant if FCANONICALIZE not LegalOrCustom (PR #104564)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 03:43:09 PDT 2024
================
@@ -8622,8 +8622,16 @@ SDValue TargetLowering::expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *Node,
// If MinMax is NaN, let's quiet it.
if (!Flags.hasNoNaNs() && !DAG.isKnownNeverNaN(LHS) &&
!DAG.isKnownNeverNaN(RHS)) {
- SDValue MinMaxQuiet =
- DAG.getNode(ISD::FCANONICALIZE, DL, VT, MinMax, Flags);
+ SDValue MinMaxQuiet;
+ if (isOperationLegalOrCustom(ISD::FCANONICALIZE, VT)) {
----------------
wzssyqa wrote:
> But a nan constant isn't a replacement for a canonicalize. You are breaking any non-nan inputs
it won't break non-nan inputs, as we have
```
MinMax =
DAG.getSelectCC(DL, MinMax, MinMax, MinMaxQuiet, MinMax, ISD::SETUO);
```
The `MinMaxQuiet` will be used only if `MinMax` `UO` `MinMax`.
https://github.com/llvm/llvm-project/pull/104564
More information about the llvm-commits
mailing list