From 7a9ed14a6a13318fceeefcd07e92b83d62b4a126 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 27 Oct 2025 13:00:20 +0000 Subject: [PATCH 1/2] [nsan] More unit tests for `float128`. Now that llvm-libc has `nextafterf128`. --- compiler-rt/lib/nsan/tests/NSanUnitTest.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp b/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp index d121292c36682..17190199322c3 100644 --- a/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp +++ b/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp @@ -43,8 +43,8 @@ template void TestFT() { ASSERT_EQ(GetULPDiff(-X, -Y), 3); // Values with larger differences. - static constexpr const __sanitizer::u64 MantissaSize = - __sanitizer::u64{1} << FTInfo::kMantissaBits; + static constexpr const __uint128_t MantissaSize = + __uint128_t{1} << FTInfo::kMantissaBits; ASSERT_EQ(GetULPDiff(1.0, next(2.0, 1.0)), MantissaSize - 1); ASSERT_EQ(GetULPDiff(1.0, 2.0), MantissaSize); ASSERT_EQ(GetULPDiff(1.0, next(2.0, 3.0)), MantissaSize + 1); @@ -57,11 +57,7 @@ TEST(NSanTest, Double) { TestFT(nextafter)>(); } -TEST(NSanTest, Float128) { - // Very basic tests. FIXME: improve when we have nextafter<__float128>. - ASSERT_EQ(GetULPDiff<__float128>(0.0, 0.0), 0); - ASSERT_EQ(GetULPDiff<__float128>(-0.0, 0.0), 0); - ASSERT_NE(GetULPDiff<__float128>(-0.01, 0.01), kMaxULPDiff); -} +TEST(NSanTest, Float128) { TestFT<__float128, nextafterf128>(); } } // end namespace __nsan + From 14fee8616a3831837c5c9c96ee1db4008f58e1c9 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 27 Oct 2025 13:08:06 +0000 Subject: [PATCH 2/2] format --- compiler-rt/lib/nsan/tests/NSanUnitTest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp b/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp index 17190199322c3..73b59671fe07a 100644 --- a/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp +++ b/compiler-rt/lib/nsan/tests/NSanUnitTest.cpp @@ -60,4 +60,3 @@ TEST(NSanTest, Double) { TEST(NSanTest, Float128) { TestFT<__float128, nextafterf128>(); } } // end namespace __nsan -