[llvm] Fix bitcasting E8M0 APFloat to APInt (PR #113298)
Sergey Kozub via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 10:00:40 PDT 2024
================
@@ -7614,6 +7614,15 @@ TEST(APFloatTest, ConvertDoubleToE8M0FNU) {
EXPECT_EQ(status, APFloat::opUnderflow | APFloat::opInexact);
}
+TEST(APFloatTest, Float8E8M0FNUBitcastToAPInt) {
+ // Regression test for verifying the low bit of the exponent when bitcasting
+ // to integer (zero mantissa).
+ APFloat f0(APFloat::Float8E8M0FNU(), "0.5");
+ APFloat f1(APFloat::Float8E8M0FNU(), "1.0");
+ EXPECT_EQ(f0.bitcastToAPInt(), 126) << f0;
+ EXPECT_EQ(f1.bitcastToAPInt(), 127) << f1;
+}
+
----------------
sergey-kozub wrote:
Done, thanks for the suggestion.
https://github.com/llvm/llvm-project/pull/113298
More information about the llvm-commits
mailing list