[libc-commits] [libc] 9788368 - [libc][math][c23] Fix setpayloadsig smoke test on RV32 (#102538)
via libc-commits
libc-commits at lists.llvm.org
Thu Aug 8 17:59:04 PDT 2024
Author: Job Henandez Lara
Date: 2024-08-08T21:58:59-03:00
New Revision: 9788368c37c319b11eb9a31af0f10aac62ba4f72
URL: https://github.com/llvm/llvm-project/commit/9788368c37c319b11eb9a31af0f10aac62ba4f72
DIFF: https://github.com/llvm/llvm-project/commit/9788368c37c319b11eb9a31af0f10aac62ba4f72.diff
LOG: [libc][math][c23] Fix setpayloadsig smoke test on RV32 (#102538)
Added:
Modified:
libc/test/src/math/smoke/SetPayloadSigTest.h
Removed:
################################################################################
diff --git a/libc/test/src/math/smoke/SetPayloadSigTest.h b/libc/test/src/math/smoke/SetPayloadSigTest.h
index 7ec3ac08a180ab..60913c60b481c6 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) {
@@ -56,7 +62,12 @@ class SetPayloadSigTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_EQ(FPBits::signaling_nan(Sign::POS, 0x123).uintval(),
FPBits(res).uintval());
- EXPECT_EQ(0, func(&res, T(FPBits::FRACTION_MASK >> 1)));
+ FPBits nan_payload_bits = FPBits::one();
+ nan_payload_bits.set_biased_exponent(FPBits::FRACTION_LEN - 2 +
+ FPBits::EXP_BIAS);
+ nan_payload_bits.set_mantissa(FPBits::SIG_MASK - 3);
+ T nan_payload = nan_payload_bits.get_val();
+ EXPECT_EQ(0, func(&res, nan_payload));
EXPECT_TRUE(FPBits(res).is_signaling_nan());
EXPECT_EQ(
FPBits::signaling_nan(Sign::POS, FPBits::FRACTION_MASK >> 1).uintval(),
More information about the libc-commits
mailing list