Skip to content

Commit

Permalink
[libc] Add fenv functions to arm32 baremetal config.
Browse files Browse the repository at this point in the history
Also, an "arm" subfolder for baremetal config has been added.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D145476
  • Loading branch information
Siva Chandra Reddy committed Mar 7, 2023
1 parent 24c251d commit 439eeba
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libc/config/baremetal/api.td
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(TARGET_PUBLIC_HEADERS
libc.include.ctype
libc.include.fenv
libc.include.errno
libc.include.inttypes
libc.include.math
Expand Down
9 changes: 7 additions & 2 deletions libc/include/llvm-libc-types/fenv_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__

0 comments on commit 439eeba

Please sign in to comment.