202 Commits
Author SHA1 Message Date
Krishna Pandey a01500b62d [libc][math][c++23] Add expbf16 math function (#161919)
This PR adds expbf16 higher math function for BFloat16 type along with
the tests.

---------

Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
2026-06-27 16:55:55 +05:30
Zorojuro f36745eb0a [libc][math][c23] Add tanbf16 math function (#185100)
Adds tanbf16 higher math function for bfloat16 type
2026-06-25 14:25:35 +00:00
Krishna Pandey 23a60f15f2 [libc][math][c23] Implement higher math function cbrtf16 in LLVM libc (#132484)
This PR implements `cbrtf16` for half precision float (`float16`).

Closes #132199.

---------

Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
2026-06-15 22:10:19 +00:00
Vedant Neve 59eb0d2c61 [libc][math] Add isnanf128 (#199206)
## Summary

- Add a fputil-based isnanf128 implementation and wire it into libc math
entrypoints, public math header generation, and shared math wrappers.

- Add smoke test coverage for float128 NaN classification and shared
math runtime/constexpr coverage.

Part of #195400

---------

Signed-off-by: Vedant Neve <vedantneve13@gmail.com>
2026-06-10 17:43:56 -04:00
Zorojuro c8208a483e [libc][math][c23] Add acosbf16 math function (#184633)
This PR intends to add acosbf16 higher math function for bfloat16 type .
2026-06-08 10:25:16 -04:00
Aayush ShrivastavaandVictor Campos 852a20e6d1 [libc][math] Implement isnanf16 header-only function (#198115)
Adds `isnanf16` the float16 variant of isnan as part of issue
[#195400](https://github.com/llvm/llvm-project/issues/195400), which
tracks adding missing isnan variants for extended floating-point types.

The implementation follows the same pattern as the existing `isnanf`,
`isnan`, and `isnanl` functions.

---------

Co-authored-by: Victor Campos <github@victorcampos.me>
2026-05-24 11:28:50 -04:00
lntue 85c3fd048d [libc] Fix shared math tests for gcc-13. (#199318) 2026-05-23 09:37:48 +00:00
lntue 0edfd11b36 [libc] Temporarily disable iscanonical, isnan, issignaling in shared/math.h (#197328)
These clashes with same-name macros defined in <math.h>.
2026-05-12 19:52:24 -04:00
Anonmiraj 1561e51af7 [libc][math] Refactor isnan family to header-only (#195598)
Refactors the isnan math family to be header-only.

part of: #147386

Target Functions:
  - isnan
  - isnanf
  - isnanl
  
Also adds `__LIBC_USE_BUILTIN_ISNAN` compiler feature detection
2026-05-04 10:36:38 +03:00
Anonmiraj 52340a4fa0 [libc][math] Refactor round-roundeven-trunc family to header-only (#195590)
Refactors the round-roundeven-trunc math family to be header-only.

part of: #147386

Target Functions:
  - round
  - roundbf16
  - roundf
  - roundf128
  - roundf16
  - roundl
  - roundeven
  - roundevenbf16
  - roundevenf
  - roundevenf128
  - roundevenf16
  - roundevenl
  - trunc
  - truncbf16
  - truncf
  - truncf128
  - truncf16
  - truncl
2026-05-04 10:19:35 +03:00
Anonmirajandbassiounix 8889e8f85d [libc][math] Refactor iscanonical-issignaling-nan family to header-only (#195581)
Refactors the iscanonical-issignaling-nan math family to be
header-only.

part of: #147386

Target Functions:
  - iscanonical
  - iscanonicalbf16
  - iscanonicalf
  - iscanonicalf128
  - iscanonicalf16
  - iscanonicall
  - issignaling
  - issignalingbf16
  - issignalingf
  - issignalingf128
  - issignalingf16
  - issignalingl
  - nan
  - nanbf16
  - nanf
  - nanf128
  - nanf16
  - nanl

---------

Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-05-04 09:31:11 +03:00
5f9b0ad685 [libc][math] Refactor rint-nearbyint family to header-only (#195577)
Refactors the rint-nearbyint math family to be header-only.

part of: #147386

Target Functions:
  - nearbyint
  - nearbyintbf16
  - nearbyintf
  - nearbyintf128
  - nearbyintf16
  - nearbyintl
  - rint
  - rintbf16
  - rintf
  - rintf128
  - rintf16
  - rintl

---------

Co-authored-by: Muhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>
Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-05-04 06:32:34 +03:00
Anonmiraj 82f9618d44 [libc][math] Refactor lrint_lround family to header-only (#195441)
Refactors the lrint_lround math family to be header-only.

part of: #147386

Target Functions:
  - llrint
  - llrintbf16
  - llrintf
  - llrintf128
  - llrintf16
  - llrintl
  - llround
  - llroundbf16
  - llroundf
  - llroundf128
  - llroundf16
  - llroundl
  - lrint
  - lrintbf16
  - lrintf
  - lrintf128
  - lrintf16
  - lrintl
  - lround
  - lroundbf16
  - lroundf
  - lroundf128
  - lroundf16
  - lroundl
2026-05-02 15:25:49 +03:00
AnonmirajandMuhammad Bassiouni a7f6a6f6ee [libc][math] Refactor fmul-fsub-frexp family to header-only (#195431)
Refactors the fmul-fsub-frexp math family to be header-only.

part of: #147386

Target Functions:
  - fmul
  - fmulf128
  - fmull
  - fsub
  - fsubf128
  - fsubl
  - frexp
  - frexpbf16
  - frexpl

Co-authored-by: Muhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>
2026-05-02 12:52:04 +03:00
Anonmiraj 0d27dda7a9 [libc][math] Refactor scalbln-scalbn-ldexp family to header-only (#195423)
Refactors the scalbln-scalbn-ldexp math family to be header-only.

part of: #147386

Target Functions:
  - ldexp
  - ldexpbf16
  - ldexpl
  - scalbln
  - scalblnbf16
  - scalblnf
  - scalblnf128
  - scalblnf16
  - scalblnl
  - scalbn
  - scalbnbf16
  - scalbnf
  - scalbnf128
  - scalbnf16
  - scalbnl
2026-05-02 11:08:30 +03:00
Anonmiraj 39d1203418 [libc][math] Refactor remainder-remquo family to header-only (#195421)
Refactors the remainder-remquo math family to be header-only.

part of: #147386

Target Functions:
  - remainder
  - remainderbf16
  - remainderf
  - remainderf128
  - remainderf16
  - remainderl
  - remquo
  - remquobf16
  - remquof
  - remquof128
  - remquof16
  - remquol
2026-05-02 10:14:35 +03:00
Anonmiraj edfb913ae8 [libc][math] Refactor fmaximum-mag-num-fminimum-mag-num family to header-only (#195415)
Refactors the fmaximum-mag-num-fminimum-mag-num math family to be
header-only.

part of: #147386

Target Functions:
  - fmaximum_mag_numf128
  - fmaximum_mag_numf16
  - fmaximum_mag_numl
  - fminimum_mag_num
  - fminimum_mag_numbf16
  - fminimum_mag_numf
  - fminimum_mag_numf128
  - fminimum_mag_numf16
  - fminimum_mag_numl
2026-05-02 08:41:00 +03:00
Anonmiraj a5c9be0a19 [libc][math] Refactor fromfp family to header-only (#195413)
Refactors the fromfp math family to be header-only.

part of: #147386

Target Functions:
  - fromfp
  - fromfpbf16
  - fromfpf
  - fromfpf128
  - fromfpf16
  - fromfpl
  - fromfpx
  - fromfpxbf16
  - fromfpxf
  - fromfpxf128
  - fromfpxf16
  - fromfpxl
2026-05-02 08:30:01 +03:00
Anonmiraj 61a401e3fd [libc][math] Refactor fmod-modf family to header-only (#195406)
Refactors the fmod-modf math family to be header-only.

part of: #147386

Target Functions:
  - fmod
  - fmodbf16
  - fmodf
  - fmodf128
  - fmodf16
  - fmodl
  - modf
  - modfbf16
  - modff
  - modff128
  - modff16
  - modfl
2026-05-02 08:03:26 +03:00
Anonmirajandbassiounix 7d853a2226 [libc][math] Refactor totalorder, totalordermag family to header-only (#195399)
Refactors the totalorder, totalordermag math family to be header-only.

part of: #147386

Target Functions:
  - totalorder
  - totalorderbf16
  - totalorderf
  - totalorderf128
  - totalorderf16
  - totalorderl
  - totalordermag
  - totalordermagbf16
  - totalordermagf
  - totalordermagf128
  - totalordermagf16
  - totalordermagl

---------

Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-05-02 07:01:34 +03:00
AnonmirajandMuhammad Bassiouni 562ba8048c [libc][math] Refactor ufromfp family to header-only (#195395)
Refactors the ufromfp math family to be header-only.

part of: #147386

Target Functions:
  - ufromfp
  - ufromfpbf16
  - ufromfpf
  - ufromfpf128
  - ufromfpf16
  - ufromfpl
  - ufromfpx
  - ufromfpxbf16
  - ufromfpxf
  - ufromfpxf128
  - ufromfpxf16
  - ufromfpxl

Co-authored-by: Muhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>
2026-05-02 06:22:17 +03:00
Anonmiraj 2bc30bdec8 [libc][math] Refactor fmaximum-mag-fminimum-mag family to header-only (#195394)
Refactors the fmaximum-mag-fminimum-mag math family to be header-only.

part of: #147386

Target Functions:
  - fmaximum_mag
  - fmaximum_magbf16
  - fmaximum_magf
  - fmaximum_magf128
  - fmaximum_magf16
  - fmaximum_magl
  - fminimum_mag
  - fminimum_magbf16
  - fminimum_magf
  - fminimum_magf128
  - fminimum_magf16
  - fminimum_magl
2026-05-02 05:50:20 +03:00
Anonmiraj 20ae894770 [libc][math] Refactor fmaximum_num-fminimum_num family to header-only (#194562)
Refactors the fmaximum_num-fminimum_num math family to be header-only.

part of: #147386

Target Functions:
  - fmaximum_num
  - fmaximum_numbf16
  - fmaximum_numf
  - fmaximum_numf128
  - fmaximum_numf16
  - fmaximum_numl
  - fminimum_num
  - fminimum_numbf16
  - fminimum_numf
  - fminimum_numf128
  - fminimum_numf16
  - fminimum_numl
2026-04-28 11:11:09 +03:00
Anonmiraj c857cb2669 [libc][math] Refactor dsqrtf128 to header-only (#194552)
part of: #147386
2026-04-28 10:03:24 +03:00
Anonmiraj 8146275908 [libc][math] Refactor fmin family to header-only (#194549)
Refactors the fmin math family to be header-only.

part of: #147386

Target Functions:
  - fmin
  - fminbf16
  - fminf
  - fminf128
  - fminf16
  - fminl
2026-04-28 09:28:45 +03:00
Anonmiraj 7b49e58d69 [libc][math] Refactor fmaximum-fminimum family to header-only (#194533)
Refactors the fmaximum-fminimum math family to be header-only.

part of: #147386

Target Functions:
  - fmaximum
  - fmaximumbf16
  - fmaximumf
  - fmaximumf128
  - fmaximumf16
  - fmaximuml
  - fminimum
  - fminimumbf16
  - fminimumf
  - fminimumf128
  - fminimumf16
  - fminimuml
2026-04-28 08:49:15 +03:00
Anonmirajandbassiounix 6a0a18b1bb [libc][math] Refactor sqrtl family to header-only (#194510)
part of: #147386

---------

Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-04-28 06:58:31 +03:00
Anonmiraj 3c66b3222e [libc][math] Refactor llogbbf16 to header-only (#194509)
Refactor llogbbf16 to be header-only.

part of: #147386
2026-04-28 04:36:17 +03:00
Anonmiraj fe46959a92 [libc][math] Refactor ilogbbf16 to header-only (#194503)
Refactors ilogbbf16 to be header-only.
2026-04-28 04:13:16 +03:00
Anonmiraj 5281d4c18e [libc][math] Refactor bf16subl to header-only (#194498)
Refactors the bf16subl math family to be header-only.
2026-04-28 03:39:12 +03:00
hulxvandMuhammad Bassiouni 4c7dc9c178 Reland "[libc][math] Refactor fmaximum_mag_num family to header-only" (#194194)
Reland #182169

---------

Co-authored-by: Muhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>
2026-04-26 02:48:16 +03:00
Muhammad Bassiouni fc99b67759 Revert "[libc][math] Refactor fmaximum_mag_num family to header-only" (#194183)
Reverts llvm/llvm-project#182169
2026-04-26 01:14:13 +03:00
hulxvandMuhammad Bassiouni 23cc957f50 [libc][math] Refactor fmaximum_mag_num family to header-only (#182169)
Refactors the fmaximum_mag_num math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182168

Target Functions:
  - fmaximum_mag_num
  - fmaximum_mag_numbf16
  - fmaximum_mag_numf

---------

Co-authored-by: Muhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>
2026-04-25 22:08:38 +00:00
hulxvandMuhammad Bassiouni bbd4d67f0b [libc][math] Refactor fdiv family to header-only (#182192)
Refactors the fdiv math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182191

Target Functions:
  - fdiv
  - fdivf128
  - fdivl

---------

Co-authored-by: Muhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>
2026-04-26 00:57:03 +03:00
hulxvandbassiounix 55af9c2615 [libc][math] Refactor dsub family to header-only (#182160)
Refactors the dsub math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182159

Target Functions:
  - dsubf128
  - dsubl

---------

Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-04-25 10:09:30 +03:00
hulxv 125f69d71a [libc][math] Refactor fabs family to header-only (#182173)
Refactors the fabs math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182172

Target Functions:
  - fabs
  - fabsbf16
  - fabsf
  - fabsf128
  - fabsf16
  - fabsl
2026-04-24 22:47:39 +03:00
hulxv a1a4da0416 [libc][math] Refactor ddiv family to header-only (#182149)
Refactors the ddiv math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182148

Target Functions:
  - ddivf128
  - ddivl
2026-04-24 20:49:28 +03:00
hulxv b093148328 [libc][math] Refactor dmul family to header-only (#182151)
Refactors the dmul math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182150

Target Functions:
  - dmulf128
  - dmull
2026-04-24 17:49:19 +03:00
Zorojuroandbassiounix b7f54fd7ec [libc][math] Refactor logbbf16 to header-only (#189194)
Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-04-18 21:41:15 +02:00
hulxvandbassiounix 23361e18ac [libc][math] Refactor copysign family to header-only (#182137)
Refactors the copysign math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182136

Target Functions:
  - copysign
  - copysignbf16
  - copysignf
  - copysignf128
  - copysignf16
  - copysignl

---------

Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-04-13 18:03:52 +02:00
Zorojuro bdc11929aa [libc][math] Fix: add log10p1f16 to shared math (#189185)
This PR intends to add the log10p1f16 function to shared math, along
with adding tests for it and Bazel which was missed in
[a7d1a87](https://github.com/llvm/llvm-project/commit/a7d1a87b30ce626678d33fe1c12e647f7ce4fb20).
2026-04-13 11:00:03 +02:00
Zorojuro ec944346dd [libc][math] Fix: add log2p1f16 to shared math (#189179)
This PR intends to add the log2p1f16 function to shared math, along with
adding tests for it and bazel which was missed in
[f0ce26d](https://github.com/llvm/llvm-project/commit/f0ce26d06d822fd6985d227dc1be9d218977e334).
2026-04-13 10:57:16 +02:00
Zorojuroandbassiounix f1c2e3cc68 [libc][math] Refactor cbrtbf16 function header-only (#188204)
Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-04-09 00:40:22 +02:00
lntue d52daeac79 [libc] Fix the remaining long double issue in shared_math_test.cpp. (#190098) 2026-04-01 22:47:29 -04:00
Zorojuroandbassiounix 15a7c45163 [libc][math][c23] Add asinbf16 math function (#184170)
Co-authored-by: bassiounix <muhammad.m.bassiouni@gmail.com>
2026-03-30 21:29:55 +02:00
lntue 6ae395a875 [libc][NFC] Guard long double type in shared_math_tests. (#189373)
Skip long double tests when long double is double-double.
Also adjust constant literals.
2026-03-30 10:05:16 -04:00
Mohamed Emad 1bb03026b6 [libc][math][c23] implement double-precision asinpi (#188158)
Implement the double precision version of the asinpi c23 math function
2026-03-29 10:18:07 -04:00
Anonmiraj e06b5e53a2 [libc][math] Implement C23 half precision erfc function (#180930)
Add support for the half-precision complementary error function
`erfcf16``, using a Sollya generated polynomial implementation with
proper handling of special cases.

Extend the MPFR utilities with erfc support to allow tests.

closes: #180927
2026-03-27 10:42:03 -04:00
Muhammad Bassiouni b4f50cfd4a [libc][math] Qualify ceil functions to constexpr (#184948) 2026-03-24 00:25:42 +02:00
Zorojuro aa62224a73 [libc][math] Refactor sqrtbf16 function header-only (#187849) 2026-03-22 00:51:40 +02:00