[libc-commits] [PATCH] D145476: [libc] Add fenv functions to arm32 baremetal config.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Mar 6 23:59:35 PST 2023


sivachandra created this revision.
sivachandra added reviewers: lntue, michaelrj.
Herald added subscribers: libc-commits, ecnelises, tschuett, abidh, kristof.beyls.
Herald added projects: libc-project, All.
sivachandra requested review of this revision.

Also, an "arm" subfolder for baremetal config has been added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145476

Files:
  libc/config/baremetal/api.td
  libc/config/baremetal/arm/entrypoints.txt
  libc/config/baremetal/arm/headers.txt
  libc/config/baremetal/entrypoints.txt
  libc/config/baremetal/headers.txt
  libc/include/llvm-libc-types/fenv_t.h


Index: libc/include/llvm-libc-types/fenv_t.h
===================================================================
--- libc/include/llvm-libc-types/fenv_t.h
+++ libc/include/llvm-libc-types/fenv_t.h
@@ -14,12 +14,17 @@
   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__
Index: libc/config/baremetal/arm/headers.txt
===================================================================
--- libc/config/baremetal/arm/headers.txt
+++ 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
Index: libc/config/baremetal/arm/entrypoints.txt
===================================================================
--- libc/config/baremetal/arm/entrypoints.txt
+++ libc/config/baremetal/arm/entrypoints.txt
@@ -85,6 +85,22 @@
 )
 
 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
Index: libc/config/baremetal/api.td
===================================================================
--- libc/config/baremetal/api.td
+++ libc/config/baremetal/api.td
@@ -5,6 +5,10 @@
 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"];
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145476.502936.patch
Type: text/x-patch
Size: 2211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230307/17d958f3/attachment-0001.bin>


More information about the libc-commits mailing list