File tree Expand file tree Collapse file tree 4 files changed +12
-5
lines changed
src/__support/FPUtil/x86_64 Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1414#define FE_INVALID 0x4
1515#define FE_OVERFLOW 0x8
1616#define FE_UNDERFLOW 0x10
17- #define __FE_DENORM 0x20
17+ #define FE_DENORM 0x20
1818#define FE_ALL_EXCEPT \
19- (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
19+ (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | \
20+ FE_DENORM)
2021
2122#define FE_DOWNWARD 0x400
2223#define FE_TONEAREST 0
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ LIBC_INLINE static uint16_t test_except(uint16_t excepts) {
7171}
7272
7373LIBC_INLINE static uint16_t get_except () {
74- uint32_t mxcsr = get_mxcsr ();
74+ uint32_t mxcsr = ~ get_mxcsr ();
7575 return static_cast <uint16_t >((mxcsr >> ExceptionFlags::MXCSR_EXCEPTION_MASK_BIT_POSITION) & ExceptionFlags::ALL_F);
7676}
7777
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ LIBC_INLINE static constexpr bool fenv_exceptions_match_x86() {
4949 return (FE_INVALID == ExceptionFlags::INVALID_F) &&
5050#ifdef __FE_DENORM
5151 (__FE_DENORM == ExceptionFlags::DENORMAL_F) &&
52+ #elif defined(FE_DENORM)
53+ (FE_DENORM == ExceptionFlags::DENORMAL_F) &&
5254#endif // __FE_DENORM
5355 (FE_DIVBYZERO == ExceptionFlags::DIV_BY_ZERO_F) &&
5456 (FE_OVERFLOW == ExceptionFlags::OVERFLOW_F) &&
@@ -87,6 +89,8 @@ LIBC_INLINE static uint16_t get_status_value_from_except(int excepts) {
8789 return ((excepts & FE_INVALID) ? ExceptionFlags::INVALID_F : 0 ) |
8890#ifdef __FE_DENORM
8991 ((excepts & __FE_DENORM) ? ExceptionFlags::DENORMAL_F : 0 ) |
92+ #elif defined(FE_DENORM)
93+ ((excepts & FE_DENORM) ? ExceptionFlags::DENORMAL_F : 0 ) |
9094#endif // __FE_DENORM
9195 ((excepts & FE_DIVBYZERO) ? ExceptionFlags::DIV_BY_ZERO_F : 0 ) |
9296 ((excepts & FE_OVERFLOW) ? ExceptionFlags::OVERFLOW_F : 0 ) |
@@ -102,6 +106,8 @@ LIBC_INLINE static int get_macro_from_exception_status(uint16_t status) {
102106 return ((status & ExceptionFlags::INVALID_F) ? FE_INVALID : 0 ) |
103107#ifdef __FE_DENORM
104108 ((status & ExceptionFlags::DENORMAL_F) ? __FE_DENORM : 0 ) |
109+ #elif defined(FE_DENORM)
110+ ((status & ExceptionFlags::DENORMAL_F) ? FE_DENORM : 0 ) |
105111#endif // __FE_DENORM
106112 ((status & ExceptionFlags::DIV_BY_ZERO_F) ? FE_DIVBYZERO : 0 ) |
107113 ((status & ExceptionFlags::OVERFLOW_F) ? FE_OVERFLOW : 0 ) |
Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ LIBC_INLINE static uint16_t test_except(uint16_t excepts) {
113113}
114114
115115LIBC_INLINE static uint16_t get_except () {
116- uint16_t x87_status = get_x87_control_word ();
117- return static_cast <uint16_t >(x87_status & ExceptionFlags::ALL_F);
116+ uint16_t x87_control = get_x87_control_word ();
117+ return static_cast <uint16_t >((~x87_control) & ExceptionFlags::ALL_F);
118118}
119119
120120LIBC_INLINE static void set_except (uint16_t excepts) {
You can’t perform that action at this time.
0 commit comments