[llvm] [APFloat] Extend fltSemantics with field for explicit integer bit (PR #204860)

Matthias Springer via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 20 01:52:38 PDT 2026


================
@@ -3813,6 +3805,21 @@ void IEEEFloat::initFromIEEEAPInt(const APInt &api) {
     is_nan = is_zero && sign;
   }
 
+  if constexpr (S.hasExplicitIntegerBit) {
+    // This is only used and tested for x87DoubleExtended
+    static_assert(S.precision == 64);
+    const integerPart myintegerbit = mysignificand[0] >> 63;
+    constexpr integerPart significand_mask_no_int_bit =
+        (uint64_t{1} << (trailing_significand_bits - 1)) - 1;
+    if (myexponent - bias != ::exponentNaN(S) && myexponent != 0 &&
+        myintegerbit == 0) {
+      is_nan = true;
----------------
matthias-springer wrote:

This clashes a bit with:
```
fltNanEncoding nanEncoding = fltNanEncoding::IEEE;
```

Now we have two fields that indicate the NaN representation. I'm wondering if `fltNanEncoding` could be extended?

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


More information about the llvm-commits mailing list