[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 7 01:50:31 PDT 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 ac404632f991fc6e7dc75ef553a99676ba8002ce 21432aeaeecc6ba06de252c460e5cb09abb68a29 -- clang/lib/AST/MicrosoftMangle.cpp 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 b8ca56d96e..04d54ee663 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -1531,7 +1531,7 @@ IEEEFloat::opStatus IEEEFloat::handleOverflow(roundingMode rounding_mode) {
makeNaN(false, sign);
else
category = fcInfinity;
- return (opStatus) (opOverflow | opInexact);
+ return (opStatus)(opOverflow | opInexact);
}
}
diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp
index d80442b066..6b21afb52f 100644
--- a/llvm/unittests/ADT/APFloatTest.cpp
+++ b/llvm/unittests/ADT/APFloatTest.cpp
@@ -735,7 +735,6 @@ TEST(APFloatTest, IsSmallestNormalized) {
EXPECT_FALSE(APFloat::getSNaN(Semantics).isSmallestNormalized());
}
-
EXPECT_FALSE(APFloat::getLargest(Semantics).isSmallestNormalized());
EXPECT_FALSE(APFloat::getLargest(Semantics, true).isSmallestNormalized());
@@ -1830,8 +1829,7 @@ TEST(APFloatTest, getLargest) {
30, APFloat::getLargest(APFloat::Float8E4M3B11FNUZ()).convertToDouble());
EXPECT_EQ(3.40116213421e+38f,
APFloat::getLargest(APFloat::FloatTF32()).convertToFloat());
- EXPECT_EQ(28,
- APFloat::getLargest(APFloat::Float6E3M2FN()).convertToDouble());
+ EXPECT_EQ(28, APFloat::getLargest(APFloat::Float6E3M2FN()).convertToDouble());
EXPECT_EQ(7.5,
APFloat::getLargest(APFloat::Float6E2M3FN()).convertToDouble());
}
@@ -1906,7 +1904,6 @@ TEST(APFloatTest, getSmallest) {
EXPECT_TRUE(test.isFiniteNonZero());
EXPECT_TRUE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
-
}
TEST(APFloatTest, getSmallestNormalized) {
@@ -2004,7 +2001,6 @@ TEST(APFloatTest, getSmallestNormalized) {
EXPECT_FALSE(test.isDenormal());
EXPECT_TRUE(test.bitwiseIsEqual(expected));
EXPECT_TRUE(test.isSmallestNormalized());
-
}
TEST(APFloatTest, getZero) {
@@ -7025,8 +7021,7 @@ TEST(APFloatTest, Float6E3M2FNToDouble) {
APFloat::getSmallestNormalized(APFloat::Float6E3M2FN(), true);
EXPECT_EQ(-0x1p-2, NegSmallest.convertToDouble());
- APFloat SmallestDenorm =
- APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
+ APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
EXPECT_TRUE(SmallestDenorm.isDenormal());
EXPECT_EQ(0x0.1p0, SmallestDenorm.convertToDouble());
}
@@ -7047,8 +7042,7 @@ TEST(APFloatTest, Float6E2M3FNToDouble) {
APFloat::getSmallestNormalized(APFloat::Float6E2M3FN(), true);
EXPECT_EQ(-0x1p0, NegSmallest.convertToDouble());
- APFloat SmallestDenorm =
- APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
+ APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
EXPECT_TRUE(SmallestDenorm.isDenormal());
EXPECT_EQ(0x0.2p0, SmallestDenorm.convertToDouble());
}
@@ -7077,8 +7071,7 @@ TEST(APFloatTest, Float6E3M2FNToFloat) {
APFloat::getSmallestNormalized(APFloat::Float6E3M2FN(), true);
EXPECT_EQ(-0x1p-2, NegSmallest.convertToFloat());
- APFloat SmallestDenorm =
- APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
+ APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
EXPECT_TRUE(SmallestDenorm.isDenormal());
EXPECT_EQ(0x0.1p0, SmallestDenorm.convertToFloat());
}
@@ -7107,8 +7100,7 @@ TEST(APFloatTest, Float6E2M3FNToFloat) {
APFloat::getSmallestNormalized(APFloat::Float6E2M3FN(), true);
EXPECT_EQ(-0x1p0, NegSmallest.convertToFloat());
- APFloat SmallestDenorm =
- APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
+ APFloat SmallestDenorm = APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
EXPECT_TRUE(SmallestDenorm.isDenormal());
EXPECT_EQ(0x0.2p0, SmallestDenorm.convertToFloat());
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/94735
More information about the cfe-commits
mailing list