Joseph Huber
6d6feb7655
[libc] Add RPC helpers for dispatching functions to the host ( #179085 )
...
Summary:
The RPC interface is useful for forwarding functions. This PR adds
helper functions for doing a completely bare forwarding of a function
from the client to the server. This is intended to facilitate
heterogenous libraries that implement host functions on the GPU (like
MPI or Fortran).
2026-02-11 08:13:52 -06:00
Prabhu Rajasekaran
91224e35fd
[libc] Disable math exceptions for baremetal ( #180863 )
...
To further save code size for baremetal builds, disable math function
exceptions.
2026-02-10 16:49:05 -08:00
Michael Jones
ac1220f860
[libc] Add option to disable printf bit int ( #180832 )
...
Requested as a binary size optimization. Updates the parser, converter
utils, config, tests, and docs.
2026-02-10 15:41:38 -08:00
Anonmiraj
dc5ab0f149
[libc][math] Refactor powf to Header Only. ( #176531 )
...
closes : https://github.com/llvm/llvm-project/issues/176517
2026-02-10 23:31:05 +00:00
Anonmiraj
d8487e4b17
[libc][math] Refactor pow to Header Only. ( #176529 )
...
closes : #176516
2026-02-10 23:11:58 +00:00
Anonmiraj
b62a97abb7
[libc][math] Refactor log2f to Header Only. ( #176527 )
...
closes : #176514
2026-02-10 22:59:44 +00:00
Anonmiraj
76d9c2b40d
[libc][math] Refactor log2f16 to Header Only. ( #176526 )
...
closes : #176513
2026-02-10 22:33:22 +00:00
Anonmiraj
7068b52254
[libc][math] Refactor log10f to Header Only. ( #176520 )
...
closes : #176511
2026-02-10 22:16:36 +00:00
Anonmiraj
057ace3915
[libc][math] Refactor log1pf to Header Only. ( #176525 )
...
closes : #176512
2026-02-10 23:40:13 +02:00
Anonmiraj
04bb0e2c65
[libc][math] Refactor log10f16 to Header Only. ( #176523 )
...
closes : #176510
2026-02-10 23:37:23 +02:00
Mathew Joseph
5a8144da98
[libc][math] Refactor llogbl to be header-only ( #175376 )
...
Fixes : #175361
2026-02-10 21:32:06 +00:00
Joseph Huber
c9ee81a59e
[libc] Fix unit test dependency and respect LIBC_INCLUDE_BENCHMARKS ( #180812 )
...
Summary:
The unittest framework function is defined in another CMake file which
may not be present if the uesr disabled tests, provide a smaller version
here to keep this private. Also respesct the LIBC_INCLUDE_BENCHMARKS
variable.
2026-02-10 14:08:48 -06:00
Prabhu Rajasekaran
1c503e270a
[libc] Size optimized defaults for baremetal ( #180642 )
...
Disabling options that bloat typical size constrained baremetal targets
and in general not common in these targets. These configuration changes
reduce binary size significantly in our 32 bit ARM target experiments.
2026-02-09 19:31:09 -08:00
Petter Berntsson
19d6950739
[libc][docs] Fix stale entrypoints links and time.h table duplication ( #180347 )
...
Update stale links and remove duplication in table.
2026-02-10 00:02:28 +00:00
Prabhu Rajasekaran
d53272fad4
[libc] Disable Clinger fast path for baremetal ( #180598 )
...
Clinger fast path bloats baremetal targets which are constrained in
binary size. Disabling it for baremetal libc builds.
2026-02-09 15:17:39 -08:00
Zorojuro
d94caea215
[libc][math] Refactor ffmal to Header Only. ( #179069 )
...
closes #175326
Part of #147386
2026-02-07 16:13:09 +02:00
Iasonaskrpr
15832a6967
[libc][math] Refactor sqrtf128 to header only ( #177760 )
...
Closes #177652
2026-02-07 16:03:49 +02:00
petbernt
30533d0757
[libc][docs] Document printf NULL handling for %s/%n ( #180067 )
...
- Fix printf_behavior to describe NULL %s as printing "(null)" when
nullptr checks are enabled
- Point undefined_behavior NULL %s/%n entry at
LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS
- Add Sphinx labels to link directly to the flag and Conversion sections
2026-02-06 15:40:50 +00:00
Marcell Leleszi
2ba1eba4be
Revert "[libc][wctype] Implement internal UTF8 wctype classification functions" ( #180186 )
...
Reverts llvm/llvm-project#174607
Breaks libc++
2026-02-06 13:50:56 +01:00
Marcell Leleszi
85db121bcf
[libc][wctype] Implement internal UTF8 wctype classification functions ( #174607 )
...
Closes [#174604 ](https://github.com/llvm/llvm-project/issues/174604 )
This patch implements the internal wide character classification
functions with Unicode support.
The ASCII paths which were not implemented are taken from
[ctype_utils.h](https://github.com/llvm/llvm-project/blob/main/libc/src/__support/ctype_utils.h )
The tests mainly cover the dispatch logic between ASCII and UTF8, the
UTF8 variants are already comprehensively tested in
[wctype_classification_utils_test.cpp](https://github.com/mleleszi/llvm-project/blob/main/libc/test/src/__support/wctype/wctype_classification_utils_test.cpp ).
2026-02-06 13:04:08 +01:00
Zorojuro
ee816947ac
[libc][math] Refactor f16fmaf to Header Only. ( #178851 )
...
closes #175319
2026-02-05 21:56:27 +02:00
Haowei
7f5805bbec
[libc] Remove "stdio.h" include from fx_bits.h ( #179805 )
...
The "stdio.h" is not used, so remove it from the file. This is causing a
build failure as "stdio.h" is not specified in the build files.
2026-02-05 10:21:52 -08:00
Marcell Leleszi
d31dbb9555
[libc][wctype] Move classification lookup tables to a cpp file ( #174993 )
...
#170525
Previously, lookup tables were defined in a header so that they can be
constexpr, but this lead to each translation unit having it's own copy,
bloating the library size. Looking at current usages of wctype
functions, they are always used at runtime, so there's no benefit of
having them constexpr, so I'm moving them to a cpp file, so that there's
only a single copy in the library.
2026-02-05 17:58:50 +01:00
Muhammad Bassiouni
e92fdcda76
[libc][math] Fix build failures from last refactor. ( #179966 )
2026-02-05 18:02:41 +02:00
Zorojuro
10910771e8
[libc][math] Refactor f16fmaf128 to Header Only ( #177850 )
...
Closes #175318
In preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2026-02-05 17:44:53 +02:00
Muhammad Bassiouni
823e3e0017
[libc][math] Resolve size issues on baremetal and cleanup code. ( #179707 )
2026-02-05 15:08:33 +02:00
Prabhu Rajasekaran
4cae644dbe
[libc] Disable strong stack protector for baremetal ( #179559 )
...
Strong stack protector introduces references to __stack_chk_guard
symbols with GOT relocation in ARM 32 bit targets which is not supported
in typical baremetal environments. Turning this off for baremetal.
2026-02-03 14:33:16 -08:00
Prabhu Rajasekaran
22c8344d98
[libc] Address size bloat issues ( #179398 )
...
This refactoring addresses bloat by removing static function specifiers.
2026-02-03 13:09:53 -08:00
Joseph Huber
e07a1182fd
[libc] Tweak the runtimes cross-build for GPU ( #178548 )
...
Summary:
We should likely use `-DLLVM_DEFAULT_TARGET_TRIPLE` as the general
source of truth, make the handling work with that since we use it for
the output directories. Fix the creation of startup files in this mode
and make sure it can detect the GPU properly.
Fixes: https://github.com/llvm/llvm-project/issues/179375
2026-02-03 10:35:17 -06:00
Schrodinger ZHU Yifan
55174f936b
[libc][SVE] add sve handling for memcpy with count less than 32b ( #167446 )
...
Add SVE optimization for AArch64 architectures. The idea is to use
predicate registers to avoid branching.
Microbench in repo shows considerable improvements on NV GB10 (locked on
largest X925):
```
======================================================================
BENCHMARK STATISTICS (time in nanoseconds)
======================================================================
memcpy_Google_A:
Old - Mean: 3.1257 ns, Median: 3.1162 ns
New - Mean: 2.8402 ns, Median: 2.8265 ns
Improvement: +9.14% (mean), +9.30% (median)
memcpy_Google_B:
Old - Mean: 2.3171 ns, Median: 2.3159 ns
New - Mean: 1.6589 ns, Median: 1.6593 ns
Improvement: +28.40% (mean), +28.35% (median)
memcpy_Google_D:
Old - Mean: 8.7602 ns, Median: 8.7645 ns
New - Mean: 8.4307 ns, Median: 8.4308 ns
Improvement: +3.76% (mean), +3.81% (median)
memcpy_Google_L:
Old - Mean: 1.7137 ns, Median: 1.7091 ns
New - Mean: 1.4530 ns, Median: 1.4553 ns
Improvement: +15.22% (mean), +14.85% (median)
memcpy_Google_M:
Old - Mean: 1.9823 ns, Median: 1.9825 ns
New - Mean: 1.4826 ns, Median: 1.4840 ns
Improvement: +25.20% (mean), +25.15% (median)
memcpy_Google_Q:
Old - Mean: 1.6812 ns, Median: 1.6784 ns
New - Mean: 1.1538 ns, Median: 1.1517 ns
Improvement: +31.37% (mean), +31.38% (median)
memcpy_Google_S:
Old - Mean: 2.1816 ns, Median: 2.1786 ns
New - Mean: 1.6297 ns, Median: 1.6287 ns
Improvement: +25.29% (mean), +25.24% (median)
memcpy_Google_U:
Old - Mean: 2.2851 ns, Median: 2.2825 ns
New - Mean: 1.7219 ns, Median: 1.7187 ns
Improvement: +24.65% (mean), +24.70% (median)
memcpy_Google_W:
Old - Mean: 2.0408 ns, Median: 2.0361 ns
New - Mean: 1.5260 ns, Median: 1.5252 ns
Improvement: +25.23% (mean), +25.09% (median)
uniform_384_to_4096:
Old - Mean: 26.9067 ns, Median: 26.8845 ns
New - Mean: 26.8083 ns, Median: 26.8149 ns
Improvement: +0.37% (mean), +0.26% (median)
```
The beginning of the memcpy function looks like the following:
```
Dump of assembler code for function _ZN22__llvm_libc_22_0_0_git6memcpyEPvPKvm:
0x0000000000001340 <+0>: cbz x2, 0x143c <_ZN22__llvm_libc_22_0_0_git6memcpyEPvPKvm+252>
0x0000000000001344 <+4>: cbz x0, 0x1440 <_ZN22__llvm_libc_22_0_0_git6memcpyEPvPKvm+256>
0x0000000000001348 <+8>: cbz x1, 0x1444 <_ZN22__llvm_libc_22_0_0_git6memcpyEPvPKvm+260>
0x000000000000134c <+12>: subs x8, x2, #0x20
0x0000000000001350 <+16>: b.hi 0x1374 <_ZN22__llvm_libc_22_0_0_git6memcpyEPvPKvm+52> // b.pmore
0x0000000000001354 <+20>: rdvl x8, #1
0x0000000000001358 <+24>: whilelo p0.b, xzr, x2
0x000000000000135c <+28>: ld1b {z0.b}, p0/z, [x1]
0x0000000000001360 <+32>: whilelo p1.b, x8, x2
0x0000000000001364 <+36>: ld1b {z1.b}, p1/z, [x1, #1 , mul vl]
0x0000000000001368 <+40>: st1b {z0.b}, p0, [x0]
0x000000000000136c <+44>: st1b {z1.b}, p1, [x0, #1 , mul vl]
0x0000000000001370 <+48>: ret
```
---------
Co-authored-by: Guillaume Chatelet <chatelet.guillaume@gmail.com>
2026-02-03 10:26:44 -05:00
Prabhu Rajasekaran
adaa3e74e8
[libc] Address sincosf size bloat ( #179004 )
...
The recent refactoring in #177523 marked some functions as static which
increased the size of sinf/cosf functions. Removing the static storage
for these functions to remove the bloat which is especially problematic
in size constrained baremetal target builds.
2026-02-01 10:37:29 -08:00
Jeff Bailey
487de1ad7b
[libc][test] Fix TmMatcher and correct tm_yday/tm_wday test values ( #179029 )
...
The TmMatcher was using || instead of && to compare tm struct fields,
causing it to match if ANY field was equal rather than ALL fields. This
masked incorrect expected values in the time tests.
Happily, only the tests needed fixing. The code was correct.
Fixed the matcher and corrected all tm_yday and tm_wday values to match
glibc's gmtime_r output.
2026-02-01 07:32:55 +00:00
Saina Daneshmand
737f4447ad
[libc][math] Refactor sqrtf to header-only ( #178778 )
...
Refactors sqrtf to be header-only.
Closes #177649 .
2026-01-30 05:31:04 +00:00
Ash
a17bc05818
[libc][math] Refactor sincosf implementation to header only ( #177523 )
...
Part of #147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
Closes #177640
2026-01-30 03:05:51 +00:00
Zhihui Yang
947df33d3d
[libc][math] Refactor f16sqrt to Header Only ( #177167 )
...
Fixes #175330
Part of https://github.com/llvm/llvm-project/issues/147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2026-01-30 04:27:03 +02:00
Prabhu Rajasekaran
66424a02de
[libc] provide str to float build configs ( #178780 )
...
The str to float code path offers options which can reduce code bloat.
Expose them as build config options. Disable Eisel Lemire for avoiding
code bloat caused by DETAILED_POWERS_OF_TEN look up table.
2026-01-30 00:32:38 +00:00
Roland McGrath
73dc25c1b6
[libc] Add pthread_getattr_np declaration ( #178549 )
...
Add header declaration and implementation header for the GNU
extension function pthread_getattr_np. An actual implementation
can come later.
2026-01-29 10:33:19 -08:00
Saina Daneshmand
3404537393
[libc][math] Refactor sqrt to header-only ( #178335 )
...
This refactors `sqrt` to be header-only, following the libc math
refactoring plan.
Part of #147386
Closes #177648
2026-01-29 03:10:33 +00:00
Roland McGrath
dbce14f0d6
[libc] Clean up pthread.yaml ( #178327 )
...
Remove pthread.h.def and use pure generation. Fix YAML records
for standards to correct syntax and remove redundancies.
Don't declare NULL, which is not specified for <pthread.h>.
Do declare PTHREAD_NULL.
2026-01-28 12:30:54 -08:00
Muhammad Bassiouni
b3f3aa81e0
[libc][math] Fix AMD build errors. ( #178507 )
2026-01-28 22:29:23 +02:00
Atharv Mane
18925d131b
[libc] [math] Refactor fsqrtl to be header-only ( #176169 )
...
This PR refactors fsqrtl to be header only as discussed. No functional
change intended. Test and build files were updated as required by the
refactor
Fixes #175335
2026-01-28 20:12:45 +00:00
cpist (He / Him)
a8913a2229
[libc][math] Refactor logf16 to header-only shared math ( #175408 )
...
## Summary
Following the discussion in the RFC [1], Refactors logf16 to a
header-only shared math.
[1]
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
## Implementation
- Moved the core logic and lookup tables from `generic/logf16.cpp` to
`__support/math/logf16.h`
- Updated `generic/logf16.cpp` to include the new header and call
`internal::logf16`
- Updated `CMakeLists.txt` and `BUILD.bazel` to reflect the dependency
changes and new header library
Fix : https://github.com/llvm/llvm-project/issues/175367
2026-01-28 19:40:14 +00:00
Sersawy
024b8ac74e
[libc][math] Refactor llogbf128 to header-only ( #175617 )
2026-01-28 19:36:29 +00:00
Joseph Huber
a512065206
[libc] Do not use stack protectors or frame pointers on GPU
...
Summary:
This doesn't work because they're unused in some contexts. Added in
https://github.com/llvm/llvm-project/pull/178136
2026-01-28 08:24:48 -06:00
Dasha Buka
69e855bb1b
[libc][math] Refactor ilogb implementation to header-only in src/__support/math folder. ( #175504 )
...
closes #175348
2026-01-28 07:45:47 +02:00
DannyDaoBoYang
f92948fa9b
[libc][math] Refactor sinpif to Header Only. ( #176580 )
...
closes [#176477 ](https://github.com/llvm/llvm-project/issues/176477 )
Part of https://github.com/llvm/llvm-project/issues/147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2026-01-28 07:42:22 +02:00
Sersawy
04402d32a5
[libc][math] Refactor llogbf16 to header-only ( #178078 )
...
Closes #175351
2026-01-28 07:09:14 +02:00
Prajwal KP
4c11b005f2
[libc][math] Refactor sqrtf16 to Header Only ( #177726 )
...
closes : #177651
2026-01-28 06:43:52 +02:00
Jakob Koschel
a451344aba
[libc] fix LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR ( #178136 )
...
In order to apply the stack protector correctly to the compile options,
we need to make sure to use the same config name everywhere.
`LIBC_CONF_ENABLE_STACK_PROTECTOR` seems to be outdated and all other
places specify `LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR` and it should
therefore be updated here as well.
2026-01-27 09:38:13 -08:00
Nico Weber
90829e51cf
[libc][math] Refactor sinf16 implementation to header-only in src/__support/math folder. ( #178062 )
...
Part of #147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2026-01-27 08:17:33 -05:00