[llvm] [APFloat] Add APFloat support for E8M0 type (PR #107127)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 00:27:15 PDT 2024


================
@@ -1091,6 +1103,31 @@ class APFloat : public APFloatBase {
     }
   }
 
+  /// Returns true if the given semantics can represent Zero.
+  ///
+  /// \param Sem - type float semantics
+  static bool hasZero(const fltSemantics &Sem) {
+    switch (SemanticsToEnum(Sem)) {
----------------
arsenm wrote:

Just directly check &Sem == the one? There's only one case so the switch isn't helping 

I find the whole SemanticsToEnum and opaque fltSemantics queries really obnoxious. I don't see why fltSemantics doesn't just have public fields 

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


More information about the llvm-commits mailing list