[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 04:23:41 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:

> You also can't do a signaling nan check with fcmp in strictfp functions. This cannot raise an exception

I don't think that these `expandFXXXX` can meet the requirements of `strictfp`.
I guess only the architectures which has the exactly same instructions can do so.
Or maybe we can only use the way of soft float.



https://github.com/llvm/llvm-project/pull/104564


More information about the llvm-commits mailing list