[llvm] SelectionDAG: Use qNaN constant if FCANONICALIZE not LegalOrCustom (PR #104564)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 10:52:28 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 =
----------------
arsenm wrote:
A make_quiet would need to be is_signaling(x) ? qnan : x. Or preferably is_signaling(x) ? make_quiet(x) : x. But really should just use the canonicalize, and not workaround it not being implemented here
https://github.com/llvm/llvm-project/pull/104564
More information about the llvm-commits
mailing list