Skip to content

Commit bd982ca

Browse files
committed
Skip denorm exceptions in fmod* tests.
1 parent 76df02a commit bd982ca

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

libc/test/src/math/FModTest.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,31 @@
1010
#define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
1111

1212
#include "hdr/errno_macros.h"
13+
#include "hdr/math_macros.h"
1314
#include "src/__support/FPUtil/BasicOperations.h"
1415
#include "src/__support/FPUtil/NearestIntegerOperations.h"
1516
#include "test/UnitTest/FEnvSafeTest.h"
1617
#include "test/UnitTest/FPMatcher.h"
1718
#include "test/UnitTest/Test.h"
1819

19-
#include "hdr/math_macros.h"
20+
#ifdef FE_DENORM
21+
#define DENORM_EXCEPT FE_DENORM
22+
#elif defined(__FE_DENORM)
23+
#define DENORM_EXCEPT __FE_DENORM
24+
#else
25+
#define DENORM_EXCEPT 0
26+
#endif // FE_DENORM
2027

2128
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
2229
do { \
2330
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
2431
EXPECT_FP_EQ(expected, f(x, y)); \
2532
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
26-
if (expected_exception < FE_ALL_EXCEPT) \
27-
EXPECT_FP_EXCEPTION(expected_exception); \
33+
LIBC_NAMESPACE::fputil::clear_except(DENORM_EXCEPT); \
34+
EXPECT_FP_EXCEPTION(expected_exception); \
2835
} while (0)
2936

30-
#define TEST_REGULAR(x, y, expected) \
31-
TEST_SPECIAL(x, y, expected, false, FE_ALL_EXCEPT)
37+
#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
3238

3339
template <typename T>
3440
class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {

libc/test/src/math/smoke/FModTest.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,30 @@
1010
#define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
1111

1212
#include "hdr/errno_macros.h"
13+
#include "hdr/fenv_macros.h"
1314
#include "src/__support/FPUtil/FEnvImpl.h"
1415
#include "test/UnitTest/FEnvSafeTest.h"
1516
#include "test/UnitTest/FPMatcher.h"
1617
#include "test/UnitTest/Test.h"
1718

18-
#include "hdr/fenv_macros.h"
19+
#ifdef FE_DENORM
20+
#define DENORM_EXCEPT FE_DENORM
21+
#elif defined(__FE_DENORM)
22+
#define DENORM_EXCEPT __FE_DENORM
23+
#else
24+
#define DENORM_EXCEPT 0
25+
#endif // FE_DENORM
1926

2027
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
2128
do { \
2229
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
2330
EXPECT_FP_EQ(expected, f(x, y)); \
2431
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
25-
if (expected_exception < FE_ALL_EXCEPT) \
26-
EXPECT_FP_EXCEPTION(expected_exception); \
32+
LIBC_NAMESPACE::fputil::clear_except(DENORM_EXCEPT); \
33+
EXPECT_FP_EXCEPTION(expected_exception); \
2734
} while (0)
2835

29-
#define TEST_REGULAR(x, y, expected) \
30-
TEST_SPECIAL(x, y, expected, false, FE_ALL_EXCEPT)
36+
#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
3137

3238
template <typename T>
3339
class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {

0 commit comments

Comments
 (0)