2821 Commits

Author SHA1 Message Date
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
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
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
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
22c8344d98
[libc] Address size bloat issues (#179398)
This refactoring addresses bloat by removing static function specifiers.
2026-02-03 13:09:53 -08: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
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
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
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
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
Vedant Neve
865b2e9e00
[libc][math] Refactor llogb to Header Only (#175524)
Fixes #175360
2026-01-27 05:56:49 +02:00
Muhammad Bassiouni
e2ee42f908
[libc][math] Fix parallel implementation for asin (#178100) 2026-01-27 01:59:44 +00:00
Anikesh Parashar
667703ed1b
[libc][math] Refractor sinhf16 to Header only (#177337)
Part of #147386

Resolves #177645
2026-01-27 02:32:41 +02:00
Ramshankar
54c5dcbf7d
[libc][math] Refactor ilogbf128 to Header Only (#175396)
Refactors the ilogbf128 implementation to be header-only and available via shared math.

fixes: #175345
2026-01-27 02:17:06 +02:00
Anikesh Parashar
2e99240dce
[libc][math] Refractor sinhf to Header only (#177336)
Part of #147386

Resolves #177644
2026-01-27 02:15:00 +02:00
Nico Weber
144a7fc08f
[libm] Update include guards in libc/src/__support/math (#178055)
...due to the feedback on #177963.

Patch generated by running

    rg -l '\bLIBC_SRC' libc/src/__support/math | \
      xargs sed -i '' -e \

's/LIBC_SRC___SUPPORT_MATH_\([A-Z0-9_]*\)/LLVM_LIBC_SRC___SUPPORT_MATH_\1/'
2026-01-27 01:27:28 +02:00
Nico Weber
5caf27eff3
[libc][math] Refactor sinf implementation to header-only in src/__support/math folder. (#177963)
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-26 16:41:46 -05:00
Anikesh Parashar
693a018dcf
[libc][math] Refractor logf to Header only (#176834)
Resolves #175368
2026-01-26 21:59:14 +02:00
Cheng Lingfei
bd3ecdc59b
[libc][math] Refactor f16sqrtl to Header Only. (#176333)
builds correctly with both `clang`, `gcc`, `cmake`, and `Bazel`.

Closes https://github.com/llvm/llvm-project/issues/175331.
2026-01-26 20:06:40 +02:00
Nico Weber
f255bec95c
[libc][math] Refactor tanf implementation to header-only in src/__support/math folder. (#177730)
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-25 01:54:34 +02:00
Nico Weber
5234bac082
[libc][math] Refactor tan implementation to header-only in src/__support/math folder. (#177224)
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-23 23:56:05 +02:00
google-yfyang
8206c81433
[libc] Use generic/builtin.h for Emscripten in memory utils (#177474)
WASM supports bulk memory operations and can benefit from using
generic/builtin.h.
2026-01-23 13:48:32 -06:00
Prajwal
4435083c26
[libc][math] Refactor f16fmal to header-only (#176576)
closes #175324 
part of #175313
2026-01-23 21:30:28 +02:00