Commit Graph

112 Commits

Author SHA1 Message Date
Cheng Wang a513be4900 [libc][Obvious] Fix typo in strnlen_test.cpp. 2020-11-27 15:56:19 +08:00
Michael Jones 3e18fb3390 [libc] Switch functions to using global headers
This switches all of the files in src/string, src/math, and
test/src/math from using relative paths (e.g. `#include “include/string.h”`)
to global paths (e.g. `#include <string.h>`) to make bringing up those
functions on other platforms, such as fuchsia, easier.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D91394
2020-11-21 00:07:17 +00:00
Siva Chandra Reddy 4d8dede5e5 [libc] Fix the overflow check condition of ldexp.
Targeted tests have been added.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D91752
2020-11-18 21:35:48 -08:00
Siva Chandra Reddy d1b921e3bf [libc][NFC][Obvious] Remove few unnecessary pieces from ilogb tests. 2020-11-18 11:26:05 -08:00
Siva Chandra Reddy bb8f2585c6 [libc] Add implementations of ldexp[f|l].
The rounding behavior of NormalFloat to float format has been changed
to round to nearest. Also, a bug in NormalFloat to subnormal number
conversion has been fixed.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D91591
2020-11-17 15:05:42 -08:00
Tue Ly d41280467d [libc] Add implementations of fdim[f|l].
Implementing fdim, fdimf, and fdiml for llvm-libc.

Differential Revision: https://reviews.llvm.org/D90906
2020-11-10 18:48:11 -05:00
Siva Chandra Reddy 930cf1cb9f [libc] Add implementations of ilogb[f|l].
Depends on D90805.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D90806
2020-11-05 16:27:44 -08:00
Siva Chandra Reddy 50c2f2b6f0 [libc][NFC][Obvious] Use the new macro to declare special constants in tests. 2020-11-03 15:44:06 -08:00
Siva Chandra Reddy e4be4bcf83 [libc][NFC] Use a convenience macro to declare special floating point constants.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D90262
2020-10-27 16:55:16 -07:00
Tue Ly f55963d501 [libc] Add implementation for hypotf
Truncating the sum of squares, and then use shift-and-add algorithm to compute its square root.
Required MPFR testing infra is updated in https://reviews.llvm.org/D87514

Differential Revision: https://reviews.llvm.org/D87516
2020-09-17 23:28:36 -04:00
Siva Chandra Reddy ba5b1371ec [libc][NFC] Add spec files as dependencies of integration test. 2020-09-09 10:22:27 -07:00
Siva Chandra Reddy 17ac4543d4 [libc][obvious] Use constants of type double in remquo_test. 2020-09-03 22:26:25 -07:00
Siva Chandra Reddy 8514ecb02d [libc] Add implementations of remquo[f|l] and remainder[f|l].
The implementation is not fully standards compliant in the sense that
errno is not set on error, and floating point exceptions are not raised.

Subnormal range and normal range are tested separately in the tests.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86666
2020-09-03 22:00:17 -07:00
Tue Ly 5078825aa9 [libc] Add implementations for sqrt, sqrtf, and sqrtl.
Differential Revision: https://reviews.llvm.org/D84726
2020-08-26 09:46:18 -04:00
Siva Chandra Reddy 3f4674a557 [libc] Extend MPFRMatcher to handle multiple-input-multiple-output functions.
Tests for frexp[f|l] now use the new capability. Not all input-output
combinations have been addressed by this change. Support for newer combinations
can be added in future as needed.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86506
2020-08-25 21:42:49 -07:00
Siva Chandra Reddy ed8982da3e [libc][NFC] Switch math tests to the new ULP based tolerance.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86267
2020-08-20 08:31:31 -07:00
Siva Chandra Reddy e2645488ca [libc][obvious] Fix x86 long double conversion to integer.
Fixes incorrectly constructed ceill tests.
2020-08-19 14:48:55 -07:00
Siva Chandra Reddy f768eb216f [libc][obvious] Fix link order of math tests. 2020-08-18 11:04:58 -07:00
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
Siva Chandra a87576592c [libc][obvious] Switch copysign[f|l] and fabs[f|l] to the new test matchers. 2020-08-12 00:20:58 -07:00
Siva Chandra 01b99c6e1d [libc][obvious] Switch nearest integer function tests to the new matchers. 2020-08-11 23:33:15 -07: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 f6d74b29d6 [libc][NFC] Disable a loader test as ld.gold fails to link.
Will be reenabled after investigating and fixing the problem.
2020-08-07 23:45:18 -07:00
Siva Chandra Reddy db936e0e91 [libc][NFC] Add library of floating point test matchers.
This eliminates UnitTest's dependency on FPUtil and hence prevents
non-math tests from depending indirectly on FPUtil. The patch
essentially moves some of the existing pieces into a library of its own.

Along the way, renamed add_math_unittest to add_fp_unittest.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D85486
2020-08-07 23:34:15 -07: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
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 5954755939 [libc] [obvious] Fix strchr and strrchr tests so that constness is
actually verified.
2020-07-31 20:00:59 -04:00
Chris Gyurgyik 7212ad067e
[libc] [obvious] Add rest of strrchr test. 2020-07-31 14:57:46 -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
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
Siva Chandra Reddy acca2980a3 [libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h. 2020-07-28 11:05:52 -07: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 1404d9d68a [libc] Remove unused #include <vector> in fmin_test, fminf_test, and fminl_test. 2020-07-23 15:26:05 -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
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 Reddy 7abdb2b948 [libc][Obvious] Remove a debug #include of iostream. 2020-06-24 00:01:03 -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
Siva Chandra Reddy dc72be4e01 [libc][Obvious] Fix few typos in tests. 2020-06-23 13:11:41 -07:00
Siva Chandra Reddy 987fac79c9 [libc] Match x86 long double NaN classification with that of the compiler.
Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82330
2020-06-22 23:02:05 -07:00