[libc-commits] [libc] cad8352 - [libc][math][c23] fixing dfmal for rv32 (#101763)

via libc-commits libc-commits at lists.llvm.org
Fri Aug 2 20:09:16 PDT 2024


Author: aaryanshukla
Date: 2024-08-02T20:09:13-07:00
New Revision: cad835266ea12dbb3b602d9ae9ae479a550c47b4

URL: https://github.com/llvm/llvm-project/commit/cad835266ea12dbb3b602d9ae9ae479a550c47b4
DIFF: https://github.com/llvm/llvm-project/commit/cad835266ea12dbb3b602d9ae9ae479a550c47b4.diff

LOG: [libc][math][c23] fixing dfmal for rv32 (#101763)

Added: 
    

Modified: 
    libc/test/src/math/smoke/FmaTest.h

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h
index f942de37654dd..bf6d06d698fde 100644
--- a/libc/test/src/math/smoke/FmaTest.h
+++ b/libc/test/src/math/smoke/FmaTest.h
@@ -67,12 +67,14 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
                          out.min_normal));
 
     if constexpr (sizeof(OutType) < sizeof(InType)) {
+      InFPBits tmp = InFPBits::one();
+      tmp.set_biased_exponent(InFPBits::EXP_BIAS - InFPBits::FRACTION_LEN - 1);
+      InType reciprocal_value = tmp.get_val();
+
       InType v = InFPBits(static_cast<InStorageType>(IN_MIN_NORMAL_U +
                                                      InStorageType(1)))
                      .get_val();
-      EXPECT_FP_EQ(
-          out.min_normal,
-          func(InType(1) / InType(IN_MIN_NORMAL_U << 1), v, out.min_normal));
+      EXPECT_FP_EQ(out.min_normal, func(reciprocal_value, v, out.min_normal));
     }
 
     // Test overflow.


        


More information about the libc-commits mailing list