Skip to content

Commit 873431a

Browse files
authored
[libc] Add __FE_DENORM to the fenv macros (llvm#91353)
Summary: Some targets support denormals as floating point exceptions. This is provided as an extension in the GNU headers as __FE_DENORM. This provides it in our headers, however I'm unsure if we should make it internal or external. I do not think it should be in all exception as it doesn't represent an exceptional behavior as far as the standard is concerned, but I'm not an expert.
1 parent 026a29e commit 873431a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

libc/hdr/fenv_macros.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
#include <fenv.h>
1919

20+
// If this is not provided by the system, define it for use internally.
21+
#ifndef __FE_DENORM
22+
#define __FE_DENORM (1 << 6)
23+
#endif
24+
2025
#endif // LLVM_LIBC_FULL_BUILD
2126

2227
#endif // LLVM_LIBC_HDR_FENV_MACROS_H

libc/include/llvm-libc-macros/fenv-macros.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
#ifndef LLVM_LIBC_MACROS_FENV_MACROS_H
1010
#define LLVM_LIBC_MACROS_FENV_MACROS_H
1111

12-
#define FE_DIVBYZERO 1
13-
#define FE_INEXACT 2
14-
#define FE_INVALID 4
15-
#define FE_OVERFLOW 8
16-
#define FE_UNDERFLOW 16
12+
#define FE_DIVBYZERO 0x1
13+
#define FE_INEXACT 0x2
14+
#define FE_INVALID 0x4
15+
#define FE_OVERFLOW 0x8
16+
#define FE_UNDERFLOW 0x10
17+
#define __FE_DENORM 0x20
1718
#define FE_ALL_EXCEPT \
1819
(FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
1920

0 commit comments

Comments
 (0)