Skip to content

Commit

Permalink
[libc] Reduce math tests runtime
Browse files Browse the repository at this point in the history
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D151798
  • Loading branch information
gchatelet committed Jun 1, 2023
1 parent 78a2240 commit ae5c472
Show file tree
Hide file tree
Showing 36 changed files with 46 additions and 43 deletions.
2 changes: 1 addition & 1 deletion libc/test/src/math/CeilTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ template <typename T> class CeilTest : public __llvm_libc::testing::Test {
}

void testRange(CeilFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/CopySignTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ template <typename T> class CopySignTest : public __llvm_libc::testing::Test {
}

void testRange(CopySignFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/FAbsTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ template <typename T> class FAbsTest : public __llvm_libc::testing::Test {
}

void testRange(FabsFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/FDimTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FDimTestTemplate : public __llvm_libc::testing::Test {
}

void test_in_range(FuncPtr func) {
constexpr UIntType COUNT = 10000001;
constexpr UIntType COUNT = 100'001;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
++i, v += STEP, w -= STEP) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/FMaxTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ template <typename T> class FMaxTest : public __llvm_libc::testing::Test {
}

void testRange(FMaxFunc func) {
constexpr UIntType COUNT = 10000001;
constexpr UIntType COUNT = 100'001;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
++i, v += STEP, w -= STEP) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/FMinTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ template <typename T> class FMinTest : public __llvm_libc::testing::Test {
}

void testRange(FMinFunc func) {
constexpr UIntType COUNT = 10000001;
constexpr UIntType COUNT = 100'001;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
++i, v += STEP, w -= STEP) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/FloorTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ template <typename T> class FloorTest : public __llvm_libc::testing::Test {
}

void testRange(FloorFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/FrexpTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ template <typename T> class FrexpTest : public __llvm_libc::testing::Test {

void testRange(FrexpFunc func) {
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = static_cast<T>(FPBits(v));
Expand Down
8 changes: 5 additions & 3 deletions libc/test/src/math/ILogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
public:
template <typename T> struct ILogbFunc { typedef int (*Func)(T); };
template <typename T> struct ILogbFunc {
typedef int (*Func)(T);
};

template <typename T>
void test_special_numbers(typename ILogbFunc<T>::Func func) {
Expand Down Expand Up @@ -75,7 +77,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
void test_subnormal_range(typename ILogbFunc<T>::Func func) {
using FPBits = __llvm_libc::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 1000001;
constexpr UIntType COUNT = 10'001;
constexpr UIntType STEP =
(FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
for (UIntType v = FPBits::MIN_SUBNORMAL; v <= FPBits::MAX_SUBNORMAL;
Expand All @@ -94,7 +96,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
void test_normal_range(typename ILogbFunc<T>::Func func) {
using FPBits = __llvm_libc::fputil::FPBits<T>;
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 1000001;
constexpr UIntType COUNT = 10'001;
constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
for (UIntType v = FPBits::MIN_NORMAL; v <= FPBits::MAX_NORMAL; v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/LogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ template <typename T> class LogbTest : public __llvm_libc::testing::Test {

void testRange(LogbFunc func) {
using UIntType = typename FPBits::UIntType;
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = static_cast<T>(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/ModfTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ template <typename T> class ModfTest : public __llvm_libc::testing::Test {
}

void testRange(ModfFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/RoundTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ template <typename T> class RoundTest : public __llvm_libc::testing::Test {
}

void testRange(RoundFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/TruncTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ template <typename T> class TruncTest : public __llvm_libc::testing::Test {
}

void testRange(TruncFunc func) {
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = T(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/acosf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST(LlvmLibcAcosfTest, SpecialNumbers) {
}

TEST(LlvmLibcAcosfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/acoshf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
}

TEST(LlvmLibcAcoshfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
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));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/asinf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(LlvmLibcAsinfTest, SpecialNumbers) {
}

TEST(LlvmLibcAsinfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/atanf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(LlvmLibcAtanfTest, SpecialNumbers) {
}

TEST(LlvmLibcAtanfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
const uint32_t STEP = FPBits(inf).uintval() / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/atanhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
}

TEST(LlvmLibcAtanhfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
const uint32_t STEP = FPBits(1.0f).uintval() / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/cos_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DECLARE_SPECIAL_CONSTANTS(double)

TEST(LlvmLibccosTest, Range) {
static constexpr double _2pi = 6.283185307179586;
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
double x = double(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/cosf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST(LlvmLibcCosfTest, SpecialNumbers) {
}

TEST(LlvmLibcCosfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/coshf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST(LlvmLibcCoshfTest, Overflow) {
}

TEST(LlvmLibcCoshfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/exp10f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) {
}

TEST(LlvmLibcExp10fTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/exp2f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TEST(LlvmLibcExp2fTest, Underflow) {
}

TEST(LlvmLibcExp2fTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/expf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ TEST(LlvmLibcExpfTest, Borderline) {
}

TEST(LlvmLibcExpfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/expm1f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ TEST(LlvmLibcExpm1fTest, Borderline) {
}

TEST(LlvmLibcExpm1fTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/log10f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST(LlvmLibcLog10fTest, TrickyInputs) {
}

TEST(LlvmLibcLog10fTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/log1pf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TEST(LlvmLibclog1pfTest, TrickyInputs) {
}

TEST(LlvmLibclog1pfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/log2f_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(LlvmLibcLog2fTest, TrickyInputs) {
}

TEST(LlvmLibcLog2fTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/logf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ TEST(LlvmLibcLogfTest, TrickyInputs) {
}

TEST(LlvmLibcLogfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/sin_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DECLARE_SPECIAL_CONSTANTS(double)

TEST(LlvmLibcSinTest, Range) {
static constexpr double _2pi = 6.283185307179586;
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
double x = double(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/sinf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST(LlvmLibcSinfTest, SpecialNumbers) {
}

TEST(LlvmLibcSinfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/sinhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(LlvmLibcSinhfTest, SpecialNumbers) {
}

TEST(LlvmLibcSinhfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/tan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DECLARE_SPECIAL_CONSTANTS(double)

TEST(LlvmLibctanTest, Range) {
static constexpr double _2pi = 6.283185307179586;
constexpr UIntType COUNT = 10000000;
constexpr UIntType COUNT = 100'000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
double x = double(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/tanf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST(LlvmLibcTanfTest, SpecialNumbers) {
}

TEST(LlvmLibcTanfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/tanhf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TEST(LlvmLibcTanhfTest, SpecialNumbers) {
}

TEST(LlvmLibcTanhfTest, InFloatRange) {
constexpr uint32_t COUNT = 1000000;
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = float(FPBits(v));
Expand Down
13 changes: 7 additions & 6 deletions libc/test/utils/FPUtil/x86_long_double_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
// builtin function. Hence, matching LLVM-libc's notion of NaN with the
// isnan result ensures that LLVM-libc's behavior matches the compiler's
// behavior.
constexpr uint32_t COUNT = 100'000;

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

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

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

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

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

bits.set_unbiased_exponent(0);
bits.set_implicit_bit(0);
for (unsigned int i = 0; i < 1000000; ++i) {
for (unsigned int i = 0; i < COUNT; ++i) {
// If exponent is zero, then the number is a valid but denormal value.
bits.set_mantissa(i);
long double valid = bits;
Expand Down

0 comments on commit ae5c472

Please sign in to comment.