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

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 09:02:17 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;
----------------
janr-bay wrote:

I've changed this now so the special case handling is part of the other NaN detection logic. Now hasExplicitIntegerBit and nanEncoding interact but only by turning handling of those special cases on and this should be clear from the code

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


More information about the llvm-commits mailing list