[llvm] [DAG] Lower frem of power-2 using div/trunc/mul+sub (PR #91148)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 04:38:14 PDT 2024


================
@@ -2111,6 +2115,10 @@ class SelectionDAG {
   /// Test whether the given SDValue is known to contain non-zero value(s).
   bool isKnownNeverZero(SDValue Op, unsigned Depth = 0) const;
 
+  /// Test whether the given float value is known to be positive. +0.0, +inf and
+  /// +nan are considered positive, -0.0, -inf and -nan are not.
+  bool isKnownPositiveOrNaNFP(SDValue Op) const;
----------------
davemgreen wrote:

I feel like cannotBeOrderedLessThanZero is a slightly different concept. I might be misunderstanding, but at current this function is more about whether the number is bitwise negative or not, with it primarily dealing with fabs. -0.0 should be false for what we need for frem.

(Which, I might be able to add a copysign for too, but I will wait for another patch on that).

What do you think of sticking with the current name, and when a computeKnownFPClass is added for DAG we can switch it over to use the new functions?

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


More information about the llvm-commits mailing list