Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc][math][c23] Fix getpayloadf128 smoke test on RV32 #101720

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

overmighty
Copy link
Member

@llvmbot
Copy link
Member

llvmbot commented Aug 2, 2024

@llvm/pr-subscribers-libc

Author: OverMighty (overmighty)

Changes

Fixes
#101285 (comment).


Full diff: https://github.com/llvm/llvm-project/pull/101720.diff

1 Files Affected:

  • (modified) libc/test/src/math/smoke/GetPayloadTest.h (+8-1)
diff --git a/libc/test/src/math/smoke/GetPayloadTest.h b/libc/test/src/math/smoke/GetPayloadTest.h
index 6e30de7643119..922a2f04f6fb3 100644
--- a/libc/test/src/math/smoke/GetPayloadTest.h
+++ b/libc/test/src/math/smoke/GetPayloadTest.h
@@ -38,7 +38,14 @@ class GetPayloadTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     EXPECT_FP_EQ(T(0.0), funcWrapper(func, aNaN));
     EXPECT_FP_EQ(T(0.0), funcWrapper(func, neg_aNaN));
 
-    T default_snan_payload = StorageType(1) << (FPBits::SIG_LEN - 2);
+    // Essentially this:
+    //   T default_snan_payload = StorageType(1) << (FPBits::SIG_LEN - 2);
+    // but supports StorageType being a BigInt.
+    FPBits default_snan_payload_bits = FPBits::one();
+    default_snan_payload_bits.set_biased_exponent(FPBits::SIG_LEN - 2 +
+                                                  FPBits::EXP_BIAS);
+    T default_snan_payload = default_snan_payload_bits.get_val();
+
     EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, sNaN));
     EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, neg_sNaN));
 

Copy link
Member

@mikhailramalho mikhailramalho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix!

@overmighty overmighty merged commit e96687a into llvm:main Aug 2, 2024
8 checks passed
banach-space pushed a commit to banach-space/llvm-project that referenced this pull request Aug 7, 2024
kstoimenov pushed a commit to kstoimenov/llvm-project that referenced this pull request Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants