[libc-commits] [libc] [libc][math][c23] Fix setpayloadsig smoke test on RV32 (PR #102538)

Job Henandez Lara via libc-commits libc-commits at lists.llvm.org
Thu Aug 8 14:06:22 PDT 2024


https://github.com/Jobhdez created https://github.com/llvm/llvm-project/pull/102538

None

>From 76d04246ab751b647f7b15b85feec0a3147aa595 Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Thu, 8 Aug 2024 14:03:00 -0700
Subject: [PATCH 1/2] fix bug

---
 libc/test/src/math/smoke/SetPayloadSigTest.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libc/test/src/math/smoke/SetPayloadSigTest.h b/libc/test/src/math/smoke/SetPayloadSigTest.h
index 7ec3ac08a180ab..023a04554d0db1 100644
--- a/libc/test/src/math/smoke/SetPayloadSigTest.h
+++ b/libc/test/src/math/smoke/SetPayloadSigTest.h
@@ -35,7 +35,13 @@ class SetPayloadSigTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     EXPECT_EQ(1, func(&res, T(-1.0)));
     EXPECT_EQ(1, func(&res, T(0x42.1p+0)));
     EXPECT_EQ(1, func(&res, T(-0x42.1p+0)));
-    EXPECT_EQ(1, func(&res, T(StorageType(1) << (FPBits::FRACTION_LEN - 1))));
+
+    FPBits default_snan_payload_bits = FPBits::one();
+    default_snan_payload_bits.set_biased_exponent(FPBits::FRACTION_LEN - 1 +
+                                                  FPBits::EXP_BIAS);
+    T default_snan_payload = default_snan_payload_bits.get_val();
+    
+    EXPECT_EQ(1, func(&res, default_snan_payload));
   }
 
   void testValidPayloads(SetPayloadSigFunc func) {

>From 6c89a05ebfa7e0616c7d13b793e259078fa0e9f4 Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Thu, 8 Aug 2024 14:03:25 -0700
Subject: [PATCH 2/2] format code

---
 libc/test/src/math/smoke/SetPayloadSigTest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/src/math/smoke/SetPayloadSigTest.h b/libc/test/src/math/smoke/SetPayloadSigTest.h
index 023a04554d0db1..67eb0d0a0bfaf4 100644
--- a/libc/test/src/math/smoke/SetPayloadSigTest.h
+++ b/libc/test/src/math/smoke/SetPayloadSigTest.h
@@ -40,7 +40,7 @@ class SetPayloadSigTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     default_snan_payload_bits.set_biased_exponent(FPBits::FRACTION_LEN - 1 +
                                                   FPBits::EXP_BIAS);
     T default_snan_payload = default_snan_payload_bits.get_val();
-    
+
     EXPECT_EQ(1, func(&res, default_snan_payload));
   }
 



More information about the libc-commits mailing list