[llvm] [DAG] Fold fdiv X, c2 -> fmul X, 1/c2 without AllowReciprocal if exact (PR #93882)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 12:37:03 PDT 2024


================
@@ -964,6 +964,14 @@ class APFloat : public APFloatBase {
     return Val;
   }
 
+  /// Factory for Positive and Negative One.
+  ///
+  /// \param Negative True iff the number should be negative.
+  static APFloat getOne(const fltSemantics &Sem, bool Negative = false) {
+    APFloat Val(Sem, Negative ? -1 : 1);
+    return Val;
----------------
kuhar wrote:

nit
```suggestion
    return APFloat(Sem, Negative ? -1.0 : 1.0);
```

?

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


More information about the llvm-commits mailing list