[llvm] [APFloat] Fix `IEEEFloat::addOrSubtractSignificand` and `IEEEFloat::normalize` (PR #98721)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 09:03:37 PDT 2024


================
@@ -7440,4 +7515,79 @@ TEST(APFloatTest, Float4E2M1FNToFloat) {
   EXPECT_TRUE(SmallestDenorm.isDenormal());
   EXPECT_EQ(0x0.8p0, SmallestDenorm.convertToFloat());
 }
+
+TEST(APFloatTest, AddOrSubtractSignificand) {
+  class TestIEEEFloat : detail::IEEEFloat {
+    TestIEEEFloat(bool sign, ExponentType exponent, integerPart significand)
+        : detail::IEEEFloat(1.0) {
+      // `addOrSubtractSignificand` only uses the sign, exponent and significand
+      this->sign = sign;
+      this->exponent = exponent;
+      this->significand.part = significand;
----------------
arsenm wrote:

What's the problem with adding public accessors for these? Or adding a test class as a friend? 

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


More information about the llvm-commits mailing list