[libc][math] Fix broken compilation due to __builtin_inf/nan functions.
[libc][math] Fix broken aarch64 due to clz refactoring.
[libc][math] fmod/fmodf implementation.This is a implementation of find remainder fmod function from standard libm.The underline algorithm is developed by myself, but probably it was firstinvente
[libc][math] fmod/fmodf implementation.This is a implementation of find remainder fmod function from standard libm.The underline algorithm is developed by myself, but probably it was firstinvented before.Some features of the implementation:1. The code is written on more-or-less modern C++.2. One general implementation for both float and double precision numbers.3. Spitted platform/architecture dependent and independent code and tests.4. Tests covers 100% of the code for both float and double numbers. Tests cases with NaN/Inf etc is copied from glibc.5. The new implementation in general 2-4 times faster for “regular” x,y values. It can be 20 times faster for x/y huge value, but can also be 2 times slower for double denormalized range (according to perf tests provided).6. Two different implementation of division loop are provided. In some platforms division can be very time consuming operation. Depend on platform it can be 3-10 times slower than multiplication.Performance tests:The test is based on core-math project (https://gitlab.inria.fr/core-math/core-math). By Tue Ly suggestion I took hypot function and use it as template for fmod. Preserving all test cases.`./check.sh <--special|--worst> fmodf` passed.`CORE_MATH_PERF_MODE=rdtsc ./perf.sh fmodf` results are```GNU libc version: 2.35GNU libc release: stable21.166 <-- FPU51.031 <-- current glibc37.659 <-- this fmod version.```
show more ...
[libc] Add Uint128 type as a fallback when __uint128_t is not available.Also, the unused specializations of __int128_t have been removed.Differential Revision: https://reviews.llvm.org/D128304
[libc] Implement double precision FMA for targets without FMA instructions.Implement double precision FMA (Fused Multiply-Add) for targets withoutFMA instructions using __uint128_t to store the in
[libc] Implement double precision FMA for targets without FMA instructions.Implement double precision FMA (Fused Multiply-Add) for targets withoutFMA instructions using __uint128_t to store the intermediate results.Reviewed By: michaelrj, sivachandraDifferential Revision: https://reviews.llvm.org/D124495
[libc][Obvious] Change all __builtin_clz* calls to clz in builtin_wrappers.h.
[libc][math] Separated builtin function in special FPUtils header.A small refactoring of builtin functions in preparation to adding fmod/fmodf function.Reviewed By: lntueDifferential Revision:
[libc][math] Separated builtin function in special FPUtils header.A small refactoring of builtin functions in preparation to adding fmod/fmodf function.Reviewed By: lntueDifferential Revision: https://reviews.llvm.org/D127088
[libc] Add support for x86-64 targets that do not have FMA instructions.Make FMA flag checks more accurate for x86-64 targets, and refactorpolyeval to use multiply and add instead when FMA instruc
[libc] Add support for x86-64 targets that do not have FMA instructions.Make FMA flag checks more accurate for x86-64 targets, and refactorpolyeval to use multiply and add instead when FMA instructions are notavailable.Reviewed By: michaelrj, sivachandraDifferential Revision: https://reviews.llvm.org/D123335
Use __builtin_clz to find leading 1 in generic sqrt (where possible)__builtin_clz requires just a single instruction on x86 and arm, so this is a performance improvement.Reviewed By: lntueDiffe
Use __builtin_clz to find leading 1 in generic sqrt (where possible)__builtin_clz requires just a single instruction on x86 and arm, so this is a performance improvement.Reviewed By: lntueDifferential Revision: https://reviews.llvm.org/D120579
[libc] Replace type punning with bit_castAlthough type punning is defined for union in C, it is UB in C++.This patch introduces a bit_cast function to convert between types in a safe way.This is
[libc] Replace type punning with bit_castAlthough type punning is defined for union in C, it is UB in C++.This patch introduces a bit_cast function to convert between types in a safe way.This is necessary to get llvm-libc compile with GCC.This patch is extracted from D119002.Differential Revision: https://reviews.llvm.org/D119145
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.Re-apply https://reviews.llvm.org/D118173 with fix for aarch64.Reviewed By: michaelrjDifferential Revision: h
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.Re-apply https://reviews.llvm.org/D118173 with fix for aarch64.Reviewed By: michaelrjDifferential Revision: https://reviews.llvm.org/D118433
[libc] Revert "Refactor sqrt implementations and add tests for generic sqrt implementations."This reverts commit 21c4c82c2026bac1f53be54923c0663d41d0a0aa.
[libc] Revert "Guard sqrt_80_bit_long_double.h header to not be included with aarch64."This reverts commit 4a979c42564e622fdf283ae8d0b7a59ebe567533.
[libc] Guard sqrt_80_bit_long_double.h header to not be included with aarch64.Guard sqrt_80_bit_long_double.h header to not be included with aarch64.Reviewed By: sivachandraDifferential Revisio
[libc] Guard sqrt_80_bit_long_double.h header to not be included with aarch64.Guard sqrt_80_bit_long_double.h header to not be included with aarch64.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D118389
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.Refactor sqrt implementations:- Move architecture specific instructions from `src/math/<arch>` to `src/__support
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.Refactor sqrt implementations:- Move architecture specific instructions from `src/math/<arch>` to `src/__support/FPUtil/<arch>` folder.- Move generic implementation of `sqrt` to `src/__support/FPUtil/generic` folder and add it as a header library.- Use `src/__support/FPUtil/sqrt.h` for architecture/generic selections.- Add unit tests for generic implementation of `sqrt`.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D118173
[libc] apply new lint rulesThis patch applies the lint rules described in the previous patch. Therewas also a significant amount of effort put into manually fixing things,since all of the templat
[libc] apply new lint rulesThis patch applies the lint rules described in the previous patch. Therewas also a significant amount of effort put into manually fixing things,since all of the templated functions, or structs defined in /spec, werenot updated and had to be handled manually.Reviewed By: sivachandra, lntueDifferential Revision: https://reviews.llvm.org/D114302
Fix typos in FPUtil README
[libc][NFC] Move utils/CPP to src/__support/CPP.The idea is to move all pieces related to the actual libc sources to the"src" directory. This allows downstream users to ship and build just the"sr
[libc][NFC] Move utils/CPP to src/__support/CPP.The idea is to move all pieces related to the actual libc sources to the"src" directory. This allows downstream users to ship and build just the"src" directory.Reviewed By: michaelrjDifferential Revision: https://reviews.llvm.org/D112653
[libc][nfc][obvious] fix typos in FPUtilFix minor typos in FPUtil comments.Reviewed By: michaelrjDifferential Revision: https://reviews.llvm.org/D108952
[libc][nfc] move ctype_utils and FPUtils to __supportSome ctype functions are called from other libc functions (e.g. isspaceis used in atoi). By moving ctype_utils.h to __support it becomes easier
[libc][nfc] move ctype_utils and FPUtils to __supportSome ctype functions are called from other libc functions (e.g. isspaceis used in atoi). By moving ctype_utils.h to __support it becomes easierto include just the implementations of these functions. For thesereasons the implementation for isspace was moved intoctype_utils as well.FPUtils was moved to simplify the build order, and to clarify whichfiles are a part of the actual libc.Many files were modified to accomodate these changes, mostly changingthe #include paths.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D107600