Skip to content

Commit 2697ffd

Browse files
committed
[libc] Reduce math tests runtime further
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D151875
1 parent fca2109 commit 2697ffd

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

libc/test/src/math/FmaTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class FmaTestTemplate : public __llvm_libc::testing::Test {
6767
}
6868

6969
void test_subnormal_range(Func func) {
70-
constexpr UIntType COUNT = 1000001;
70+
constexpr UIntType COUNT = 100'001;
7171
constexpr UIntType STEP =
7272
(FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
7373
for (UIntType v = FPBits::MIN_SUBNORMAL, w = FPBits::MAX_SUBNORMAL;
@@ -82,7 +82,7 @@ class FmaTestTemplate : public __llvm_libc::testing::Test {
8282
}
8383

8484
void test_normal_range(Func func) {
85-
constexpr UIntType COUNT = 1000001;
85+
constexpr UIntType COUNT = 100'001;
8686
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
8787
for (UIntType v = FPBits::MIN_NORMAL, w = FPBits::MAX_NORMAL;
8888
v <= FPBits::MAX_NORMAL && w >= FPBits::MIN_NORMAL;

libc/test/src/math/HypotTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class HypotTestTemplate : public __llvm_libc::testing::Test {
5959
}
6060

6161
void test_subnormal_range(Func func) {
62-
constexpr UIntType COUNT = 100001;
62+
constexpr UIntType COUNT = 10'001;
6363
for (unsigned scale = 0; scale < 4; ++scale) {
6464
UIntType max_value = FPBits::MAX_SUBNORMAL << scale;
6565
UIntType step = (max_value - FPBits::MIN_SUBNORMAL) / COUNT;
@@ -84,7 +84,7 @@ class HypotTestTemplate : public __llvm_libc::testing::Test {
8484
}
8585

8686
void test_normal_range(Func func) {
87-
constexpr UIntType COUNT = 100001;
87+
constexpr UIntType COUNT = 10'001;
8888
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
8989
for (int signs = 0; signs < 4; ++signs) {
9090
for (UIntType v = FPBits::MIN_NORMAL, w = FPBits::MAX_NORMAL;

libc/test/src/math/RIntTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
9393
}
9494

9595
void testSubnormalRange(RIntFunc func) {
96-
constexpr UIntType COUNT = 1000001;
96+
constexpr UIntType COUNT = 100'001;
9797
constexpr UIntType STEP =
9898
(FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
9999
for (UIntType i = FPBits::MIN_SUBNORMAL; i <= FPBits::MAX_SUBNORMAL;
@@ -108,7 +108,7 @@ class RIntTestTemplate : public __llvm_libc::testing::Test {
108108
}
109109

110110
void testNormalRange(RIntFunc func) {
111-
constexpr UIntType COUNT = 1000001;
111+
constexpr UIntType COUNT = 100'001;
112112
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
113113
for (UIntType i = FPBits::MIN_NORMAL; i <= FPBits::MAX_NORMAL; i += STEP) {
114114
T x = T(FPBits(i));

libc/test/src/math/RemQuoTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class RemQuoTestTemplate : public __llvm_libc::testing::Test {
9595
}
9696

9797
void testSubnormalRange(RemQuoFunc func) {
98-
constexpr UIntType COUNT = 1000001;
98+
constexpr UIntType COUNT = 100'001;
9999
constexpr UIntType STEP =
100100
(FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
101101
for (UIntType v = FPBits::MIN_SUBNORMAL, w = FPBits::MAX_SUBNORMAL;
@@ -110,7 +110,7 @@ class RemQuoTestTemplate : public __llvm_libc::testing::Test {
110110
}
111111

112112
void testNormalRange(RemQuoFunc func) {
113-
constexpr UIntType COUNT = 234561;
113+
constexpr UIntType COUNT = 1'001;
114114
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
115115
for (UIntType v = FPBits::MIN_NORMAL, w = FPBits::MAX_NORMAL;
116116
v <= FPBits::MAX_NORMAL && w >= FPBits::MIN_NORMAL;

libc/test/src/math/RoundToIntegerTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
214214
}
215215

216216
void testSubnormalRange(RoundToIntegerFunc func) {
217-
constexpr UIntType COUNT = 1000001;
217+
constexpr UIntType COUNT = 1'000'001;
218218
constexpr UIntType STEP =
219219
(FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
220220
for (UIntType i = FPBits::MIN_SUBNORMAL; i <= FPBits::MAX_SUBNORMAL;
@@ -258,7 +258,7 @@ class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
258258
if (sizeof(I) > sizeof(long))
259259
return;
260260

261-
constexpr UIntType COUNT = 1000001;
261+
constexpr UIntType COUNT = 1'000'001;
262262
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
263263
for (UIntType i = FPBits::MIN_NORMAL; i <= FPBits::MAX_NORMAL; i += STEP) {
264264
F x = F(FPBits(i));

libc/test/src/math/SqrtTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
4545
test_all_rounding_modes(func, T(denormal));
4646
}
4747

48-
constexpr UIntType COUNT = 1'000'001;
48+
constexpr UIntType COUNT = 200'001;
4949
constexpr UIntType STEP = HIDDEN_BIT / COUNT;
5050
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5151
T x = __llvm_libc::cpp::bit_cast<T>(v);
@@ -54,7 +54,7 @@ template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
5454
}
5555

5656
void test_normal_range(SqrtFunc func) {
57-
constexpr UIntType COUNT = 1'234'561;
57+
constexpr UIntType COUNT = 200'001;
5858
constexpr UIntType STEP = UIntType(-1) / COUNT;
5959
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
6060
T x = __llvm_libc::cpp::bit_cast<T>(v);

libc/test/src/math/asinhf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ TEST(LlvmLibcAsinhfTest, SpecialNumbers) {
4343
}
4444

4545
TEST(LlvmLibcAsinhfTest, InFloatRange) {
46-
constexpr uint32_t COUNT = 234561;
46+
constexpr uint32_t COUNT = 1'001;
4747
constexpr uint32_t STEP = UINT32_MAX / COUNT;
4848
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
4949
float x = float(FPBits_t(v));

libc/test/src/math/log10_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ TEST(LlvmLibcLog10Test, AllExponents) {
7878
}
7979

8080
TEST(LlvmLibcLog10Test, InDoubleRange) {
81-
constexpr uint64_t COUNT = 234561;
81+
constexpr uint64_t COUNT = 1'001;
8282
constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
8383
constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL; // 4.0
8484
// constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL; // 1.0

libc/test/src/math/log1p_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ TEST(LlvmLibcLog1pTest, AllExponents) {
8181
}
8282

8383
TEST(LlvmLibcLog1pTest, InDoubleRange) {
84-
constexpr uint64_t COUNT = 234561;
84+
constexpr uint64_t COUNT = 4501;
8585

8686
auto test = [&](uint64_t start, uint64_t stop,
8787
mpfr::RoundingMode rounding_mode) {

libc/test/src/math/log2_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ TEST(LlvmLibcLog2Test, AllExponents) {
7878
}
7979

8080
TEST(LlvmLibcLog2Test, InDoubleRange) {
81-
constexpr uint64_t COUNT = 234561;
81+
constexpr uint64_t COUNT = 1'001;
8282
constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
8383
constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL; // 4.0
8484
// constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL; // 1.0

libc/test/src/math/sincosf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
9090
}
9191

9292
TEST(LlvmLibcSinCosfTest, InFloatRange) {
93-
constexpr uint32_t COUNT = 234561;
93+
constexpr uint32_t COUNT = 1'001;
9494
constexpr uint32_t STEP = UINT32_MAX / COUNT;
9595
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
9696
float x = float(FPBits((v)));

0 commit comments

Comments
 (0)