[llvm] SelectionDAG: Support nofpclass with zero/pzero/nzero (PR #137305)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 01:30:42 PDT 2025


================
@@ -8603,7 +8603,11 @@ SDValue TargetLowering::expandFMINIMUM_FMAXIMUM(SDNode *N,
 
   // fminimum/fmaximum requires -0.0 less than +0.0
   if (!MinMaxMustRespectOrderedZero && !N->getFlags().hasNoSignedZeros() &&
-      !DAG.isKnownNeverZeroFloat(RHS) && !DAG.isKnownNeverZeroFloat(LHS)) {
+      !DAG.isKnownNeverZeroFloat(RHS) && !DAG.isKnownNeverZeroFloat(LHS) &&
+      !(DAG.isKnownNeverZeroFloat(RHS, fcNegZero) &&
+        DAG.isKnownNeverZeroFloat(LHS, fcNegZero)) &&
+      !(DAG.isKnownNeverZeroFloat(RHS, fcPosZero) &&
+        DAG.isKnownNeverZeroFloat(LHS, fcPosZero))) {
----------------
arsenm wrote:

> May be what you want is something like computePossibleFPClass.

Yes. The DAG APIs are fractured and worse and barely do everything. KnownNever is a convenience wrapper around the known set.

> If fact I think that the implementation of computePossibleFPClass may be too complicated.

It is simpler than maintaining a half dozen functions that all need to do essentially the same thing 


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


More information about the llvm-commits mailing list