[clang] [llvm] [llvm][NFC] `APFloat`: Add missing semantics to enum (PR #117291)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 22:09:31 PST 2024


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 836d2dcf601a736804670ba6fbc85ec5cfbfeff1 35848f59ef8a680e0ed264c5fb03edb7d4a6d6ff --extensions cpp,h -- clang/include/clang/AST/Expr.h llvm/include/llvm/ADT/APFloat.h llvm/lib/Support/APFloat.cpp llvm/unittests/ADT/APFloatTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 25ca7a6b7f..c0c451efa7 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -137,23 +137,23 @@ struct fltSemantics {
   }
 };
 
-static constexpr fltSemantics semIEEEhalf = {
-    APFloatBase::S_IEEEhalf, 15, -14, 11, 16};
-static constexpr fltSemantics semBFloat = {
-    APFloatBase::S_BFloat, 127, -126, 8, 16};
-static constexpr fltSemantics semIEEEsingle = {
-    APFloatBase::S_IEEEsingle, 127, -126, 24, 32};
-static constexpr fltSemantics semIEEEdouble = {
-    APFloatBase::S_IEEEdouble, 1023, -1022, 53, 64};
-static constexpr fltSemantics semIEEEquad = {
-    APFloatBase::S_IEEEquad, 16383, -16382, 113, 128};
-static constexpr fltSemantics semFloat8E5M2 = {
-    APFloatBase::S_Float8E5M2, 15, -14, 3, 8};
+static constexpr fltSemantics semIEEEhalf = {APFloatBase::S_IEEEhalf, 15, -14,
+                                             11, 16};
+static constexpr fltSemantics semBFloat = {APFloatBase::S_BFloat, 127, -126, 8,
+                                           16};
+static constexpr fltSemantics semIEEEsingle = {APFloatBase::S_IEEEsingle, 127,
+                                               -126, 24, 32};
+static constexpr fltSemantics semIEEEdouble = {APFloatBase::S_IEEEdouble, 1023,
+                                               -1022, 53, 64};
+static constexpr fltSemantics semIEEEquad = {APFloatBase::S_IEEEquad, 16383,
+                                             -16382, 113, 128};
+static constexpr fltSemantics semFloat8E5M2 = {APFloatBase::S_Float8E5M2, 15,
+                                               -14, 3, 8};
 static constexpr fltSemantics semFloat8E5M2FNUZ = {
     APFloatBase::S_Float8E5M2FNUZ, 15, -15, 3, 8, fltNonfiniteBehavior::NanOnly,
     fltNanEncoding::NegativeZero};
-static constexpr fltSemantics semFloat8E4M3 = {
-    APFloatBase::S_Float8E4M3, 7, -6, 4, 8};
+static constexpr fltSemantics semFloat8E4M3 = {APFloatBase::S_Float8E4M3, 7, -6,
+                                               4, 8};
 static constexpr fltSemantics semFloat8E4M3FN = {
     APFloatBase::S_Float8E4M3FN, 8, -6, 4, 8, fltNonfiniteBehavior::NanOnly,
     fltNanEncoding::AllOnes};
@@ -161,15 +161,26 @@ static constexpr fltSemantics semFloat8E4M3FNUZ = {
     APFloatBase::S_Float8E4M3FNUZ, 7, -7, 4, 8, fltNonfiniteBehavior::NanOnly,
     fltNanEncoding::NegativeZero};
 static constexpr fltSemantics semFloat8E4M3B11FNUZ = {
-    APFloatBase::S_Float8E4M3B11FNUZ, 4, -10, 4, 8, fltNonfiniteBehavior::NanOnly,
+    APFloatBase::S_Float8E4M3B11FNUZ,
+    4,
+    -10,
+    4,
+    8,
+    fltNonfiniteBehavior::NanOnly,
     fltNanEncoding::NegativeZero};
-static constexpr fltSemantics semFloat8E3M4 = {
-    APFloatBase::S_Float8E3M4, 3, -2, 5, 8};
-static constexpr fltSemantics semFloatTF32 = {
-    APFloatBase::S_FloatTF32, 127, -126, 11, 19};
-static constexpr fltSemantics semFloat8E8M0FNU = {
-    APFloatBase::S_Float8E8M0FNU, 127, -127, 1, 8, fltNonfiniteBehavior::NanOnly,
-    fltNanEncoding::AllOnes, false, false};
+static constexpr fltSemantics semFloat8E3M4 = {APFloatBase::S_Float8E3M4, 3, -2,
+                                               5, 8};
+static constexpr fltSemantics semFloatTF32 = {APFloatBase::S_FloatTF32, 127,
+                                              -126, 11, 19};
+static constexpr fltSemantics semFloat8E8M0FNU = {APFloatBase::S_Float8E8M0FNU,
+                                                  127,
+                                                  -127,
+                                                  1,
+                                                  8,
+                                                  fltNonfiniteBehavior::NanOnly,
+                                                  fltNanEncoding::AllOnes,
+                                                  false,
+                                                  false};
 static constexpr fltSemantics semFloat6E3M2FN = {
     APFloatBase::S_Float6E3M2FN, 4, -2, 3, 6, fltNonfiniteBehavior::FiniteOnly};
 static constexpr fltSemantics semFloat6E2M3FN = {
@@ -179,10 +190,11 @@ static constexpr fltSemantics semFloat4E2M1FN = {
 static constexpr fltSemantics semX87DoubleExtended = {
     APFloatBase::S_x87DoubleExtended, 16383, -16382, 64, 80};
 static constexpr fltSemantics semBogus = {APFloatBase::S_Bogus, 0, 0, 0, 0};
-static constexpr fltSemantics semPPCDoubleDouble = {APFloatBase::S_PPCDoubleDouble, -1, 0, 0, 128};
+static constexpr fltSemantics semPPCDoubleDouble = {
+    APFloatBase::S_PPCDoubleDouble, -1, 0, 0, 128};
 
-static constexpr fltSemantics semPPCDoubleDoubleLegacy = {APFloatBase::S_PPCDoubleDoubleLegacy, 1023, -1022 + 53,
-                                                          53 + 53, 128};
+static constexpr fltSemantics semPPCDoubleDoubleLegacy = {
+    APFloatBase::S_PPCDoubleDoubleLegacy, 1023, -1022 + 53, 53 + 53, 128};
 
 const llvm::fltSemantics &APFloatBase::getSemantics(Semantics S) {
   switch (S) {
@@ -2984,7 +2996,8 @@ IEEEFloat::roundSignificandWithExponent(const integerPart *decSigParts,
                                         unsigned sigPartCount, int exp,
                                         roundingMode rounding_mode) {
   unsigned int parts, pow5PartCount;
-  fltSemantics calcSemantics = { APFloatBase::S_MaxSemantics, 32767, -32767, 0, 0 };
+  fltSemantics calcSemantics = {APFloatBase::S_MaxSemantics, 32767, -32767, 0,
+                                0};
   integerPart pow5Parts[maxPowerOfFiveParts];
   bool isNearest;
 

``````````

</details>


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


More information about the cfe-commits mailing list