[libc] Add imaxabsDifferential Revision: https://reviews.llvm.org/D129517
[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 strlcatDifferential Revision: https://reviews.llvm.org/D125978
[libc] Add strlcpyDifferential Revision: https://reviews.llvm.org/D125806
[libc] Initial support for darwin-aarch64.Add initial support for darwin-aarch64 (macOS M1).Some differences compared to linux-aarch64:- `math.h` defined `math_errhandling` by the compiler built
[libc] Initial support for darwin-aarch64.Add initial support for darwin-aarch64 (macOS M1).Some differences compared to linux-aarch64:- `math.h` defined `math_errhandling` by the compiler builtin `__math_errhandling()` but Apple Clang 13.0.0 on M1 does not support `__math_errhandling()` builtin as a macro function or a constexpr function.- `math.h` defines `UNDERFLOW` and `OVERFLOW` macros.- Besides 5 usual floating point exceptions: `FE_INEXACT`, `FE_UNDERFLOW`, `FE_OVERFLOW`, `FE_DIVBYZERO`, and `FE_INVALID`, `fenv.h` also has another floating point exception: `FE_FLUSHTOZERO`. The corresponding trap for `FE_FLUSHTOZERO` in the control register is at the different location compared to the status register.- `FE_FLUSHTOZERO` exception flag cannot be raised with the default CPU floating point operation mode.Reviewed By: sivachandraDifferential Revision: https://reviews.llvm.org/D120914