125 Commits

Author SHA1 Message Date
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
Zorojuro
ee816947ac
[libc][math] Refactor f16fmaf to Header Only. (#178851)
closes #175319
2026-02-05 21:56:27 +02: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
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
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
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
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
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
Prajwal
4435083c26
[libc][math] Refactor f16fmal to header-only (#176576)
closes #175324 
part of #175313
2026-01-23 21:30:28 +02:00
Madhur Kumar
ff97d1a5e3
[libc][math] Refactor dfmaf128 to Header Only (#176480)
Closes https://github.com/llvm/llvm-project/issues/175315, Part of
https://github.com/llvm/llvm-project/issues/175344
2026-01-23 21:02:46 +02:00
Nico Weber
86a2486bff
[libc][math] Refactor log10, log1p, log2 implementation to header-only in src/__support/math folder. (#176089)
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-21 17:44:33 +00:00
Anonymous
82204a482b
[libc][math] Refactor ilogbf implementation to header-only in src/__support/math folder. (#175522)
closes #175347 , part of #175344
2026-01-19 17:57:36 +02:00
Islam Imad
5104e7783e
[libc][math] Refactor f16fma to header only (#176244)
closes #175320

Part of #175313
2026-01-19 11:01:03 +02:00
Anonmiraj
022888ec1c
[libc][math] Refactor fsqrtf128 to Header Only. (#175686)
builds correctly with both Clang and GCC 12.2.

Closes #175333.
2026-01-17 02:19:53 +02:00
Anonmiraj
6397207d61
[libc][math] Refactor ilogbl to Header Only. (#176500)
builds with both Clang and GCC 12.2.

Closes https://github.com/llvm/llvm-project/issues/175349.
2026-01-17 02:17:30 +02:00
Anonmiraj
997fdefa4c
[libc][math] Refactor llogbf to Header Only. (#176494)
builds with both Clang and GCC 12.2.

Closes https://github.com/llvm/llvm-project/issues/175354.
2026-01-17 02:06:46 +02:00
Anonmiraj
08bcd7cb00
[libc][math] Refactor hypotf to Header Only. (#175679)
builds correctly with both Clang and GCC 12.2.

Closes #175338.
2026-01-17 01:34:38 +02:00
Anonmiraj
716b54784f
[libc][math] Refactor logbf to Header Only. (#176222)
builds with both Clang and GCC 12.2.

Closes https://github.com/llvm/llvm-project/issues/175364.
2026-01-17 00:15:04 +02:00
Anonmiraj
dac308c7d3
[libc][math] Refactor logbf16 to Header Only. (#176231)
builds with both Clang and GCC 12.2.

Closes https://github.com/llvm/llvm-project/issues/175363.
2026-01-16 23:56:36 +02:00
Anonmiraj
6c496a1e5f
[libc][math] Refactor logbf128 to Header Only. (#176234)
builds with both Clang and GCC 12.2.

Closes #175362.
2026-01-16 23:33:24 +02:00
Jolynn Wee Zhuo Lin
f8278a152f
[libc][math] Refactor fsqrt to Header Only (#175444)
Fixes https://github.com/llvm/llvm-project/issues/175334
2026-01-16 08:16:04 +02:00
Anonmiraj
ac9f0ce724
[libc][math] Refactor dfmal to Header Only. (#175359)
builds correctly with both Clang and GCC 12.2.

Since `fma` is not `constexpr`, `dfmal` cannot be declared `constexpr`
either.
Closes #175316.
2026-01-16 06:25:39 +02:00
mitchell
79be97d90a
[libc][math] Refactor ilogbf16 implementation to header-only in src/__support/math folder. (#175450)
Closes [#175346](https://github.com/llvm/llvm-project/issues/175346),
Part of #175344
2026-01-12 05:05:35 +02:00
Muhammad Bassiouni
81d5b36f34
[libc][math] Fix GPU build fails (#175474) 2026-01-12 01:46:57 +00:00
CarvedCoder
bc51c9d5f2
[libc][math] Refactor log to header-only shared math (#175395)
Refactors log to a header-only shared math implementation.

Fixes #175369
2026-01-12 01:22:01 +02:00
lntue
43b8bc4b6f
[libc][math] Refactor sin implementation to header-only in src/__support/math folder. (#175200)
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-09 23:45:24 -05:00
Muhammad Bassiouni
1600b05fda
[libc][math] Refactor expm1f16 implementation to header-only in src/__support/math folder. (#162132)
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-10 04:15:56 +02:00
lntue
e2956fefd9
[libc][math] Add LIBC_CONF_MATH_USE_SYSTEM_FENV / LIBC_MATH_USE_SYSTEM_FENV (#172902)
This is to allow math function implementations to use system libc's
fenv.h instead of internal fenv implementations.
2025-12-22 13:19:56 -05:00
Muhammad Bassiouni
60e7c4709c
[libc][math] Refactor expm1f implementation to header-only in src/__support/math folder. (#162131)
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
2025-12-19 21:56:38 +02:00
Mehdi Amini
efd9dc83f2
Revert "[APFloat] Add exp function for APFloat::IEEESsingle using expf implementation from LLVM libc. (#143959)" (#172325)
This reverts commit 4190d576823c18f45ee0632baee7d798448178ac.

See https://lab.llvm.org/buildbot/#/builders/181/builds/33524

```
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/lib/Support/APFloat.cpp:32:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/math/asin_utils.h:548:1:   in ‘constexpr’ expansion of ‘__llvm_libc::fputil::DyadicFloat<128>(__llvm_libc::Sign::POS, -127, __llvm_libc::BigInt<128, false, long unsigned int>(__llvm_libc::operator""_u128(((const char*)"0x80000000\'00000000\'00000000\'00000000"))))’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/FPUtil/dyadic_float.h:109:5:   in ‘constexpr’ expansion of ‘((__llvm_libc::fputil::DyadicFloat<128>*)this)->__llvm_libc::fputil::DyadicFloat<128>::normalize()’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/FPUtil/dyadic_float.h:118:16:   in ‘constexpr’ expansion of ‘((__llvm_libc::fputil::DyadicFloat<128>*)this)->__llvm_libc::fputil::DyadicFloat<128>::mantissa.__llvm_libc::BigInt<128, false, long unsigned int>::operator<<=(((size_t)shift_length))’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/big_int.h:829:52:   in ‘constexpr’ expansion of ‘__llvm_libc::multiword::shift<__llvm_libc::multiword::LEFT, false, long unsigned int, 2>(((__llvm_libc::BigInt<128, false, long unsigned int>*)this)->__llvm_libc::BigInt<128, false, long unsigned int>::val, s)’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/big_int.h:264:35: error: ‘constexpr __llvm_libc::cpp::enable_if_t<((((sizeof (To) == sizeof (From)) && __llvm_libc::cpp::is_trivially_constructible<To>::value) && __llvm_libc::cpp::is_trivially_copyable<T>::value) && __llvm_libc::cpp::is_trivially_copyable<From>::value), To> __llvm_libc::cpp::bit_cast(const From&) [with To = __int128 unsigned; From = __llvm_libc::cpp::array<long unsigned int, 2>; __llvm_libc::cpp::enable_if_t<((((sizeof (To) == sizeof (From)) && __llvm_libc::cpp::is_trivially_constructible<To>::value) && __llvm_libc::cpp::is_trivially_copyable<T>::value) && __llvm_libc::cpp::is_trivially_copyable<From>::value), To> = __int128 unsigned]’ called in a constant expression
  264 |     auto tmp = cpp::bit_cast<type>(array);
      |                ~~~~~~~~~~~~~~~~~~~^~~~~~~
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/lib/Support/APFloat.cpp:32:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/CPP/bit.h:48:1: note: ‘constexpr __llvm_libc::cpp::enable_if_t<((((sizeof (To) == sizeof (From)) && __llvm_libc::cpp::is_trivially_constructible<To>::value) && __llvm_libc::cpp::is_trivially_copyable<T>::value) && __llvm_libc::cpp::is_trivially_copyable<From>::value), To> __llvm_libc::cpp::bit_cast(const From&) [with To = __int128 unsigned; From = __llvm_libc::cpp::array<long unsigned int, 2>; __llvm_libc::cpp::enable_if_t<((((sizeof (To) == sizeof (From)) && __llvm_libc::cpp::is_trivially_constructible<To>::value) && __llvm_libc::cpp::is_trivially_copyable<T>::value) && __llvm_libc::cpp::is_trivially_copyable<From>::value), To> = __int128 unsigned]’ is not usable as a ‘constexpr’ function because:
   48 | bit_cast(const From &from) {
      | ^~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../libc/src/__support/CPP/bit.h:56:28: error: call to non-‘constexpr’ function ‘void __llvm_libc::cpp::inline_copy(const char*, char*) [with unsigned int N = 16]’
   56 |   inline_copy<sizeof(From)>(src, dst);
```
2025-12-15 16:57:37 +01:00
lntue
4190d57682
[APFloat] Add exp function for APFloat::IEEESsingle using expf implementation from LLVM libc. (#143959)
Discourse RFC:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450

- The implementation in LLVM libc is header-only.
- expf implementation in LLVM libc is correctly rounded for all rounding
modes.
- LLVM libc implementation will round to the floating point
environment's rounding mode.
- No cmake build dependency between LLVM and LLVM libc, only requires
LLVM libc source presents in llvm-project/libc folder.
2025-12-15 10:21:45 -05:00
Muhammad Bassiouni
e8defb503d
[libc][math] Refactor expm1 implementation to header-only in src/__support/math folder. (#162127)
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
2025-12-04 16:51:43 +02:00