|
10 | 10 | #define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H |
11 | 11 |
|
12 | 12 | #include "hdr/errno_macros.h" |
| 13 | +#include "hdr/math_macros.h" |
13 | 14 | #include "src/__support/FPUtil/BasicOperations.h" |
14 | 15 | #include "src/__support/FPUtil/NearestIntegerOperations.h" |
15 | 16 | #include "test/UnitTest/FEnvSafeTest.h" |
16 | 17 | #include "test/UnitTest/FPMatcher.h" |
17 | 18 | #include "test/UnitTest/Test.h" |
18 | 19 |
|
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 |
20 | 27 |
|
21 | 28 | #define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \ |
22 | 29 | do { \ |
23 | 30 | LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ |
24 | 31 | EXPECT_FP_EQ(expected, f(x, y)); \ |
25 | 32 | 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); \ |
28 | 35 | } while (0) |
29 | 36 |
|
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) |
32 | 38 |
|
33 | 39 | template <typename T> |
34 | 40 | class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest { |
|
0 commit comments