Commit Graph

70 Commits

Author SHA1 Message Date
parallels bc45bab7eb [libc] Add strtok_r implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85779
2020-08-13 15:51:38 -04:00
cgyurgyik 667843cc07 [libc] Add strtok implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85615
2020-08-11 13:44:53 -04:00
Siva Chandra Reddy 5d59385ba6 [libc] Setup TLS in x86_64 loader.
The new code added is still very x86_64 specific. AArch64 support will
be added very soon and refactoring of the loader code will be done as
part of the patches adding it.

Reviewed By: asteinhauser

Differential Revision: https://reviews.llvm.org/D82700
2020-08-07 23:19:03 -07:00
cgyurgyik dc13a9a781 [libc] Add strcpsn and strpbrk implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85386
2020-08-07 16:14:32 -04:00
cgyurgyik 128bf458ab [libc] Add tolower, toupper implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85326
2020-08-06 15:21:38 -04:00
cgyurgyik f3b4150255 [libc] Add strspn implementation and std::bitset
Reviewed By: sivachandra, abrachet

Differential Revision: https://reviews.llvm.org/D85103
2020-08-05 16:48:38 -04:00
Chris Gyurgyik 049f6ad4f6
[libc] [obvious] Add ctype functions to linux api.
Adds isspace, isprint, and isxdigit to Linux API to fix failed integration test.
2020-08-05 11:05:50 -04:00
cgyurgyik 1fdab96130 [libc] Add isspace, isprint, isxdigit implementations.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85270
2020-08-05 10:51:43 -04:00
cgyurgyik 6cd50e7b75 [libc] Add implementations for isblank, iscntrl, isgraph, ispunct.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85059
2020-08-04 15:16:58 -04:00
cgyurgyik e8a2af28af [libc] Adds strrchr implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84875
2020-07-31 14:38:34 -04:00
cgyurgyik e2d4bf6cec [libc] Add islower and isupper implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84960
2020-07-31 14:05:27 -04:00
cgyurgyik e263dcc3ef [libc] Implements isdigit and isalnum. Adds a utility header to inline
functions to avoid overhead of function calls.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84893
2020-07-30 12:37:30 -04:00
Siva Chandra Reddy 462b3564f1 [libc][obvious] Add the new ctype.h target to the list of x86_64 headers.
This will fix the integration test which is failing currently.
2020-07-28 16:42:25 -07:00
cgyurgyik 686c82b974 [libc] Add scaffolding for ctype and implementation of isalpha
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84575
2020-07-28 19:17:31 -04:00
cgyurgyik 51eeeb477f [libc] [Obvious] Place entrypoints, specs alphabetically. 2020-07-24 15:52:35 -04:00
cgyurgyik 5a9630b777 [libc] Adds implementation for memrchr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D84469
2020-07-24 14:40:12 -04:00
Tue Ly 4096088e19 [libc] Add implementations of fmax, fmaxf, and fmaxl.
Summary: Add implementations of fmax, fmaxf, and fmaxl.

Reviewers: sivachandra

Subscribers: mgorny, tschuett, libc-commits, ecnelises

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D84385
2020-07-23 15:23:08 -04:00
cgyurgyik f773d37ee1 [libc] Implements strnlen.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84247
2020-07-22 18:28:35 -04:00
Tue Ly 7ce32f87f9 Add implementations for fmin, fminf, and fminl. Testing infrastructure update is splitted to https://reviews.llvm.org/D83931. 2020-07-21 17:24:15 -04:00
Chris Gyurgyik a16129c138
[libc] [Obvious] Fix typo.
Fixes typo for strstr in entrypoints.
str -> src.
2020-07-21 11:52:12 -04:00
cgyurgyik d080635bfc [libc] Add strstr implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D83956
2020-07-21 11:39:23 -04:00
cgyurgyik a4f0c58c6e [libc] Add strchr implementation. Fixes bug in memchr.
Summary: [libc] Adds strchr implementation with unit tests. Fixes signed character bug in memchr.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D83353
2020-07-10 14:30:20 -04:00
cgyurgyik b6a20a4970 [libc] Add memchr implementation. 2020-07-07 17:08:50 -04:00
Siva Chandra Reddy d4adac4832 [libc] Add the remaining long double flavors of nearest integer functions.
Specifically: ceill, floorl and roundl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82591
2020-06-25 22:45:05 -07:00
Siva Chandra 25ac19de4b [libc] Enable copysignl, frexpl, logbl and modfl on aarch64. 2020-06-24 00:16:23 -07:00
Siva Chandra Reddy a00fb593b4 [libc] Add long double flavors of the floating point manipulation functions.
Specifically: copysignl, frexpl, logbl and modfl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82357
2020-06-23 23:46:58 -07:00
cgyurgyik 05e1612c43 [libc] This adds the strcmp (string compare) implementation.
Reviewed-by: sivachandra
Differential Revision: https://reviews.llvm.org/D82134
2020-06-19 16:09:44 -04:00
Siva Chandra Reddy 139018265b [libc] Add implementations long double fabsl and truncl functions.
Current implementations of single precision and double precision
floating point operations operate on bits of the integer type of
same size. The code made use of magic masks which were listed as
literal integer values. This is not possible in the case of long
double type as the mantissa of quad-precision long double type used
on non-x86 architectures is wider that the widest integer type for
which we can list literal values. So, in this patch, to avoid
using magic masks specified with literal values, we use packed
bit-field struct types and let the compiler generate the masks.
This new scheme allows us to implement long double flavors of the
various floating point operations. To keep the size of the patch
small, only the implementations of fabs and trunc have been
switched to the new scheme. In following patches, all exisiting
implementations will be switched to the new scheme.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82036
2020-06-18 11:08:26 -07:00
Siva Chandra 7e54df6829 [libc] Enable string functions for aarch64. 2020-06-15 09:36:40 -07:00
Siva Chandra Reddy 118c13c691 [libc] Add implementation of few floating point manipulation functions.
Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D81134
2020-06-11 12:23:11 -07:00
Siva Chandra 1f567b2c6f [libc] Add a simple linux aarch64 config.
Summary:
With this change, "ninja check-libc" on linux/aarch64 succeeds.

However, all entrypoints with machine dependent implementations
have been skipped. A good number of these skipped entrypoints can
be enabled once we have aarch64 syscall support available.

Reviewers: abrachet, asteinhauser

Differential Revision: https://reviews.llvm.org/D81533
2020-06-10 11:19:52 -07:00
Siva Chandra Reddy 4be1c116ad [libc] Add implementations of round and roundf.
Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D80779
2020-06-09 23:01:20 -07:00
Siva Chandra Reddy 235e9cc924 [libc][NFC][Obvious] Tidy up some CMake files.
Conditionally adding subdirectories was missed in a few places previously.
This change adds the conditionals. A sub-directory was being added
needlessly in another place. That has been removed.
2020-06-09 15:54:07 -07:00
Siva Chandra Reddy fd3295fb6f [libc] Skip entrypoints not present in the entrypoints list.
Summary:
If a test depends on a skipped entrypoint, then the test is also
skipped. This setup will be useful as we gradually add support for
more operating systems and target architectures.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D81489
2020-06-09 14:40:28 -07:00
Siva Chandra Reddy 11eafdb1d9 [libc][NFC] Add few more missing entrypoints to the entrypoint list.
They were likely missed while rebasing.
2020-06-08 22:08:42 -07:00
Siva Chandra Reddy 63bbddf4cd [libc][NFC] Add bzero to list of entrypoints.
A new LLVM libc specific extension standard spec has been added.
2020-06-08 21:44:39 -07:00
Siva Chandra Reddy b28167928d [libc][NFC] Add ceil[f], floor[f] and trunc[f] to the spec and config files. 2020-06-03 22:39:34 -07:00
Paula Toth b836ae24a9 [libc] Add integration tests.
Summary:
This patch aims to add integration tests to check the following:
1) Header files are generated as expected.
2) Libc functions have the correct public name.
3) Libc functions have the correct return type and parameter types.
4) Symbols are exposed in the public lib.a files.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra

Subscribers: aheejin, ecnelises, dxf, mgorny, jfb, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79192
2020-06-02 12:14:07 -07:00
Siva Chandra Reddy 0baf0e8cfc [libc] Add implementation of call_once from threads.h.
Reviewers: abrachet, maskray

Differential Revision: https://reviews.llvm.org/D79828
2020-05-28 23:45:09 -07:00
Siva Chandra Reddy 96d85726b0 [libc] Move implementations of expf and exp2f from the AOR to src/math.
Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79149
2020-05-15 12:43:03 -07:00
Siva Chandra Reddy 4a39a33d44 [libc] Add implementation of fabs and fabsf.
Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79725
2020-05-15 11:10:43 -07:00
Siva Chandra Reddy 245cbd15a4 [libc] Add definitions of double_t and float_t to math.h.
This change does not handle any extensions. Only the C standard
variations are handled.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D79150
2020-04-30 11:59:11 -07:00
Paula Toth 29213878e7 [libc] Add spec for sigdelset and sigfillset.
Summary: Caught by libc-tidy from patch D77281.

Reviewers: abrachet, sivachandra

Reviewed By: abrachet

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D78703
2020-04-23 16:38:47 -07:00
Alex Brachet 5793c84925 [libc] Add write(2) implementation for Linux and FDReader test utility
Summary: Adds `write` for Linux and FDReader utility which should be useful for some stdio tests as well.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D78184
2020-04-17 13:21:05 -04:00
Siva Chandra Reddy 5fedf7f420 [libc] Move implementations of cosf, sinf, sincosf to src/math directory.
NFC intended in the implementaton. Only mechanical changes to fit the LLVM
libc implementation standard have been done.

Math testing infrastructure has been added. This infrastructure compares the
results produced by the libc with the high precision results from MPFR.
Tests making use of this infrastructure have been added for cosf, sinf and
sincosf.

Reviewers: abrachet, phosek

Differential Revision: https://reviews.llvm.org/D76825
2020-04-16 08:46:10 -07:00
Alex Brachet 99aea57928 [libc] Add very basic stdio FILE and fwrite
Summary:
This patch adds a very basic `FILE` type and basic `fwrite`.

It also removes `snprintf` from `StdIO`'s function spec because `VarArgType` was causing the generation to fail.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D77626
2020-04-14 04:02:27 -04:00
Siva Chandra Reddy e4767a6f14 [libc] Add fully-qualified target names.
Only targets setup by the special LLVM libc rules now have fully
qualified names. The naming style is similar to fully qualified names in
Python.

Reviewers: abrachet, PaulkaToast, phosek

Differential Revision: https://reviews.llvm.org/D77340
2020-04-10 18:01:52 -07:00
Paula Toth 66d00feb18 [libc][NFC] Make all top of file comments consistent.
Summary:
Made all header files consistent based of this documentation: https://llvm.org/docs/CodingStandards.html#file-headers.
And did the same for all source files top of file comments.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D77533
2020-04-08 10:18:37 -07:00
Siva Chandra Reddy 2c080a3f23 [libc] Generate math.h instead of the static file it is currently.
Just enough to help a follow up patch adding cosf and sinf has been
added.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D76723
2020-03-24 21:17:55 -07:00
Alex Brachet ca04d0c8fd [libc] Add signal
Summary:
This patch adds a Linux implementation for `signal`
It also fixes `ASSERT|EXPECT_THAT` macros

Reviewers: sivachandra, PaulkaToast, MaskRay

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Differential Revision: https://reviews.llvm.org/D76536
2020-03-22 14:15:47 -04:00