[libc-commits] [libc] 8c6b83d - [libc] Reduce the sizes of some math tests that take longest time.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Wed May 24 05:56:08 PDT 2023


Author: Tue Ly
Date: 2023-05-24T08:55:51-04:00
New Revision: 8c6b83dcfdc333c72793cf0cdbfcf4325be39cde

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

LOG: [libc] Reduce the sizes of some math tests that take longest time.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D151256

Added: 
    

Modified: 
    libc/test/src/math/RemQuoTest.h
    libc/test/src/math/SqrtTest.h
    libc/test/src/math/asinhf_test.cpp
    libc/test/src/math/log10_test.cpp
    libc/test/src/math/log1p_test.cpp
    libc/test/src/math/log2_test.cpp
    libc/test/src/math/log_test.cpp
    libc/test/src/math/sincosf_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/RemQuoTest.h b/libc/test/src/math/RemQuoTest.h
index c6e96577eb0be..63f3d2e60bf08 100644
--- a/libc/test/src/math/RemQuoTest.h
+++ b/libc/test/src/math/RemQuoTest.h
@@ -110,7 +110,7 @@ class RemQuoTestTemplate : public __llvm_libc::testing::Test {
   }
 
   void testNormalRange(RemQuoFunc func) {
-    constexpr UIntType COUNT = 1000001;
+    constexpr UIntType COUNT = 234561;
     constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
     for (UIntType v = FPBits::MIN_NORMAL, w = FPBits::MAX_NORMAL;
          v <= FPBits::MAX_NORMAL && w >= FPBits::MIN_NORMAL;

diff  --git a/libc/test/src/math/SqrtTest.h b/libc/test/src/math/SqrtTest.h
index 840076c1cc06e..b3154b6852276 100644
--- a/libc/test/src/math/SqrtTest.h
+++ b/libc/test/src/math/SqrtTest.h
@@ -54,7 +54,7 @@ template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
   }
 
   void test_normal_range(SqrtFunc func) {
-    constexpr UIntType COUNT = 10'000'001;
+    constexpr UIntType COUNT = 1'234'561;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = __llvm_libc::cpp::bit_cast<T>(v);

diff  --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp
index 906f834a78b22..db86a240992c2 100644
--- a/libc/test/src/math/asinhf_test.cpp
+++ b/libc/test/src/math/asinhf_test.cpp
@@ -43,7 +43,7 @@ TEST(LlvmLibcAsinhfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcAsinhfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 234561;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits_t(v));

diff  --git a/libc/test/src/math/log10_test.cpp b/libc/test/src/math/log10_test.cpp
index 90397a868f871..3382f07732ebf 100644
--- a/libc/test/src/math/log10_test.cpp
+++ b/libc/test/src/math/log10_test.cpp
@@ -78,7 +78,7 @@ TEST(LlvmLibcLog10Test, AllExponents) {
 }
 
 TEST(LlvmLibcLog10Test, InDoubleRange) {
-  constexpr uint64_t COUNT = 1234561;
+  constexpr uint64_t COUNT = 234561;
   constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
   constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL;  // 4.0
   // constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL;  // 1.0

diff  --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp
index 34684329af2d7..41daabad5333d 100644
--- a/libc/test/src/math/log1p_test.cpp
+++ b/libc/test/src/math/log1p_test.cpp
@@ -81,7 +81,7 @@ TEST(LlvmLibcLog1pTest, AllExponents) {
 }
 
 TEST(LlvmLibcLog1pTest, InDoubleRange) {
-  constexpr uint64_t COUNT = 1234561;
+  constexpr uint64_t COUNT = 234561;
 
   auto test = [&](uint64_t start, uint64_t stop,
                   mpfr::RoundingMode rounding_mode) {

diff  --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp
index 01cef24581f19..59b5828c2d609 100644
--- a/libc/test/src/math/log2_test.cpp
+++ b/libc/test/src/math/log2_test.cpp
@@ -78,7 +78,7 @@ TEST(LlvmLibcLog2Test, AllExponents) {
 }
 
 TEST(LlvmLibcLog2Test, InDoubleRange) {
-  constexpr uint64_t COUNT = 1234561;
+  constexpr uint64_t COUNT = 234561;
   constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
   constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL;  // 4.0
   // constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL;  // 1.0

diff  --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp
index 66f5dbf64d3ca..b1c9e205c4e99 100644
--- a/libc/test/src/math/log_test.cpp
+++ b/libc/test/src/math/log_test.cpp
@@ -78,7 +78,7 @@ TEST(LlvmLibcLogTest, AllExponents) {
 }
 
 TEST(LlvmLibcLogTest, InDoubleRange) {
-  constexpr uint64_t COUNT = 1234561;
+  constexpr uint64_t COUNT = 234561;
   constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
   constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL;  // 4.0
   // constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL;  // 1.0

diff  --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp
index 8f580c9243ab1..1caf3a2700b95 100644
--- a/libc/test/src/math/sincosf_test.cpp
+++ b/libc/test/src/math/sincosf_test.cpp
@@ -90,7 +90,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
   }
 
 TEST(LlvmLibcSinCosfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 234561;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits((v)));


        


More information about the libc-commits mailing list