File tree Expand file tree Collapse file tree 5 files changed +80
-368
lines changed Expand file tree Collapse file tree 5 files changed +80
-368
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,53 @@ def AssertAPI : PublicAPI<"assert.h"> {
7171 ];
7272}
7373
74+ def MathErrHandlingMacro : MacroDef<"math_errhandling"> {
75+ let Defn = [{
76+ #ifndef math_errhandling
77+ #ifdef __FAST_MATH__
78+ #define math_errhandling 0
79+ #elif defined __NO_MATH_ERRNO__
80+ #define math_errhandling (MATH_ERREXCEPT)
81+ #else
82+ #define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
83+ #endif
84+ #endif // math_errhandling not defined
85+ }];
86+ }
87+
88+ def IsFiniteMacro : MacroDef<"isfinite"> {
89+ let Defn = [{
90+ #define isfinite(x) __builtin_isfinite(x)
91+ }];
92+ }
93+
94+ def IsInfMacro : MacroDef<"isinf"> {
95+ let Defn = [{
96+ #define isinf(x) __builtin_isinf(x)
97+ }];
98+ }
99+
100+ def IsNanMacro : MacroDef<"isnan"> {
101+ let Defn = [{
102+ #define isnan(x) __builtin_isnan(x)
103+ }];
104+ }
105+
74106def MathAPI : PublicAPI<"math.h"> {
107+ let Macros = [
108+ SimpleMacroDef<"MATH_ERRNO", "1">,
109+ SimpleMacroDef<"MATH_ERREXCEPT", "2">,
110+ MathErrHandlingMacro,
111+
112+ SimpleMacroDef<"INFINITY", "__builtin_inff()">,
113+ SimpleMacroDef<"NAN", "__builtin_nanf(\"\")">,
114+
115+ IsFiniteMacro,
116+ IsInfMacro,
117+ IsNanMacro,
118+ ];
75119 let Functions = [
76- "acos",
77- "acosl",
120+ "round",
78121 ];
79122}
80123
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ add_header(
1919 llvm_libc_common_h
2020)
2121
22- add_header (
22+ add_gen_header (
2323 math_h
24- HDR
25- math .h
24+ DEF_FILE math.h.def
25+ GEN_HDR math.h
2626 DEPENDS
2727 llvm_libc_common_h
2828)
You can’t perform that action at this time.
0 commit comments