Skip to content

Commit ae5c472

Browse files
committed
[libc] Reduce math tests runtime
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D151798
1 parent 78a2240 commit ae5c472

36 files changed

+46
-43
lines changed

libc/test/src/math/CeilTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ template <typename T> class CeilTest : public __llvm_libc::testing::Test {
6464
}
6565

6666
void testRange(CeilFunc func) {
67-
constexpr UIntType COUNT = 10000000;
67+
constexpr UIntType COUNT = 100'000;
6868
constexpr UIntType STEP = UIntType(-1) / COUNT;
6969
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7070
T x = T(FPBits(v));

libc/test/src/math/CopySignTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ template <typename T> class CopySignTest : public __llvm_libc::testing::Test {
3333
}
3434

3535
void testRange(CopySignFunc func) {
36-
constexpr UIntType COUNT = 10000000;
36+
constexpr UIntType COUNT = 100'000;
3737
constexpr UIntType STEP = UIntType(-1) / COUNT;
3838
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
3939
T x = T(FPBits(v));

libc/test/src/math/FAbsTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ template <typename T> class FAbsTest : public __llvm_libc::testing::Test {
3232
}
3333

3434
void testRange(FabsFunc func) {
35-
constexpr UIntType COUNT = 10000000;
35+
constexpr UIntType COUNT = 100'000;
3636
constexpr UIntType STEP = UIntType(-1) / COUNT;
3737
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
3838
T x = T(FPBits(v));

libc/test/src/math/FDimTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FDimTestTemplate : public __llvm_libc::testing::Test {
5353
}
5454

5555
void test_in_range(FuncPtr func) {
56-
constexpr UIntType COUNT = 10000001;
56+
constexpr UIntType COUNT = 100'001;
5757
constexpr UIntType STEP = UIntType(-1) / COUNT;
5858
for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
5959
++i, v += STEP, w -= STEP) {

libc/test/src/math/FMaxTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ template <typename T> class FMaxTest : public __llvm_libc::testing::Test {
5555
}
5656

5757
void testRange(FMaxFunc func) {
58-
constexpr UIntType COUNT = 10000001;
58+
constexpr UIntType COUNT = 100'001;
5959
constexpr UIntType STEP = UIntType(-1) / COUNT;
6060
for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
6161
++i, v += STEP, w -= STEP) {

libc/test/src/math/FMinTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ template <typename T> class FMinTest : public __llvm_libc::testing::Test {
5555
}
5656

5757
void testRange(FMinFunc func) {
58-
constexpr UIntType COUNT = 10000001;
58+
constexpr UIntType COUNT = 100'001;
5959
constexpr UIntType STEP = UIntType(-1) / COUNT;
6060
for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
6161
++i, v += STEP, w -= STEP) {

libc/test/src/math/FloorTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ template <typename T> class FloorTest : public __llvm_libc::testing::Test {
6464
}
6565

6666
void testRange(FloorFunc func) {
67-
constexpr UIntType COUNT = 10000000;
67+
constexpr UIntType COUNT = 100'000;
6868
constexpr UIntType STEP = UIntType(-1) / COUNT;
6969
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7070
T x = T(FPBits(v));

libc/test/src/math/FrexpTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ template <typename T> class FrexpTest : public __llvm_libc::testing::Test {
9393

9494
void testRange(FrexpFunc func) {
9595
using UIntType = typename FPBits::UIntType;
96-
constexpr UIntType COUNT = 10000000;
96+
constexpr UIntType COUNT = 100'000;
9797
constexpr UIntType STEP = UIntType(-1) / COUNT;
9898
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
9999
T x = static_cast<T>(FPBits(v));

libc/test/src/math/ILogbTest.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
2020
public:
21-
template <typename T> struct ILogbFunc { typedef int (*Func)(T); };
21+
template <typename T> struct ILogbFunc {
22+
typedef int (*Func)(T);
23+
};
2224

2325
template <typename T>
2426
void test_special_numbers(typename ILogbFunc<T>::Func func) {
@@ -75,7 +77,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
7577
void test_subnormal_range(typename ILogbFunc<T>::Func func) {
7678
using FPBits = __llvm_libc::fputil::FPBits<T>;
7779
using UIntType = typename FPBits::UIntType;
78-
constexpr UIntType COUNT = 1000001;
80+
constexpr UIntType COUNT = 10'001;
7981
constexpr UIntType STEP =
8082
(FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
8183
for (UIntType v = FPBits::MIN_SUBNORMAL; v <= FPBits::MAX_SUBNORMAL;
@@ -94,7 +96,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
9496
void test_normal_range(typename ILogbFunc<T>::Func func) {
9597
using FPBits = __llvm_libc::fputil::FPBits<T>;
9698
using UIntType = typename FPBits::UIntType;
97-
constexpr UIntType COUNT = 1000001;
99+
constexpr UIntType COUNT = 10'001;
98100
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
99101
for (UIntType v = FPBits::MIN_NORMAL; v <= FPBits::MAX_NORMAL; v += STEP) {
100102
T x = T(FPBits(v));

libc/test/src/math/LogbTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ template <typename T> class LogbTest : public __llvm_libc::testing::Test {
7272

7373
void testRange(LogbFunc func) {
7474
using UIntType = typename FPBits::UIntType;
75-
constexpr UIntType COUNT = 10000000;
75+
constexpr UIntType COUNT = 100'000;
7676
constexpr UIntType STEP = UIntType(-1) / COUNT;
7777
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7878
T x = static_cast<T>(FPBits(v));

libc/test/src/math/ModfTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ template <typename T> class ModfTest : public __llvm_libc::testing::Test {
8484
}
8585

8686
void testRange(ModfFunc func) {
87-
constexpr UIntType COUNT = 10000000;
87+
constexpr UIntType COUNT = 100'000;
8888
constexpr UIntType STEP = UIntType(-1) / COUNT;
8989
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
9090
T x = T(FPBits(v));

libc/test/src/math/RoundTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ template <typename T> class RoundTest : public __llvm_libc::testing::Test {
6464
}
6565

6666
void testRange(RoundFunc func) {
67-
constexpr UIntType COUNT = 10000000;
67+
constexpr UIntType COUNT = 100'000;
6868
constexpr UIntType STEP = UIntType(-1) / COUNT;
6969
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7070
T x = T(FPBits(v));

libc/test/src/math/TruncTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ template <typename T> class TruncTest : public __llvm_libc::testing::Test {
6464
}
6565

6666
void testRange(TruncFunc func) {
67-
constexpr UIntType COUNT = 10000000;
67+
constexpr UIntType COUNT = 100'000;
6868
constexpr UIntType STEP = UIntType(-1) / COUNT;
6969
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7070
T x = T(FPBits(v));

libc/test/src/math/acosf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TEST(LlvmLibcAcosfTest, SpecialNumbers) {
3737
}
3838

3939
TEST(LlvmLibcAcosfTest, InFloatRange) {
40-
constexpr uint32_t COUNT = 1000000;
40+
constexpr uint32_t COUNT = 100'000;
4141
constexpr uint32_t STEP = UINT32_MAX / COUNT;
4242
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
4343
float x = float(FPBits(v));

libc/test/src/math/acoshf_test.cpp

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

4545
TEST(LlvmLibcAcoshfTest, InFloatRange) {
46-
constexpr uint32_t COUNT = 1000000;
46+
constexpr uint32_t COUNT = 100'000;
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/asinf_test.cpp

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

4646
TEST(LlvmLibcAsinfTest, InFloatRange) {
47-
constexpr uint32_t COUNT = 1000000;
47+
constexpr uint32_t COUNT = 100'000;
4848
constexpr uint32_t STEP = UINT32_MAX / COUNT;
4949
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5050
float x = float(FPBits(v));

libc/test/src/math/atanf_test.cpp

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

4646
TEST(LlvmLibcAtanfTest, InFloatRange) {
47-
constexpr uint32_t COUNT = 1000000;
47+
constexpr uint32_t COUNT = 100'000;
4848
const uint32_t STEP = FPBits(inf).uintval() / COUNT;
4949
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5050
float x = float(FPBits(v));

libc/test/src/math/atanhf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
8686
}
8787

8888
TEST(LlvmLibcAtanhfTest, InFloatRange) {
89-
constexpr uint32_t COUNT = 1000000;
89+
constexpr uint32_t COUNT = 100'000;
9090
const uint32_t STEP = FPBits(1.0f).uintval() / COUNT;
9191
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
9292
float x = float(FPBits(v));

libc/test/src/math/cos_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DECLARE_SPECIAL_CONSTANTS(double)
1919

2020
TEST(LlvmLibccosTest, Range) {
2121
static constexpr double _2pi = 6.283185307179586;
22-
constexpr UIntType COUNT = 10000000;
22+
constexpr UIntType COUNT = 100'000;
2323
constexpr UIntType STEP = UIntType(-1) / COUNT;
2424
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
2525
double x = double(FPBits(v));

libc/test/src/math/cosf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ TEST(LlvmLibcCosfTest, SpecialNumbers) {
4545
}
4646

4747
TEST(LlvmLibcCosfTest, InFloatRange) {
48-
constexpr uint32_t COUNT = 1000000;
48+
constexpr uint32_t COUNT = 100'000;
4949
constexpr uint32_t STEP = UINT32_MAX / COUNT;
5050
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5151
float x = float(FPBits(v));

libc/test/src/math/coshf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ TEST(LlvmLibcCoshfTest, Overflow) {
5959
}
6060

6161
TEST(LlvmLibcCoshfTest, InFloatRange) {
62-
constexpr uint32_t COUNT = 1000000;
62+
constexpr uint32_t COUNT = 100'000;
6363
constexpr uint32_t STEP = UINT32_MAX / COUNT;
6464
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
6565
float x = float(FPBits(v));

libc/test/src/math/exp10f_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) {
106106
}
107107

108108
TEST(LlvmLibcExp10fTest, InFloatRange) {
109-
constexpr uint32_t COUNT = 1000000;
109+
constexpr uint32_t COUNT = 100'000;
110110
constexpr uint32_t STEP = UINT32_MAX / COUNT;
111111
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
112112
float x = float(FPBits(v));

libc/test/src/math/exp2f_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TEST(LlvmLibcExp2fTest, Underflow) {
103103
}
104104

105105
TEST(LlvmLibcExp2fTest, InFloatRange) {
106-
constexpr uint32_t COUNT = 1000000;
106+
constexpr uint32_t COUNT = 100'000;
107107
constexpr uint32_t STEP = UINT32_MAX / COUNT;
108108
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
109109
float x = float(FPBits(v));

libc/test/src/math/expf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ TEST(LlvmLibcExpfTest, Borderline) {
104104
}
105105

106106
TEST(LlvmLibcExpfTest, InFloatRange) {
107-
constexpr uint32_t COUNT = 1000000;
107+
constexpr uint32_t COUNT = 100'000;
108108
constexpr uint32_t STEP = UINT32_MAX / COUNT;
109109
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
110110
float x = float(FPBits(v));

libc/test/src/math/expm1f_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ TEST(LlvmLibcExpm1fTest, Borderline) {
113113
}
114114

115115
TEST(LlvmLibcExpm1fTest, InFloatRange) {
116-
constexpr uint32_t COUNT = 1000000;
116+
constexpr uint32_t COUNT = 100'000;
117117
constexpr uint32_t STEP = UINT32_MAX / COUNT;
118118
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
119119
float x = float(FPBits(v));

libc/test/src/math/log10f_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TEST(LlvmLibcLog10fTest, TrickyInputs) {
6565
}
6666

6767
TEST(LlvmLibcLog10fTest, InFloatRange) {
68-
constexpr uint32_t COUNT = 1000000;
68+
constexpr uint32_t COUNT = 100'000;
6969
constexpr uint32_t STEP = UINT32_MAX / COUNT;
7070
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7171
float x = float(FPBits(v));

libc/test/src/math/log1pf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ TEST(LlvmLibclog1pfTest, TrickyInputs) {
7070
}
7171

7272
TEST(LlvmLibclog1pfTest, InFloatRange) {
73-
constexpr uint32_t COUNT = 1000000;
73+
constexpr uint32_t COUNT = 100'000;
7474
constexpr uint32_t STEP = UINT32_MAX / COUNT;
7575
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
7676
float x = float(FPBits(v));

libc/test/src/math/log2f_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ TEST(LlvmLibcLog2fTest, TrickyInputs) {
4444
}
4545

4646
TEST(LlvmLibcLog2fTest, InFloatRange) {
47-
constexpr uint32_t COUNT = 1000000;
47+
constexpr uint32_t COUNT = 100'000;
4848
constexpr uint32_t STEP = UINT32_MAX / COUNT;
4949
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5050
float x = float(FPBits(v));

libc/test/src/math/logf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TEST(LlvmLibcLogfTest, TrickyInputs) {
7676
}
7777

7878
TEST(LlvmLibcLogfTest, InFloatRange) {
79-
constexpr uint32_t COUNT = 1000000;
79+
constexpr uint32_t COUNT = 100'000;
8080
constexpr uint32_t STEP = UINT32_MAX / COUNT;
8181
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
8282
float x = float(FPBits(v));

libc/test/src/math/sin_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DECLARE_SPECIAL_CONSTANTS(double)
2020

2121
TEST(LlvmLibcSinTest, Range) {
2222
static constexpr double _2pi = 6.283185307179586;
23-
constexpr UIntType COUNT = 10000000;
23+
constexpr UIntType COUNT = 100'000;
2424
constexpr UIntType STEP = UIntType(-1) / COUNT;
2525
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
2626
double x = double(FPBits(v));

libc/test/src/math/sinf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ TEST(LlvmLibcSinfTest, SpecialNumbers) {
4545
}
4646

4747
TEST(LlvmLibcSinfTest, InFloatRange) {
48-
constexpr uint32_t COUNT = 1000000;
48+
constexpr uint32_t COUNT = 100'000;
4949
constexpr uint32_t STEP = UINT32_MAX / COUNT;
5050
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5151
float x = float(FPBits(v));

libc/test/src/math/sinhf_test.cpp

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

4646
TEST(LlvmLibcSinhfTest, InFloatRange) {
47-
constexpr uint32_t COUNT = 1000000;
47+
constexpr uint32_t COUNT = 100'000;
4848
constexpr uint32_t STEP = UINT32_MAX / COUNT;
4949
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5050
float x = float(FPBits(v));

libc/test/src/math/tan_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DECLARE_SPECIAL_CONSTANTS(double)
1919

2020
TEST(LlvmLibctanTest, Range) {
2121
static constexpr double _2pi = 6.283185307179586;
22-
constexpr UIntType COUNT = 10000000;
22+
constexpr UIntType COUNT = 100'000;
2323
constexpr UIntType STEP = UIntType(-1) / COUNT;
2424
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
2525
double x = double(FPBits(v));

libc/test/src/math/tanf_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ TEST(LlvmLibcTanfTest, SpecialNumbers) {
4545
}
4646

4747
TEST(LlvmLibcTanfTest, InFloatRange) {
48-
constexpr uint32_t COUNT = 1000000;
48+
constexpr uint32_t COUNT = 100'000;
4949
constexpr uint32_t STEP = UINT32_MAX / COUNT;
5050
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
5151
float x = float(FPBits(v));

libc/test/src/math/tanhf_test.cpp

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

4545
TEST(LlvmLibcTanhfTest, InFloatRange) {
46-
constexpr uint32_t COUNT = 1000000;
46+
constexpr uint32_t COUNT = 100'000;
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(v));

libc/test/utils/FPUtil/x86_long_double_test.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
1919
// builtin function. Hence, matching LLVM-libc's notion of NaN with the
2020
// isnan result ensures that LLVM-libc's behavior matches the compiler's
2121
// behavior.
22+
constexpr uint32_t COUNT = 100'000;
2223

2324
FPBits bits(0.0l);
2425
bits.set_unbiased_exponent(FPBits::MAX_EXPONENT);
25-
for (unsigned int i = 0; i < 1000000; ++i) {
26+
for (unsigned int i = 0; i < COUNT; ++i) {
2627
// If exponent has the max value and the implicit bit is 0,
2728
// then the number is a NaN for all values of mantissa.
2829
bits.set_mantissa(i);
@@ -32,7 +33,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
3233
}
3334

3435
bits.set_implicit_bit(1);
35-
for (unsigned int i = 1; i < 1000000; ++i) {
36+
for (unsigned int i = 1; i < COUNT; ++i) {
3637
// If exponent has the max value and the implicit bit is 1,
3738
// then the number is a NaN for all non-zero values of mantissa.
3839
// Note the initial value of |i| of 1 to avoid a zero mantissa.
@@ -44,7 +45,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
4445

4546
bits.set_unbiased_exponent(1);
4647
bits.set_implicit_bit(0);
47-
for (unsigned int i = 0; i < 1000000; ++i) {
48+
for (unsigned int i = 0; i < COUNT; ++i) {
4849
// If exponent is non-zero and also not max, and the implicit bit is 0,
4950
// then the number is a NaN for all values of mantissa.
5051
bits.set_mantissa(i);
@@ -55,7 +56,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
5556

5657
bits.set_unbiased_exponent(1);
5758
bits.set_implicit_bit(1);
58-
for (unsigned int i = 0; i < 1000000; ++i) {
59+
for (unsigned int i = 0; i < COUNT; ++i) {
5960
// If exponent is non-zero and also not max, and the implicit bit is 1,
6061
// then the number is normal value for all values of mantissa.
6162
bits.set_mantissa(i);
@@ -66,7 +67,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
6667

6768
bits.set_unbiased_exponent(0);
6869
bits.set_implicit_bit(1);
69-
for (unsigned int i = 0; i < 1000000; ++i) {
70+
for (unsigned int i = 0; i < COUNT; ++i) {
7071
// If exponent is zero, then the number is a valid but denormal value.
7172
bits.set_mantissa(i);
7273
long double valid = bits;
@@ -76,7 +77,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
7677

7778
bits.set_unbiased_exponent(0);
7879
bits.set_implicit_bit(0);
79-
for (unsigned int i = 0; i < 1000000; ++i) {
80+
for (unsigned int i = 0; i < COUNT; ++i) {
8081
// If exponent is zero, then the number is a valid but denormal value.
8182
bits.set_mantissa(i);
8283
long double valid = bits;

0 commit comments

Comments
 (0)