[clang] [llvm] [APFloat] Add APFloat support for FP6 data types (PR #94735)

Durgadoss R via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 06:59:52 PDT 2024


================
@@ -1881,6 +1890,20 @@ TEST(APFloatTest, getSmallest) {
   EXPECT_TRUE(test.isFiniteNonZero());
   EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));
+
+  test = APFloat::getSmallest(APFloat::Float6E3M2FN(), false);
+  expected = APFloat(APFloat::Float6E3M2FN(), "0x0.1p0");
+  EXPECT_FALSE(test.isNegative());
+  EXPECT_TRUE(test.isFiniteNonZero());
+  EXPECT_TRUE(test.isDenormal());
+  EXPECT_TRUE(test.bitwiseIsEqual(expected));
+
+  test = APFloat::getSmallest(APFloat::Float6E2M3FN(), false);
+  expected = APFloat(APFloat::Float6E2M3FN(), "0x0.2p0");
+  EXPECT_FALSE(test.isNegative());
+  EXPECT_TRUE(test.isFiniteNonZero());
+  EXPECT_TRUE(test.isDenormal());
+  EXPECT_TRUE(test.bitwiseIsEqual(expected));
 }
 
----------------
durga4github wrote:

Yes, the getZero test is added below.
We have added tests for get{Zero/Largest/Smallest/SmallestNormalized} and negative tests for get{Nan/Inf} cases.

Please let me know if I am still missing something.


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


More information about the llvm-commits mailing list