[llvm] [APFloat] Add APFloat support for E8M0 type (PR #107127)

Durgadoss R via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 06:36:21 PDT 2024


================
@@ -7135,6 +7275,69 @@ TEST(APFloatTest, getExactLog2) {
   }
 }
 
+TEST(APFloatTest, Float8E8M0FNGetZero) {
+#ifdef GTEST_HAS_DEATH_TEST
+#ifndef NDEBUG
+  EXPECT_DEATH(APFloat::getZero(APFloat::Float8E8M0FN(), false),
+               "This floating point format does not support Zero");
+  EXPECT_DEATH(APFloat::getZero(APFloat::Float8E8M0FN(), true),
+               "This floating point format does not support Zero");
+#endif
+#endif
+}
+
+TEST(APFloatTest, Float8E8M0FNGetInf) {
+  APFloat t = APFloat::getInf(APFloat::Float8E8M0FN());
+  EXPECT_TRUE(t.isNaN());
+  EXPECT_FALSE(t.isInfinity());
----------------
durga4github wrote:

Yes, testing this also in the latest revision.

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


More information about the llvm-commits mailing list