aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2023-03-07 06:24:10 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2023-03-07 18:11:20 +0000
commit439eebab81c36a8720bc5c9e79bc54e065adc44f (patch)
tree371fbef482eb469fc5b0542061157e9455c29959
parent24c251d94daaf6f36945445cac8562a1214bfaee (diff)
downloadllvm-439eebab81c36a8720bc5c9e79bc54e065adc44f.zip
llvm-439eebab81c36a8720bc5c9e79bc54e065adc44f.tar.gz
llvm-439eebab81c36a8720bc5c9e79bc54e065adc44f.tar.bz2
[libc] Add fenv functions to arm32 baremetal config.
Also, an "arm" subfolder for baremetal config has been added. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D145476
-rw-r--r--libc/config/baremetal/api.td4
-rw-r--r--libc/config/baremetal/arm/entrypoints.txt (renamed from libc/config/baremetal/entrypoints.txt)16
-rw-r--r--libc/config/baremetal/arm/headers.txt (renamed from libc/config/baremetal/headers.txt)1
-rw-r--r--libc/include/llvm-libc-types/fenv_t.h9
4 files changed, 28 insertions, 2 deletions
diff --git a/libc/config/baremetal/api.td b/libc/config/baremetal/api.td
index 6d5a4a4..d6897fb 100644
--- a/libc/config/baremetal/api.td
+++ b/libc/config/baremetal/api.td
@@ -5,6 +5,10 @@ include "spec/stdc.td"
def CTypeAPI : PublicAPI<"ctype.h"> {
}
+def FEnvAPI : PublicAPI<"fenv.h"> {
+ let Types = ["fenv_t", "fexcept_t"];
+}
+
def IntTypesAPI : PublicAPI<"inttypes.h"> {
let Types = ["imaxdiv_t"];
}
diff --git a/libc/config/baremetal/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 183cf1b..8f173d5 100644
--- a/libc/config/baremetal/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -85,6 +85,22 @@ set(TARGET_LIBC_ENTRYPOINTS
)
set(TARGET_LIBM_ENTRYPOINTS
+ # fenv.h entrypoints
+ libc.src.fenv.feclearexcept
+ libc.src.fenv.fedisableexcept
+ libc.src.fenv.feenableexcept
+ libc.src.fenv.fegetenv
+ libc.src.fenv.fegetexcept
+ libc.src.fenv.fegetexceptflag
+ libc.src.fenv.fegetround
+ libc.src.fenv.feholdexcept
+ libc.src.fenv.fesetenv
+ libc.src.fenv.fesetexceptflag
+ libc.src.fenv.fesetround
+ libc.src.fenv.feraiseexcept
+ libc.src.fenv.fetestexcept
+ libc.src.fenv.feupdateenv
+
# math.h entrypoints
libc.src.math.fabs
libc.src.math.fabsf
diff --git a/libc/config/baremetal/headers.txt b/libc/config/baremetal/arm/headers.txt
index cc436c7..b5c93ae 100644
--- a/libc/config/baremetal/headers.txt
+++ b/libc/config/baremetal/arm/headers.txt
@@ -1,5 +1,6 @@
set(TARGET_PUBLIC_HEADERS
libc.include.ctype
+ libc.include.fenv
libc.include.errno
libc.include.inttypes
libc.include.math
diff --git a/libc/include/llvm-libc-types/fenv_t.h b/libc/include/llvm-libc-types/fenv_t.h
index a95e081..3e33a17 100644
--- a/libc/include/llvm-libc-types/fenv_t.h
+++ b/libc/include/llvm-libc-types/fenv_t.h
@@ -14,12 +14,17 @@ typedef struct {
unsigned char __control_word[4];
unsigned char __status_word[4];
} fenv_t;
-#endif
-#ifdef __x86_64__
+#elif defined(__x86_64__)
typedef struct {
unsigned char __x86_status[28];
unsigned char __mxcsr[4];
} fenv_t;
+#elif defined(__arm__) || defined(_M_ARM)
+typedef struct {
+ unsigned int __fpscr;
+} fenv_t;
+#else
+#error "fenv_t not defined for your platform"
#endif
#endif // __LLVM_LIBC_TYPES_FENV_T_H__