[bazel] Port 628fbbef81c5ac806e6dbf2bce18dd44980051b1
[libc] Implement sinf function that is correctly rounded to all rounding modes.Implement sinf function that is correctly rounded to all rounding modes.- We use a simple range reduction for `pi/16
[libc] Implement sinf function that is correctly rounded to all rounding modes.Implement sinf function that is correctly rounded to all rounding modes.- We use a simple range reduction for `pi/16 < |x|` : Let `k = round(x / pi)` and `y = (x/pi) - k`. So `k` is an integer and `-0.5 <= y <= 0.5`.Then```sin(x) = sin(y*pi + k*pi) = (-1)^(k & 1) * sin(y*pi) ~ (-1)^(k & 1) * y * P(y^2)``` where `y*P(y^2)` is a degree-15 minimax polynomial generated by Sollya with:```> P = fpminimax(sin(x*pi)/x, [|0, 2, 4, 6, 8, 10, 12, 14|], [|D...|], [0, 0.5]);```- Performance benchmark using perf tool from CORE-MATH project(https://gitlab.inria.fr/core-math/core-math/-/tree/master) on Ryzen 1700:Before this patch (not correctly rounded):```$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh sinfCORE-MATH reciprocal throughput : 17.892System LIBC reciprocal throughput : 25.559LIBC reciprocal throughput : 29.381```After this patch (correctly rounded):```$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh sinfCORE-MATH reciprocal throughput : 17.896System LIBC reciprocal throughput : 25.740LIBC reciprocal throughput : 27.872LIBC reciprocal throughput : 20.012 (with `-msse4.2` flag)LIBC reciprocal throughput : 14.244 (with `-mfma` flag)```Reviewed By: zimmermann6Differential Revision: https://reviews.llvm.org/D123154
show more ...
[libc] Add nearest integer instructions to fputil.Add round to nearest integer instructions to fputil. This will beused in sinf implementation https://reviews.llvm.org/D123154Reviewed By: micha
[libc] Add nearest integer instructions to fputil.Add round to nearest integer instructions to fputil. This will beused in sinf implementation https://reviews.llvm.org/D123154Reviewed By: michaelrjDifferential Revision: https://reviews.llvm.org/D129776
[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
Re-land [libc] Apply no-builtin everywhere, remove unnecessary flagsThis is a reland of D126773 / b2a9ea4420127d10b18ae648b16757665f8bbd7c.The removal of `-mllvm -combiner-global-alias-analysis`
Re-land [libc] Apply no-builtin everywhere, remove unnecessary flagsThis is a reland of D126773 / b2a9ea4420127d10b18ae648b16757665f8bbd7c.The removal of `-mllvm -combiner-global-alias-analysis` has landed separatelyin D128051 / 7b73f53790f3db9ee589dc26a05a481a5e9e6915.And the removal of `-mllvm --tail-merge-threshold=0` is scheduled forremoval in a subsequent patch.
[libc] Rely on __builtin_memcpy_inline for memcpy implementationThis patch removes usage of `-mllvm -combiner-global-alias-analysis`and relies on compiler builtin to implement `memcpy`.Note that
[libc] Rely on __builtin_memcpy_inline for memcpy implementationThis patch removes usage of `-mllvm -combiner-global-alias-analysis`and relies on compiler builtin to implement `memcpy`.Note that `-mllvm -combiner-global-alias-analysis` is actually only useful forfunctions where buffers can alias (namely `memcpy` and `memmove`). The othermemory functions where not benefiting from the flag anyways.The upside is that the memory functions can now be compiled from source withthinlto (thinlto would not be able to carry on the flag when doing inlining).The downside is that for compilers other than clang (i.e. not providing`__builtin_memcpy_inline`) the codegen may be worse.Differential Revision: https://reviews.llvm.org/D128051
[libc][bazel] Remove memcpy dependency in memmove
Revert "[libc] Apply no-builtin everywhere, remove unnecessary flags"This reverts commit b2a9ea4420127d10b18ae648b16757665f8bbd7c.
Fix bazel BUILD.
[libc] Add expm1f function to bazel's build overlay.Add expm1f function to bazel's build overlay.Reviewed By: gchateletDifferential Revision: https://reviews.llvm.org/D127298
[libc] fix typo in BUILD.bazel feature
[libc] Apply no-builtin everywhere, remove unnecessary flagsNote, this is a re-submission of D125894 with `features = ["-header_modules"]`added to the main BUILD.bazel file.Some functions like `
[libc] Apply no-builtin everywhere, remove unnecessary flagsNote, this is a re-submission of D125894 with `features = ["-header_modules"]`added to the main BUILD.bazel file.Some functions like `stpncpy` are implemented in terms of `memset` but are notcurrently using `-fno-builtin-memset`. This is somewhat hidden by the fact thatwe use `-ffreestanding` globally and that `-ffreestanding` implies`-fno-builtin` for Clang.This patch also removes `-mllvm -combiner-global-alias-analysis` that is Clangspecific and that does not bring substantial gains on modern processors.Also we keep `-mllvm --tail-merge-threshold=0` for aarch64 in CMakeLists.txtbut we omit it in the Bazel config. This is because Bazel consumes the sourcefiles directly and so it can use PGO to take optimal decisions locally.Differential Revision: https://reviews.llvm.org/D126773
[Bazel] Fix typo: startlark=>starlark
Revert "[libc] Apply no-builtin everywhere, remove unnecessary flags"This reverts commit 94d6dd90576637fa0eb2c40ca92320ad4c1a6942.
[bazel][libc] Fix bazel buildDifferential revision: https://reviews.llvm.org/D126028
[libc] Apply no-builtin everywhere, remove unnecessary flagsSome functions like `stpncpy` are implemented in terms of `memset` but are notcurrently using `-fno-builtin-memset`. This is somewhat hi
[libc] Apply no-builtin everywhere, remove unnecessary flagsSome functions like `stpncpy` are implemented in terms of `memset` but are notcurrently using `-fno-builtin-memset`. This is somewhat hidden by the fact thatwe use `-ffreestanding` globally and that `-ffreestanding` implies`-fno-builtin` for Clang.This patch also removes `-mllvm -combiner-global-alias-analysis` that is Clangspecific and that does not bring substantial gains on modern processors.Also we keep `-mllvm --tail-merge-threshold=0` for aarch64 in CMakeLists.txtbut we omit it in the Bazel config. This is because Bazel consumes the sourcefiles directly and so it can use PGO to take optimal decisions locally.Differential Revision: https://reviews.llvm.org/D125894
[libc] fix uint includes and libc bazelThis patch fixes the includes for the new UInt class so that the apitest now passes, additionally it fixes the bazel files to account forthe new dependencie
[libc] fix uint includes and libc bazelThis patch fixes the includes for the new UInt class so that the apitest now passes, additionally it fixes the bazel files to account forthe new dependencies.Differential Revision: https://reviews.llvm.org/D125490
Fix bazel rule for __support_fputil_fma when using header modules.Putting __support/FPUtil/x86_64/FMA.h in `hdrs` will trigger acompilation action for that header, and it will always `#error` out
Fix bazel rule for __support_fputil_fma when using header modules.Putting __support/FPUtil/x86_64/FMA.h in `hdrs` will trigger acompilation action for that header, and it will always `#error` out fornon-FMA targets. Move these platform-specific headers that areconditionally included to `textual_hdrs` instead.
[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
Correct and complete dependency sets after 74b411d38c48513a125e67e049aca55452b9e855Prior to this change the __support_cpp_array_ref target's only dependency was libc_root.but it #includes "TypeTra
Correct and complete dependency sets after 74b411d38c48513a125e67e049aca55452b9e855Prior to this change the __support_cpp_array_ref target's only dependency was libc_root.but it #includes "TypeTraits.h" and Array.h for that matter.These dependencies matter when building in distributed build systems and the relevantfiles must be know for the distributed build to ship them to the executor.Differential Revision: https://reviews.llvm.org/D121974
[libc][bazel] split support_standalone_cpp targetpreviously the support_standalone_cpp target contained all of the filesin the __support/cpp folder. This change splits these out so that onlywhat
[libc][bazel] split support_standalone_cpp targetpreviously the support_standalone_cpp target contained all of the filesin the __support/cpp folder. This change splits these out so that onlywhat is needed is included. In addition, this change adds the newsupport files that previously didn't have targets.Reviewed By: lntue, gchateletDifferential Revision: https://reviews.llvm.org/D121314
[bazel] Port 76ec69a911c6
[bazel] Add libc dependency.
[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][bazel overlay] Add a target for strncpy.
12