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

Durgadoss R via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 04:14:12 PDT 2024


================
@@ -1727,6 +1752,8 @@ IEEEFloat::opStatus IEEEFloat::normalize(roundingMode rounding_mode,
   /* Canonicalize zeroes.  */
   if (omsb == 0) {
     category = fcZero;
+    if (!APFloat::hasZero(*semantics))
+      makeSmallestNormalized(false);
----------------
durga4github wrote:

This handles the case where the all-zero encoding is valid but just that it does not represent zero for some semantics (and represents the smallest-normal value instead). I have added a comment there explaining this case.

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


More information about the llvm-commits mailing list