[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [experiment] Make `fltSemantics` public (PR #123374)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 17 09:12:24 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff d7e48fbf205a01fcbc109b2555b12aa0d37845a4 f595dfc75253a3ca80196f6e7f5fb38ca6d82376 --extensions h,cpp -- clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp clang/include/clang/AST/OptionalDiagnostic.h clang/lib/AST/ByteCode/Floating.h clang/lib/CodeGen/CGExprComplex.cpp clang/lib/CodeGen/PatternInit.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp flang/lib/Optimizer/Dialect/FIRAttr.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp llvm/include/llvm/ADT/APFloat.h llvm/lib/Analysis/ValueTracking.cpp llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/lib/Support/APFloat.cpp llvm/lib/Support/Z3Solver.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Scalar/Float2Int.cpp llvm/lib/Transforms/Utils/FunctionComparator.cpp llvm/unittests/ADT/APFloatTest.cpp llvm/unittests/IR/ConstantFPRangeTest.cpp mlir/lib/AsmParser/Parser.cpp mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp mlir/lib/IR/BuiltinTypeInterfaces.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
index aa868cfe68..55a5d7414f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
@@ -244,7 +244,7 @@ struct IntegerRange {
 static IntegerRange createFromType(const ASTContext &Context,
                                    const BuiltinType &T) {
   if (T.isFloatingPoint()) {
-    unsigned PrecisionBits = 
+    unsigned PrecisionBits =
         Context.getFloatTypeSemantics(T.desugar()).precision;
     // Contrary to two's complement integer, floating point values are
     // symmetric and have the same number of positive and negative values.
diff --git a/clang/lib/AST/ByteCode/Floating.h b/clang/lib/AST/ByteCode/Floating.h
index 123d546c5f..9cb8d915b5 100644
--- a/clang/lib/AST/ByteCode/Floating.h
+++ b/clang/lib/AST/ByteCode/Floating.h
@@ -142,8 +142,7 @@ public:
 
   // === Serialization support ===
   size_t bytesToSerialize() const {
-    return sizeof(llvm::fltSemantics *) +
-           (F.getSemantics().sizeInBits / 8);
+    return sizeof(llvm::fltSemantics *) + (F.getSemantics().sizeInBits / 8);
   }
 
   void serialize(std::byte *Buff) const {
diff --git a/clang/lib/CodeGen/PatternInit.cpp b/clang/lib/CodeGen/PatternInit.cpp
index d8e8c4d624..43ea4c1369 100644
--- a/clang/lib/CodeGen/PatternInit.cpp
+++ b/clang/lib/CodeGen/PatternInit.cpp
@@ -52,8 +52,7 @@ llvm::Constant *clang::CodeGen::initializationPatternFor(CodeGenModule &CGM,
     return llvm::ConstantExpr::getIntToPtr(Int, PtrTy);
   }
   if (Ty->isFPOrFPVectorTy()) {
-    unsigned BitWidth = 
-        Ty->getScalarType()->getFltSemantics().sizeInBits;
+    unsigned BitWidth = Ty->getScalarType()->getFltSemantics().sizeInBits;
     llvm::APInt Payload(64, NaNPayload);
     if (BitWidth >= 64)
       Payload = llvm::APInt::getSplat(BitWidth, Payload);
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 42e397a51c..0dc89214e5 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -11350,7 +11350,7 @@ void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC,
 
     // Determine the number of precision bits in the
     // target floating point type.
-    unsigned int TargetPrecision = 
+    unsigned int TargetPrecision =
         Context.getFloatTypeSemantics(QualType(TargetBT, 0)).precision;
 
     if (SourcePrecision > 0 && TargetPrecision > 0 &&
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a7db950644..c2e669aa6e 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -10035,8 +10035,7 @@ static bool canConvertIntTyToFloatTy(Sema &S, ExprResult *Int,
     // Reject types that cannot be fully encoded into the mantissa of
     // the float.
     Bits = S.Context.getTypeSize(IntTy);
-    unsigned FloatPrec = 
-        S.Context.getFloatTypeSemantics(FloatTy).precision;
+    unsigned FloatPrec = S.Context.getFloatTypeSemantics(FloatTy).precision;
     if (Bits > FloatPrec)
       return true;
   }
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index f907f3342a..7e4b4ec786 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -408,16 +408,18 @@ struct SupportedFltSemantics;
 
 /* Represents floating point arithmetic semantics.  */
 struct fltSemantics {
- private:
+private:
   friend struct SupportedFltSemantics;
   friend struct APFloatBase;
   friend class detail::IEEEFloat;
 
-  constexpr fltSemantics(APFloatBase::ExponentType maxExponent, APFloatBase::ExponentType minExponent,
-                         unsigned int precision, unsigned int sizeInBits,
-                         fltNonfiniteBehavior nonFiniteBehavior = fltNonfiniteBehavior::IEEE754,
-                         fltNanEncoding nanEncoding = fltNanEncoding::IEEE,
-                         bool hasZero = false, bool hasSignedRepr = true)
+  constexpr fltSemantics(
+      APFloatBase::ExponentType maxExponent,
+      APFloatBase::ExponentType minExponent, unsigned int precision,
+      unsigned int sizeInBits,
+      fltNonfiniteBehavior nonFiniteBehavior = fltNonfiniteBehavior::IEEE754,
+      fltNanEncoding nanEncoding = fltNanEncoding::IEEE, bool hasZero = false,
+      bool hasSignedRepr = true)
       : maxExponent(maxExponent), minExponent(minExponent),
         precision(precision), sizeInBits(sizeInBits),
         nonFiniteBehavior(nonFiniteBehavior), nanEncoding(nanEncoding),
@@ -425,7 +427,7 @@ struct fltSemantics {
 
   fltSemantics() {}
 
- public:
+public:
   constexpr bool hasInf() const {
     return nonFiniteBehavior == fltNonfiniteBehavior::IEEE754;
   }
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index ffedf35944..e682b4b57e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5689,8 +5689,7 @@ static SDValue isSaturatingMinMax(SDValue N0, SDValue N1, SDValue N2,
       if (FPVT.isSimple()) {
         Type *InputTy = FPVT.getTypeForEVT(*DAG.getContext());
         const fltSemantics &Semantics = InputTy->getFltSemantics();
-        uint32_t MinBitWidth =
-          Semantics.intSizeInBits(/*isSigned*/ true);
+        uint32_t MinBitWidth = Semantics.intSizeInBits(/*isSigned*/ true);
         if (IntVT.getSizeInBits() >= MinBitWidth) {
           Unsigned = true;
           BW = PowerOf2Ceil(MinBitWidth);
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index ab5ac7cf8b..27d9881320 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -2687,8 +2687,7 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(SDNode *Node,
   // The following optimization is valid only if every value in SrcVT (when
   // treated as signed) is representable in DestVT.  Check that the mantissa
   // size of DestVT is >= than the number of bits in SrcVT -1.
-  assert(DestVT.getFltSemantics().precision >=
-             SrcVT.getSizeInBits() - 1 &&
+  assert(DestVT.getFltSemantics().precision >= SrcVT.getSizeInBits() - 1 &&
          "Cannot perform lossless SINT_TO_FP!");
 
   SDValue Tmp1;
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 8888827513..1fe486cd99 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -54,38 +54,48 @@ static_assert(APFloatBase::integerPartWidth % 4 == 0, "Part width must be divisi
 namespace llvm {
 
 struct SupportedFltSemantics {
-static constexpr fltSemantics semIEEEhalf = {15, -14, 11, 16};
-static constexpr fltSemantics semBFloat = {127, -126, 8, 16};
-static constexpr fltSemantics semIEEEsingle = {127, -126, 24, 32};
-static constexpr fltSemantics semIEEEdouble = {1023, -1022, 53, 64};
-static constexpr fltSemantics semIEEEquad = {16383, -16382, 113, 128};
-static constexpr fltSemantics semFloat8E5M2 = {15, -14, 3, 8};
-static constexpr fltSemantics semFloat8E5M2FNUZ = {
-    15, -15, 3, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::NegativeZero};
-static constexpr fltSemantics semFloat8E4M3 = {7, -6, 4, 8};
-static constexpr fltSemantics semFloat8E4M3FN = {
-    8, -6, 4, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::AllOnes};
-static constexpr fltSemantics semFloat8E4M3FNUZ = {
-    7, -7, 4, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::NegativeZero};
-static constexpr fltSemantics semFloat8E4M3B11FNUZ = {
-    4, -10, 4, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::NegativeZero};
-static constexpr fltSemantics semFloat8E3M4 = {3, -2, 5, 8};
-static constexpr fltSemantics semFloatTF32 = {127, -126, 11, 19};
-static constexpr fltSemantics semFloat8E8M0FNU = {
-    127,   -127, 1, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::AllOnes,
-    false, false};
-
-static constexpr fltSemantics semFloat6E3M2FN = {
-    4, -2, 3, 6, fltNonfiniteBehavior::FiniteOnly};
-static constexpr fltSemantics semFloat6E2M3FN = {
-    2, 0, 4, 6, fltNonfiniteBehavior::FiniteOnly};
-static constexpr fltSemantics semFloat4E2M1FN = {
-    2, 0, 2, 4, fltNonfiniteBehavior::FiniteOnly};
-static constexpr fltSemantics semX87DoubleExtended = {16383, -16382, 64, 80};
-static constexpr fltSemantics semBogus = {0, 0, 0, 0};
-static constexpr fltSemantics semPPCDoubleDouble = {-1, 0, 0, 128};
-static constexpr fltSemantics semPPCDoubleDoubleLegacy = {1023, -1022 + 53,
-                                                          53 + 53, 128};
+  static constexpr fltSemantics semIEEEhalf = {15, -14, 11, 16};
+  static constexpr fltSemantics semBFloat = {127, -126, 8, 16};
+  static constexpr fltSemantics semIEEEsingle = {127, -126, 24, 32};
+  static constexpr fltSemantics semIEEEdouble = {1023, -1022, 53, 64};
+  static constexpr fltSemantics semIEEEquad = {16383, -16382, 113, 128};
+  static constexpr fltSemantics semFloat8E5M2 = {15, -14, 3, 8};
+  static constexpr fltSemantics semFloat8E5M2FNUZ = {
+      15,
+      -15,
+      3,
+      8,
+      fltNonfiniteBehavior::NanOnly,
+      fltNanEncoding::NegativeZero};
+  static constexpr fltSemantics semFloat8E4M3 = {7, -6, 4, 8};
+  static constexpr fltSemantics semFloat8E4M3FN = {
+      8, -6, 4, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::AllOnes};
+  static constexpr fltSemantics semFloat8E4M3FNUZ = {
+      7, -7, 4, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::NegativeZero};
+  static constexpr fltSemantics semFloat8E4M3B11FNUZ = {
+      4,
+      -10,
+      4,
+      8,
+      fltNonfiniteBehavior::NanOnly,
+      fltNanEncoding::NegativeZero};
+  static constexpr fltSemantics semFloat8E3M4 = {3, -2, 5, 8};
+  static constexpr fltSemantics semFloatTF32 = {127, -126, 11, 19};
+  static constexpr fltSemantics semFloat8E8M0FNU = {
+      127,   -127, 1, 8, fltNonfiniteBehavior::NanOnly, fltNanEncoding::AllOnes,
+      false, false};
+
+  static constexpr fltSemantics semFloat6E3M2FN = {
+      4, -2, 3, 6, fltNonfiniteBehavior::FiniteOnly};
+  static constexpr fltSemantics semFloat6E2M3FN = {
+      2, 0, 4, 6, fltNonfiniteBehavior::FiniteOnly};
+  static constexpr fltSemantics semFloat4E2M1FN = {
+      2, 0, 2, 4, fltNonfiniteBehavior::FiniteOnly};
+  static constexpr fltSemantics semX87DoubleExtended = {16383, -16382, 64, 80};
+  static constexpr fltSemantics semBogus = {0, 0, 0, 0};
+  static constexpr fltSemantics semPPCDoubleDouble = {-1, 0, 0, 128};
+  static constexpr fltSemantics semPPCDoubleDoubleLegacy = {1023, -1022 + 53,
+                                                            53 + 53, 128};
 };
 
 const llvm::fltSemantics &APFloatBase::EnumToSemantics(Semantics S) {
@@ -180,35 +190,69 @@ APFloatBase::SemanticsToEnum(const llvm::fltSemantics &Sem) {
     llvm_unreachable("Unknown floating semantics");
 }
 
-const fltSemantics &APFloatBase::IEEEhalf() { return SupportedFltSemantics::semIEEEhalf; }
-const fltSemantics &APFloatBase::BFloat() { return SupportedFltSemantics::semBFloat; }
-const fltSemantics &APFloatBase::IEEEsingle() { return SupportedFltSemantics::semIEEEsingle; }
-const fltSemantics &APFloatBase::IEEEdouble() { return SupportedFltSemantics::semIEEEdouble; }
-const fltSemantics &APFloatBase::IEEEquad() { return SupportedFltSemantics::semIEEEquad; }
+const fltSemantics &APFloatBase::IEEEhalf() {
+  return SupportedFltSemantics::semIEEEhalf;
+}
+const fltSemantics &APFloatBase::BFloat() {
+  return SupportedFltSemantics::semBFloat;
+}
+const fltSemantics &APFloatBase::IEEEsingle() {
+  return SupportedFltSemantics::semIEEEsingle;
+}
+const fltSemantics &APFloatBase::IEEEdouble() {
+  return SupportedFltSemantics::semIEEEdouble;
+}
+const fltSemantics &APFloatBase::IEEEquad() {
+  return SupportedFltSemantics::semIEEEquad;
+}
 const fltSemantics &APFloatBase::PPCDoubleDouble() {
   return SupportedFltSemantics::semPPCDoubleDouble;
 }
 const fltSemantics &APFloatBase::PPCDoubleDoubleLegacy() {
   return SupportedFltSemantics::semPPCDoubleDoubleLegacy;
 }
-const fltSemantics &APFloatBase::Float8E5M2() { return SupportedFltSemantics::semFloat8E5M2; }
-const fltSemantics &APFloatBase::Float8E5M2FNUZ() { return SupportedFltSemantics::semFloat8E5M2FNUZ; }
-const fltSemantics &APFloatBase::Float8E4M3() { return SupportedFltSemantics::semFloat8E4M3; }
-const fltSemantics &APFloatBase::Float8E4M3FN() { return SupportedFltSemantics::semFloat8E4M3FN; }
-const fltSemantics &APFloatBase::Float8E4M3FNUZ() { return SupportedFltSemantics::semFloat8E4M3FNUZ; }
+const fltSemantics &APFloatBase::Float8E5M2() {
+  return SupportedFltSemantics::semFloat8E5M2;
+}
+const fltSemantics &APFloatBase::Float8E5M2FNUZ() {
+  return SupportedFltSemantics::semFloat8E5M2FNUZ;
+}
+const fltSemantics &APFloatBase::Float8E4M3() {
+  return SupportedFltSemantics::semFloat8E4M3;
+}
+const fltSemantics &APFloatBase::Float8E4M3FN() {
+  return SupportedFltSemantics::semFloat8E4M3FN;
+}
+const fltSemantics &APFloatBase::Float8E4M3FNUZ() {
+  return SupportedFltSemantics::semFloat8E4M3FNUZ;
+}
 const fltSemantics &APFloatBase::Float8E4M3B11FNUZ() {
   return SupportedFltSemantics::semFloat8E4M3B11FNUZ;
 }
-const fltSemantics &APFloatBase::Float8E3M4() { return SupportedFltSemantics::semFloat8E3M4; }
-const fltSemantics &APFloatBase::FloatTF32() { return SupportedFltSemantics::semFloatTF32; }
-const fltSemantics &APFloatBase::Float8E8M0FNU() { return SupportedFltSemantics::semFloat8E8M0FNU; }
-const fltSemantics &APFloatBase::Float6E3M2FN() { return SupportedFltSemantics::semFloat6E3M2FN; }
-const fltSemantics &APFloatBase::Float6E2M3FN() { return SupportedFltSemantics::semFloat6E2M3FN; }
-const fltSemantics &APFloatBase::Float4E2M1FN() { return SupportedFltSemantics::semFloat4E2M1FN; }
+const fltSemantics &APFloatBase::Float8E3M4() {
+  return SupportedFltSemantics::semFloat8E3M4;
+}
+const fltSemantics &APFloatBase::FloatTF32() {
+  return SupportedFltSemantics::semFloatTF32;
+}
+const fltSemantics &APFloatBase::Float8E8M0FNU() {
+  return SupportedFltSemantics::semFloat8E8M0FNU;
+}
+const fltSemantics &APFloatBase::Float6E3M2FN() {
+  return SupportedFltSemantics::semFloat6E3M2FN;
+}
+const fltSemantics &APFloatBase::Float6E2M3FN() {
+  return SupportedFltSemantics::semFloat6E2M3FN;
+}
+const fltSemantics &APFloatBase::Float4E2M1FN() {
+  return SupportedFltSemantics::semFloat4E2M1FN;
+}
 const fltSemantics &APFloatBase::x87DoubleExtended() {
   return SupportedFltSemantics::semX87DoubleExtended;
 }
-const fltSemantics &APFloatBase::Bogus() { return SupportedFltSemantics::semBogus; }
+const fltSemantics &APFloatBase::Bogus() {
+  return SupportedFltSemantics::semBogus;
+}
 
 bool APFloatBase::isRepresentableBy(const fltSemantics &A,
                                     const fltSemantics &B) {
@@ -1091,7 +1135,8 @@ IEEEFloat::IEEEFloat(const IEEEFloat &rhs) {
   assign(rhs);
 }
 
-IEEEFloat::IEEEFloat(IEEEFloat &&rhs) : semantics(&SupportedFltSemantics::semBogus) {
+IEEEFloat::IEEEFloat(IEEEFloat &&rhs)
+    : semantics(&SupportedFltSemantics::semBogus) {
   *this = std::move(rhs);
 }
 
@@ -2431,7 +2476,8 @@ APFloat::opStatus IEEEFloat::convert(const fltSemantics &toSemantics,
 
   bool X86SpecialNan = false;
   if (&fromSemantics == &SupportedFltSemantics::semX87DoubleExtended &&
-      &toSemantics != &SupportedFltSemantics::semX87DoubleExtended && category == fcNaN &&
+      &toSemantics != &SupportedFltSemantics::semX87DoubleExtended &&
+      category == fcNaN &&
       (!(*significandParts() & 0x8000000000000000ULL) ||
        !(*significandParts() & 0x4000000000000000ULL))) {
     // x86 has some unusual NaNs which cannot be represented in any other
@@ -2517,7 +2563,8 @@ APFloat::opStatus IEEEFloat::convert(const fltSemantics &toSemantics,
 
     // For x87 extended precision, we want to make a NaN, not a special NaN if
     // the input wasn't special either.
-    if (!X86SpecialNan && semantics == &SupportedFltSemantics::semX87DoubleExtended)
+    if (!X86SpecialNan &&
+        semantics == &SupportedFltSemantics::semX87DoubleExtended)
       APInt::tcSetBit(significandParts(), semantics->precision - 1);
 
     // Convert of sNaN creates qNaN and raises an exception (invalid op).
@@ -3401,7 +3448,9 @@ hash_code hash_value(const IEEEFloat &Arg) {
 // the actual IEEE respresentations.  We compensate for that here.
 
 APInt IEEEFloat::convertF80LongDoubleAPFloatToAPInt() const {
-  assert(semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semX87DoubleExtended);
+  assert(
+      semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semX87DoubleExtended);
   assert(partCount()==2);
 
   uint64_t myexponent, mysignificand;
@@ -3431,7 +3480,8 @@ APInt IEEEFloat::convertF80LongDoubleAPFloatToAPInt() const {
 }
 
 APInt IEEEFloat::convertPPCDoubleDoubleLegacyAPFloatToAPInt() const {
-  assert(semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semPPCDoubleDoubleLegacy);
+  assert(semantics == (const llvm::fltSemantics
+                           *)&SupportedFltSemantics::semPPCDoubleDoubleLegacy);
   assert(partCount()==2);
 
   uint64_t words[2];
@@ -3445,14 +3495,16 @@ APInt IEEEFloat::convertPPCDoubleDoubleLegacyAPFloatToAPInt() const {
   // Declare fltSemantics before APFloat that uses it (and
   // saves pointer to it) to ensure correct destruction order.
   fltSemantics extendedSemantics = *semantics;
-  extendedSemantics.minExponent = SupportedFltSemantics::semIEEEdouble.minExponent;
+  extendedSemantics.minExponent =
+      SupportedFltSemantics::semIEEEdouble.minExponent;
   IEEEFloat extended(*this);
   fs = extended.convert(extendedSemantics, rmNearestTiesToEven, &losesInfo);
   assert(fs == opOK && !losesInfo);
   (void)fs;
 
   IEEEFloat u(extended);
-  fs = u.convert(SupportedFltSemantics::semIEEEdouble, rmNearestTiesToEven, &losesInfo);
+  fs = u.convert(SupportedFltSemantics::semIEEEdouble, rmNearestTiesToEven,
+                 &losesInfo);
   assert(fs == opOK || fs == opInexact);
   (void)fs;
   words[0] = *u.convertDoubleAPFloatToAPInt().getRawData();
@@ -3468,7 +3520,8 @@ APInt IEEEFloat::convertPPCDoubleDoubleLegacyAPFloatToAPInt() const {
 
     IEEEFloat v(extended);
     v.subtract(u, rmNearestTiesToEven);
-    fs = v.convert(SupportedFltSemantics::semIEEEdouble, rmNearestTiesToEven, &losesInfo);
+    fs = v.convert(SupportedFltSemantics::semIEEEdouble, rmNearestTiesToEven,
+                   &losesInfo);
     assert(fs == opOK && !losesInfo);
     (void)fs;
     words[1] = *v.convertDoubleAPFloatToAPInt().getRawData();
@@ -3482,8 +3535,9 @@ APInt IEEEFloat::convertPPCDoubleDoubleLegacyAPFloatToAPInt() const {
 template <const fltSemantics &S>
 APInt IEEEFloat::convertIEEEFloatToAPInt() const {
   assert(semantics == &S);
-  const int bias =
-      (semantics == &SupportedFltSemantics::semFloat8E8M0FNU) ? -S.minExponent : -(S.minExponent - 1);
+  const int bias = (semantics == &SupportedFltSemantics::semFloat8E8M0FNU)
+                       ? -S.minExponent
+                       : -(S.minExponent - 1);
   constexpr unsigned int trailing_significand_bits = S.precision - 1;
   constexpr int integer_bit_part = trailing_significand_bits / integerPartWidth;
   constexpr integerPart integer_bit =
@@ -3636,82 +3690,106 @@ APInt IEEEFloat::convertFloat4E2M1FNAPFloatToAPInt() const {
 // and treating the result as a normal integer is unlikely to be useful.
 
 APInt IEEEFloat::bitcastToAPInt() const {
-  if (semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semIEEEhalf)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEhalf)
     return convertHalfAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semBFloat)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semBFloat)
     return convertBFloatAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semIEEEsingle)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEsingle)
     return convertFloatAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semIEEEdouble)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEdouble)
     return convertDoubleAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semIEEEquad)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEquad)
     return convertQuadrupleAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semPPCDoubleDoubleLegacy)
+  if (semantics == (const llvm::fltSemantics
+                        *)&SupportedFltSemantics::semPPCDoubleDoubleLegacy)
     return convertPPCDoubleDoubleLegacyAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E5M2)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E5M2)
     return convertFloat8E5M2APFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E5M2FNUZ)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E5M2FNUZ)
     return convertFloat8E5M2FNUZAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3)
     return convertFloat8E4M3APFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3FN)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3FN)
     return convertFloat8E4M3FNAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3FNUZ)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3FNUZ)
     return convertFloat8E4M3FNUZAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3B11FNUZ)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E4M3B11FNUZ)
     return convertFloat8E4M3B11FNUZAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E3M4)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E3M4)
     return convertFloat8E3M4APFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloatTF32)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloatTF32)
     return convertFloatTF32APFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E8M0FNU)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat8E8M0FNU)
     return convertFloat8E8M0FNUAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat6E3M2FN)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat6E3M2FN)
     return convertFloat6E3M2FNAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat6E2M3FN)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat6E2M3FN)
     return convertFloat6E2M3FNAPFloatToAPInt();
 
-  if (semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat4E2M1FN)
+  if (semantics ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semFloat4E2M1FN)
     return convertFloat4E2M1FNAPFloatToAPInt();
 
-  assert(semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semX87DoubleExtended &&
+  assert(semantics == (const llvm::fltSemantics
+                           *)&SupportedFltSemantics::semX87DoubleExtended &&
          "unknown format!");
   return convertF80LongDoubleAPFloatToAPInt();
 }
 
 float IEEEFloat::convertToFloat() const {
-  assert(semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semIEEEsingle &&
-         "Float semantics are not IEEEsingle");
+  assert(
+      semantics ==
+          (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEsingle &&
+      "Float semantics are not IEEEsingle");
   APInt api = bitcastToAPInt();
   return api.bitsToFloat();
 }
 
 double IEEEFloat::convertToDouble() const {
-  assert(semantics == (const llvm::fltSemantics*)&SupportedFltSemantics::semIEEEdouble &&
-         "Float semantics are not IEEEdouble");
+  assert(
+      semantics ==
+          (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEdouble &&
+      "Float semantics are not IEEEdouble");
   APInt api = bitcastToAPInt();
   return api.bitsToDouble();
 }
 
 #ifdef HAS_IEE754_FLOAT128
 float128 IEEEFloat::convertToQuad() const {
-  assert(semantics == (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEquad &&
+  assert(semantics ==
+             (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEquad &&
          "Float semantics are not IEEEquads");
   APInt api = bitcastToAPInt();
   return api.bitsToQuad();
@@ -3764,14 +3842,16 @@ void IEEEFloat::initFromPPCDoubleDoubleLegacyAPInt(const APInt &api) {
 
   // Get the first double and convert to our format.
   initFromDoubleAPInt(APInt(64, i1));
-  fs = convert(SupportedFltSemantics::semPPCDoubleDoubleLegacy, rmNearestTiesToEven, &losesInfo);
+  fs = convert(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+               rmNearestTiesToEven, &losesInfo);
   assert(fs == opOK && !losesInfo);
   (void)fs;
 
   // Unless we have a special case, add in second double.
   if (isFiniteNonZero()) {
     IEEEFloat v(SupportedFltSemantics::semIEEEdouble, APInt(64, i2));
-    fs = v.convert(SupportedFltSemantics::semPPCDoubleDoubleLegacy, rmNearestTiesToEven, &losesInfo);
+    fs = v.convert(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+                   rmNearestTiesToEven, &losesInfo);
     assert(fs == opOK && !losesInfo);
     (void)fs;
 
@@ -4714,28 +4794,32 @@ IEEEFloat frexp(const IEEEFloat &Val, int &Exp, roundingMode RM) {
 
 DoubleAPFloat::DoubleAPFloat(const fltSemantics &S)
     : Semantics(&S),
-      Floats(new APFloat[2]{APFloat(SupportedFltSemantics::semIEEEdouble), APFloat(SupportedFltSemantics::semIEEEdouble)}) {
+      Floats(new APFloat[2]{APFloat(SupportedFltSemantics::semIEEEdouble),
+                            APFloat(SupportedFltSemantics::semIEEEdouble)}) {
   assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble);
 }
 
 DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, uninitializedTag)
     : Semantics(&S),
-      Floats(new APFloat[2]{APFloat(SupportedFltSemantics::semIEEEdouble, uninitialized),
-                            APFloat(SupportedFltSemantics::semIEEEdouble, uninitialized)}) {
+      Floats(new APFloat[2]{
+          APFloat(SupportedFltSemantics::semIEEEdouble, uninitialized),
+          APFloat(SupportedFltSemantics::semIEEEdouble, uninitialized)}) {
   assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble);
 }
 
 DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, integerPart I)
-    : Semantics(&S), Floats(new APFloat[2]{APFloat(SupportedFltSemantics::semIEEEdouble, I),
-                                           APFloat(SupportedFltSemantics::semIEEEdouble)}) {
+    : Semantics(&S),
+      Floats(new APFloat[2]{APFloat(SupportedFltSemantics::semIEEEdouble, I),
+                            APFloat(SupportedFltSemantics::semIEEEdouble)}) {
   assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble);
 }
 
 DoubleAPFloat::DoubleAPFloat(const fltSemantics &S, const APInt &I)
     : Semantics(&S),
-      Floats(new APFloat[2]{
-          APFloat(SupportedFltSemantics::semIEEEdouble, APInt(64, I.getRawData()[0])),
-          APFloat(SupportedFltSemantics::semIEEEdouble, APInt(64, I.getRawData()[1]))}) {
+      Floats(new APFloat[2]{APFloat(SupportedFltSemantics::semIEEEdouble,
+                                    APInt(64, I.getRawData()[0])),
+                            APFloat(SupportedFltSemantics::semIEEEdouble,
+                                    APInt(64, I.getRawData()[1]))}) {
   assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble);
 }
 
@@ -4896,8 +4980,10 @@ APFloat::opStatus DoubleAPFloat::addWithSpecial(const DoubleAPFloat &LHS,
   assert(&AA.getSemantics() == &SupportedFltSemantics::semIEEEdouble);
   assert(&C.getSemantics() == &SupportedFltSemantics::semIEEEdouble);
   assert(&CC.getSemantics() == &SupportedFltSemantics::semIEEEdouble);
-  assert(&Out.Floats[0].getSemantics() == &SupportedFltSemantics::semIEEEdouble);
-  assert(&Out.Floats[1].getSemantics() == &SupportedFltSemantics::semIEEEdouble);
+  assert(&Out.Floats[0].getSemantics() ==
+         &SupportedFltSemantics::semIEEEdouble);
+  assert(&Out.Floats[1].getSemantics() ==
+         &SupportedFltSemantics::semIEEEdouble);
   return Out.addImpl(A, AA, C, CC, RM);
 }
 
@@ -5002,28 +5088,39 @@ APFloat::opStatus DoubleAPFloat::multiply(const DoubleAPFloat &RHS,
 
 APFloat::opStatus DoubleAPFloat::divide(const DoubleAPFloat &RHS,
                                         APFloat::roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
-  auto Ret =
-      Tmp.divide(APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, RHS.bitcastToAPInt()), RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
+  auto Ret = Tmp.divide(APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+                                RHS.bitcastToAPInt()),
+                        RM);
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
 APFloat::opStatus DoubleAPFloat::remainder(const DoubleAPFloat &RHS) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
-  auto Ret =
-      Tmp.remainder(APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, RHS.bitcastToAPInt()));
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
+  auto Ret = Tmp.remainder(APFloat(
+      SupportedFltSemantics::semPPCDoubleDoubleLegacy, RHS.bitcastToAPInt()));
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
 APFloat::opStatus DoubleAPFloat::mod(const DoubleAPFloat &RHS) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
-  auto Ret = Tmp.mod(APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, RHS.bitcastToAPInt()));
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
+  auto Ret = Tmp.mod(APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+                             RHS.bitcastToAPInt()));
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
@@ -5031,20 +5128,29 @@ APFloat::opStatus
 DoubleAPFloat::fusedMultiplyAdd(const DoubleAPFloat &Multiplicand,
                                 const DoubleAPFloat &Addend,
                                 APFloat::roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
   auto Ret = Tmp.fusedMultiplyAdd(
-      APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, Multiplicand.bitcastToAPInt()),
-      APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, Addend.bitcastToAPInt()), RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+      APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              Multiplicand.bitcastToAPInt()),
+      APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              Addend.bitcastToAPInt()),
+      RM);
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
 APFloat::opStatus DoubleAPFloat::roundToIntegral(APFloat::roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
   auto Ret = Tmp.roundToIntegral(RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
@@ -5091,22 +5197,28 @@ void DoubleAPFloat::makeZero(bool Neg) {
 }
 
 void DoubleAPFloat::makeLargest(bool Neg) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  Floats[0] = APFloat(SupportedFltSemantics::semIEEEdouble, APInt(64, 0x7fefffffffffffffull));
-  Floats[1] = APFloat(SupportedFltSemantics::semIEEEdouble, APInt(64, 0x7c8ffffffffffffeull));
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  Floats[0] = APFloat(SupportedFltSemantics::semIEEEdouble,
+                      APInt(64, 0x7fefffffffffffffull));
+  Floats[1] = APFloat(SupportedFltSemantics::semIEEEdouble,
+                      APInt(64, 0x7c8ffffffffffffeull));
   if (Neg)
     changeSign();
 }
 
 void DoubleAPFloat::makeSmallest(bool Neg) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   Floats[0].makeSmallest(Neg);
   Floats[1].makeZero(/* Neg = */ false);
 }
 
 void DoubleAPFloat::makeSmallestNormalized(bool Neg) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  Floats[0] = APFloat(SupportedFltSemantics::semIEEEdouble, APInt(64, 0x0360000000000000ull));
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  Floats[0] = APFloat(SupportedFltSemantics::semIEEEdouble,
+                      APInt(64, 0x0360000000000000ull));
   if (Neg)
     Floats[0].changeSign();
   Floats[1].makeZero(/* Neg = */ false);
@@ -5137,7 +5249,8 @@ hash_code hash_value(const DoubleAPFloat &Arg) {
 }
 
 APInt DoubleAPFloat::bitcastToAPInt() const {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   uint64_t Data[] = {
       Floats[0].bitcastToAPInt().getRawData()[0],
       Floats[1].bitcastToAPInt().getRawData()[0],
@@ -5147,18 +5260,23 @@ APInt DoubleAPFloat::bitcastToAPInt() const {
 
 Expected<APFloat::opStatus> DoubleAPFloat::convertFromString(StringRef S,
                                                              roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy);
   auto Ret = Tmp.convertFromString(S, RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
 APFloat::opStatus DoubleAPFloat::next(bool nextDown) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
   auto Ret = Tmp.next(nextDown);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
@@ -5166,18 +5284,22 @@ APFloat::opStatus
 DoubleAPFloat::convertToInteger(MutableArrayRef<integerPart> Input,
                                 unsigned int Width, bool IsSigned,
                                 roundingMode RM, bool *IsExact) const {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  return APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt())
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  return APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+                 bitcastToAPInt())
       .convertToInteger(Input, Width, IsSigned, RM, IsExact);
 }
 
 APFloat::opStatus DoubleAPFloat::convertFromAPInt(const APInt &Input,
                                                   bool IsSigned,
                                                   roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy);
   auto Ret = Tmp.convertFromAPInt(Input, IsSigned, RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
@@ -5185,10 +5307,12 @@ APFloat::opStatus
 DoubleAPFloat::convertFromSignExtendedInteger(const integerPart *Input,
                                               unsigned int InputSize,
                                               bool IsSigned, roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy);
   auto Ret = Tmp.convertFromSignExtendedInteger(Input, InputSize, IsSigned, RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
@@ -5196,10 +5320,12 @@ APFloat::opStatus
 DoubleAPFloat::convertFromZeroExtendedInteger(const integerPart *Input,
                                               unsigned int InputSize,
                                               bool IsSigned, roundingMode RM) {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy);
   auto Ret = Tmp.convertFromZeroExtendedInteger(Input, InputSize, IsSigned, RM);
-  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, Tmp.bitcastToAPInt());
+  *this = DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                        Tmp.bitcastToAPInt());
   return Ret;
 }
 
@@ -5207,8 +5333,10 @@ unsigned int DoubleAPFloat::convertToHexString(char *DST,
                                                unsigned int HexDigits,
                                                bool UpperCase,
                                                roundingMode RM) const {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  return APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt())
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  return APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+                 bitcastToAPInt())
       .convertToHexString(DST, HexDigits, UpperCase, RM);
 }
 
@@ -5245,7 +5373,8 @@ bool DoubleAPFloat::isLargest() const {
 }
 
 bool DoubleAPFloat::isInteger() const {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   return Floats[0].isInteger() && Floats[1].isInteger();
 }
 
@@ -5253,19 +5382,23 @@ void DoubleAPFloat::toString(SmallVectorImpl<char> &Str,
                              unsigned FormatPrecision,
                              unsigned FormatMaxPadding,
                              bool TruncateZero) const {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   APFloat(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt())
       .toString(Str, FormatPrecision, FormatMaxPadding, TruncateZero);
 }
 
 bool DoubleAPFloat::getExactInverse(APFloat *inv) const {
-  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy, bitcastToAPInt());
+  assert(Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  APFloat Tmp(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+              bitcastToAPInt());
   if (!inv)
     return Tmp.getExactInverse(nullptr);
   APFloat Inv(SupportedFltSemantics::semPPCDoubleDoubleLegacy);
   auto Ret = Tmp.getExactInverse(&Inv);
-  *inv = APFloat(SupportedFltSemantics::semPPCDoubleDouble, Inv.bitcastToAPInt());
+  *inv =
+      APFloat(SupportedFltSemantics::semPPCDoubleDouble, Inv.bitcastToAPInt());
   return Ret;
 }
 
@@ -5281,19 +5414,23 @@ int DoubleAPFloat::getExactLog2Abs() const {
 
 DoubleAPFloat scalbn(const DoubleAPFloat &Arg, int Exp,
                      APFloat::roundingMode RM) {
-  assert(Arg.Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
-  return DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, scalbn(Arg.Floats[0], Exp, RM),
+  assert(Arg.Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
+  return DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                       scalbn(Arg.Floats[0], Exp, RM),
                        scalbn(Arg.Floats[1], Exp, RM));
 }
 
 DoubleAPFloat frexp(const DoubleAPFloat &Arg, int &Exp,
                     APFloat::roundingMode RM) {
-  assert(Arg.Semantics == &SupportedFltSemantics::semPPCDoubleDouble && "Unexpected Semantics");
+  assert(Arg.Semantics == &SupportedFltSemantics::semPPCDoubleDouble &&
+         "Unexpected Semantics");
   APFloat First = frexp(Arg.Floats[0], Exp, RM);
   APFloat Second = Arg.Floats[1];
   if (Arg.getCategory() == APFloat::fcNormal)
     Second = scalbn(Second, -Exp, RM);
-  return DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble, std::move(First), std::move(Second));
+  return DoubleAPFloat(SupportedFltSemantics::semPPCDoubleDouble,
+                       std::move(First), std::move(Second));
 }
 
 } // namespace detail
@@ -5305,9 +5442,8 @@ APFloat::Storage::Storage(IEEEFloat F, const fltSemantics &Semantics) {
   }
   if (usesLayout<DoubleAPFloat>(Semantics)) {
     const fltSemantics& S = F.getSemantics();
-    new (&Double)
-        DoubleAPFloat(Semantics, APFloat(std::move(F), S),
-                      APFloat(SupportedFltSemantics::semIEEEdouble));
+    new (&Double) DoubleAPFloat(Semantics, APFloat(std::move(F), S),
+                                APFloat(SupportedFltSemantics::semIEEEdouble));
     return;
   }
   llvm_unreachable("Unexpected semantics");
@@ -5358,7 +5494,8 @@ APFloat::opStatus APFloat::convert(const fltSemantics &ToSemantics,
   if (usesLayout<IEEEFloat>(getSemantics()) &&
       usesLayout<DoubleAPFloat>(ToSemantics)) {
     assert(&ToSemantics == &SupportedFltSemantics::semPPCDoubleDouble);
-    auto Ret = U.IEEE.convert(SupportedFltSemantics::semPPCDoubleDoubleLegacy, RM, losesInfo);
+    auto Ret = U.IEEE.convert(SupportedFltSemantics::semPPCDoubleDoubleLegacy,
+                              RM, losesInfo);
     *this = APFloat(ToSemantics, U.IEEE.bitcastToAPInt());
     return Ret;
   }
@@ -5409,13 +5546,16 @@ APFloat::opStatus APFloat::convertToInteger(APSInt &result,
 }
 
 double APFloat::convertToDouble() const {
-  if (&getSemantics() == (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEdouble)
+  if (&getSemantics() ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEdouble)
     return getIEEE().convertToDouble();
-  assert(isRepresentableBy(getSemantics(), SupportedFltSemantics::semIEEEdouble) &&
-         "Float semantics is not representable by IEEEdouble");
+  assert(
+      isRepresentableBy(getSemantics(), SupportedFltSemantics::semIEEEdouble) &&
+      "Float semantics is not representable by IEEEdouble");
   APFloat Temp = *this;
   bool LosesInfo;
-  opStatus St = Temp.convert(SupportedFltSemantics::semIEEEdouble, rmNearestTiesToEven, &LosesInfo);
+  opStatus St = Temp.convert(SupportedFltSemantics::semIEEEdouble,
+                             rmNearestTiesToEven, &LosesInfo);
   assert(!(St & opInexact) && !LosesInfo && "Unexpected imprecision");
   (void)St;
   return Temp.getIEEE().convertToDouble();
@@ -5423,13 +5563,16 @@ double APFloat::convertToDouble() const {
 
 #ifdef HAS_IEE754_FLOAT128
 float128 APFloat::convertToQuad() const {
-  if (&getSemantics() == (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEquad)
+  if (&getSemantics() ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEquad)
     return getIEEE().convertToQuad();
-  assert(isRepresentableBy(getSemantics(), SupportedFltSemantics::semIEEEquad) &&
-         "Float semantics is not representable by IEEEquad");
+  assert(
+      isRepresentableBy(getSemantics(), SupportedFltSemantics::semIEEEquad) &&
+      "Float semantics is not representable by IEEEquad");
   APFloat Temp = *this;
   bool LosesInfo;
-  opStatus St = Temp.convert(SupportedFltSemantics::semIEEEquad, rmNearestTiesToEven, &LosesInfo);
+  opStatus St = Temp.convert(SupportedFltSemantics::semIEEEquad,
+                             rmNearestTiesToEven, &LosesInfo);
   assert(!(St & opInexact) && !LosesInfo && "Unexpected imprecision");
   (void)St;
   return Temp.getIEEE().convertToQuad();
@@ -5437,13 +5580,16 @@ float128 APFloat::convertToQuad() const {
 #endif
 
 float APFloat::convertToFloat() const {
-  if (&getSemantics() == (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEsingle)
+  if (&getSemantics() ==
+      (const llvm::fltSemantics *)&SupportedFltSemantics::semIEEEsingle)
     return getIEEE().convertToFloat();
-  assert(isRepresentableBy(getSemantics(), SupportedFltSemantics::semIEEEsingle) &&
-         "Float semantics is not representable by IEEEsingle");
+  assert(
+      isRepresentableBy(getSemantics(), SupportedFltSemantics::semIEEEsingle) &&
+      "Float semantics is not representable by IEEEsingle");
   APFloat Temp = *this;
   bool LosesInfo;
-  opStatus St = Temp.convert(SupportedFltSemantics::semIEEEsingle, rmNearestTiesToEven, &LosesInfo);
+  opStatus St = Temp.convert(SupportedFltSemantics::semIEEEsingle,
+                             rmNearestTiesToEven, &LosesInfo);
   assert(!(St & opInexact) && !LosesInfo && "Unexpected imprecision");
   (void)St;
   return Temp.getIEEE().convertToFloat();
diff --git a/llvm/lib/Support/Z3Solver.cpp b/llvm/lib/Support/Z3Solver.cpp
index f901c7605e..cdd07dd66d 100644
--- a/llvm/lib/Support/Z3Solver.cpp
+++ b/llvm/lib/Support/Z3Solver.cpp
@@ -756,8 +756,7 @@ public:
   }
 
   SMTExprRef mkFloat(const llvm::APFloat Float) override {
-    SMTSortRef Sort =
-        getFloatSort(Float.getSemantics().sizeInBits);
+    SMTSortRef Sort = getFloatSort(Float.getSemantics().sizeInBits);
 
     llvm::APSInt Int = llvm::APSInt(Float.bitcastToAPInt(), false);
     SMTExprRef Z3Int = mkBitvector(Int, Int.getBitWidth());
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 903c58fc67..156a832777 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -377,8 +377,7 @@ static bool canEvaluateTruncated(Value *V, Type *Ty, InstCombinerImpl &IC,
     Type *InputTy = I->getOperand(0)->getType()->getScalarType();
     const fltSemantics &Semantics = InputTy->getFltSemantics();
     uint32_t MinBitWidth =
-      Semantics.intSizeInBits(
-          I->getOpcode() == Instruction::FPToSI);
+        Semantics.intSizeInBits(I->getOpcode() == Instruction::FPToSI);
     return Ty->getScalarSizeInBits() >= MinBitWidth;
   }
   case Instruction::ShuffleVector:
diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp
index 932f6311dc..2f2fabaee5 100644
--- a/llvm/lib/Transforms/Scalar/Float2Int.cpp
+++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp
@@ -364,8 +364,8 @@ bool Float2IntPass::validateAndTransform(const DataLayout &DL) {
     // Do we need more bits than are in the mantissa of the type we converted
     // to? semantics.precision returns the number of mantissa bits plus one
     // for the sign bit.
-    unsigned MaxRepresentableBits
-      = ConvertedToTy->getFltSemantics().precision - 1;
+    unsigned MaxRepresentableBits =
+        ConvertedToTy->getFltSemantics().precision - 1;
     if (MinBW > MaxRepresentableBits) {
       LLVM_DEBUG(dbgs() << "F2I: Value not guaranteed to be representable!\n");
       continue;
diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp
index 3cee777814..fc22a95917 100644
--- a/llvm/unittests/ADT/APFloatTest.cpp
+++ b/llvm/unittests/ADT/APFloatTest.cpp
@@ -7487,7 +7487,8 @@ TEST(APFloatTest, Float8E8M0FNUGetExactLog2) {
   EXPECT_EQ(-2, APFloat(Semantics, "0.25").getExactLog2());
   EXPECT_EQ(-2, APFloat(Semantics, "0.25").getExactLog2Abs());
 
-  int MinExp = Semantics.minExponent;;
+  int MinExp = Semantics.minExponent;
+  ;
   int MaxExp = Semantics.maxExponent;
   int Precision = Semantics.precision;
 
diff --git a/llvm/unittests/IR/ConstantFPRangeTest.cpp b/llvm/unittests/IR/ConstantFPRangeTest.cpp
index cb22abaf56..fc7c11dc11 100644
--- a/llvm/unittests/IR/ConstantFPRangeTest.cpp
+++ b/llvm/unittests/IR/ConstantFPRangeTest.cpp
@@ -91,8 +91,7 @@ static void EnumerateConstantFPRangesImpl(Fn TestFn, bool Exhaustive,
     Values.push_back(APFloat::getInf(Sem, /*Negative=*/true));
     Values.push_back(APFloat::getLargest(Sem, /*Negative=*/true));
     unsigned BitWidth = Sem.sizeInBits;
-    unsigned Exponents = Sem.maxExponent -
-                         Sem.minExponent + 3;
+    unsigned Exponents = Sem.maxExponent - Sem.minExponent + 3;
     unsigned MantissaBits = APFloat::semanticsPrecision(Sem) - 1;
     // Add -2^(max exponent), -2^(max exponent-1), ..., -2^(min exponent)
     for (unsigned M = Exponents - 2; M != 0; --M)
diff --git a/mlir/lib/IR/BuiltinTypeInterfaces.cpp b/mlir/lib/IR/BuiltinTypeInterfaces.cpp
index 478cdec8df..bb23eec586 100644
--- a/mlir/lib/IR/BuiltinTypeInterfaces.cpp
+++ b/mlir/lib/IR/BuiltinTypeInterfaces.cpp
@@ -24,9 +24,7 @@ using namespace mlir::detail;
 // FloatType
 //===----------------------------------------------------------------------===//
 
-unsigned FloatType::getWidth() {
-  return getFloatSemantics().sizeInBits;
-}
+unsigned FloatType::getWidth() { return getFloatSemantics().sizeInBits; }
 
 unsigned FloatType::getFPMantissaWidth() {
   return getFloatSemantics().precision;

``````````

</details>


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


More information about the lldb-commits mailing list