[llvm] SelectionDAG: Use qNaN constant if FCANONICALIZE not LegalOrCustom (PR #104564)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 2 02:16:17 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)) {
+ MinMaxQuiet = DAG.getNode(ISD::FCANONICALIZE, DL, VT, MinMax, Flags);
+ } else {
+ // MIPS pre-R5 and HPPA use different encoding of qNaN and sNaN.
+ // ISD::FCANONICALIZE is supported by MIPS.
+ // HPPA is not supported by LLVM yet.
+ MinMaxQuiet =
----------------
wzssyqa wrote:
I am not trying to use `make_quiet` here. As it is not easy to do `is_signaling`.
What I am trying to do is `inNaN(x) ? qnan : x`.
https://github.com/llvm/llvm-project/pull/104564
More information about the llvm-commits
mailing list