Commit Graph

57 Commits

Author SHA1 Message Date
Muhammad Bassiouni
e86c9b6b1b [libc][math] Refactor cos implementation to header-only in src/__support/math folder. (#151883)
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-08-09 18:51:54 +03:00
Joseph Huber
0c139883f4 [libc] Fix server code when GPU is acting as the server
Summary:
Small fix that just ignores all the extra lanes if we're running the
server from a platform that potentially has more.
2025-08-08 19:15:13 -05:00
Muhammad Bassiouni
66734f4c3c [libc][math] Refactor cbrtf implementation to header-only in src/__support/math folder. (#151846)
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-08-08 18:28:50 +03:00
Muhammad Bassiouni
003f6ada15 [libc][math] Refactor cbrt implementation to header-only in src/__support/math folder. (#151837)
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-08-03 21:02:53 +03:00
Muhammad Bassiouni
bb3cd6221b [libc][math] Refactor atanhf16 implementation to header-only in src/__support/math folder. (#151779)
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-08-02 23:04:02 +03:00
Muhammad Bassiouni
99cd1d8aef [libc][math] Refactor atanhf implementation to header-only in src/__support/math folder. (#151399)
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-08-02 02:54:13 +03:00
Muhammad Bassiouni
920079b793 [libc][math] Refactor atan2f128 implementation to header-only in src/__support/math folder. (#151012)
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-08-02 00:18:57 +03:00
Muhammad Bassiouni
9af2c21be4 [libc][math] Refactor atan2f implementation to header-only in src/__support/math folder. (#150993)
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-08-01 16:06:09 +03:00
Muhammad Bassiouni
c8b6ddf3a3 [libc][math] Refactor atan2 implementation to header-only in src/__support/math folder. (#150968)
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-07-31 01:07:55 +03:00
Muhammad Bassiouni
729b0d1b61 [libc][math] Refactor atanf16 implementation to header-only in src/__support/math folder. (#150868)
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-07-30 23:31:07 +03:00
Muhammad Bassiouni
f2a476d79a [libc][math] Refactor atanf implementation to header-only in src/__support/math folder. (#150854)
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-07-30 07:24:49 +03:00
Muhammad Bassiouni
551dcc3e82 [libc][math] Refactor atan implementation to header-only in src/__support/math folder. (#150852)
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-07-29 21:16:57 +03:00
Muhammad Bassiouni
efbbc0b319 [libc][math] Refactor asinhf16 implementation to header-only in src/__support/math folder. (#150849)
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-07-29 20:19:01 +03:00
Muhammad Bassiouni
5bcbcf8d53 [libc][math] Refactor asinhf implementation to header-only in src/__support/math folder. (#150843)
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-07-28 18:14:47 +03:00
Muhammad Bassiouni
85213f2f88 [libc][math] Refactor asinf16 implementation to header-only in src/__support/math folder. (#150800)
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-07-27 20:03:10 +03:00
Muhammad Bassiouni
2eb112d78d [libc][math] Refactor asinf implementation to header-only in src/__support/math folder. (#150697)
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-07-26 02:05:09 +03:00
Muhammad Bassiouni
bc19aedba2 [libc][math] Refactor asin implementation to header-only in src/__support/math folder. (#148578)
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-07-25 22:46:43 +03:00
Muhammad Bassiouni
47e2de0d50 [libc][math] Refactor acospif16 implementation to header-only in src/__support/math folder. (#148574)
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-07-25 21:28:27 +03:00
lntue
a883a67916 [libc] Fix dependency list of libc.src.__support.math.exp10f16. (#150434) 2025-07-25 16:10:47 +00:00
Leandro Lacerda
8f410b491e [libc] Fix incorrect macro usage in shared/sign.h (#150140)
This patch corrects the `using`-declaration in `libc/shared/sign.h`.

The previous change (#150083) incorrectly used the `LIBC_NAMESPACE_DECL`
macro. This is corrected to use `LIBC_NAMESPACE`.
2025-07-22 20:17:09 -05:00
Leandro Lacerda
d8e55c842b [libc] Expose the Sign type for shared use (#150083)
This patch exposes the internal `Sign` type for shared use by other LLVM
subprojects, following the pattern established by `FPBits`.

The `FPBits` utility is exposed via `libc/shared/fp_bits.h`. However,
its public interface relies on the `Sign` type for, e.g., creating
signed infinities and returning the sign of a value. Currently, users of
the shared `FPBits` have no way to access the `Sign` type.

Following the existing pattern for sharing `libc` utilities, this patch
adds a new public header `libc/shared/sign.h`. This header simply
includes the internal `src/__support/sign.h` and brings the `Sign` type
into the `shared` namespace.
2025-07-22 15:29:01 -05:00
Muhammad Bassiouni
520398e752 [libc][math] Refactor acoshf16 implementation to header-only in src/__support/math folder. (#148568)
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-07-22 00:18:15 +03:00
Muhammad Bassiouni
84781c0ed3 [libc][math] Refactor acoshf implementation to header-only in src/__support/math folder. (#148418)
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-07-21 23:02:19 +03:00
Muhammad Bassiouni
fe267860c1 [libc][math] Refactor erff implementation to header-only in src/__support/math folder. (#148413)
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-07-21 22:24:24 +03:00
Muhammad Bassiouni
9ad7edef42 [libc][math] Refactor acosf16 implementation to header-only in src/__support/math folder. (#148412)
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-07-21 21:35:39 +03:00
Muhammad Bassiouni
2865f1ba96 [libc][math] add smoke tests to shared/math.h (#149741)
Adding smoke tests for shared math header.

part of #147386
2025-07-21 20:48:57 +03:00
Muhammad Bassiouni
ef4e4a0084 [libc][math] Refactor acosf implementation to header-only in src/__support/math folder. (#148411)
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-07-20 22:41:28 +03:00
Muhammad Bassiouni
cfddb401db [libc][math] Refactor acos implementation to header-only in src/__support/math folder. (#148409)
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-07-19 05:21:34 +03:00
Muhammad Bassiouni
7e0ae019f8 [libc][math] Refactor exp10f16 implementation to header-only in src/__support/math folder. (#148408)
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-07-18 20:00:04 +03:00
Muhammad Bassiouni
b8bc3ff9be [libc][math] Refactor exp10f implementation to header-only in src/__support/math folder. (#148405)
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-07-17 20:25:00 +03:00
Muhammad Bassiouni
3a6ef8b359 [libc][math] Refactor exp10 implementation to header-only in src/__support/math folder. (#148400)
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-07-16 22:48:29 +03:00
Muhammad Bassiouni
d969ec9422 [libc][math] Refactor exp implementation to header-only in src/__support/math folder. (#148761)
- **[libc][math] Refactor exp implementation to header-only in
src/__support/math folder.**
- **Reapply "[libc][math] Refactor exp implementation to header-only in
src/__support/math folder." (#148668)**
2025-07-15 12:10:08 -04:00
lntue
f4630baaa2 Revert "[libc][math] Refactor exp implementation to header-only in src/__support/math folder." (#148668)
Reverts llvm/llvm-project#148091
Full build bots are failing.
2025-07-14 12:46:26 -04:00
Muhammad Bassiouni
a76dfde936 [libc][math] Refactor exp implementation to header-only in src/__support/math folder. (#148091)
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-07-14 12:21:27 -04:00
Muhammad Bassiouni
cfcda5d0ff [libc][math] Refactor ldexpf implementation to header-only in src/__support/math folder (#147906)
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

Please merge #147901 first

@lntue
2025-07-14 11:35:53 -04:00
Muhammad Bassiouni
074218dd10 [libc][math] Refactor ldexpf16 implementation to header-only in src/__support/math folder. (#147901)
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

Please merge #147895 first
2025-07-14 11:00:01 -04:00
Muhammad Bassiouni
0ad2574de7 [libc][math] Refactor ldexpf128 implementation to header-only in src/__support/math folder. (#147895)
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-07-14 10:10:49 -04:00
Muhammad Bassiouni
d06e9ce1dd [libc][math] Refactor frexpf implementation to header-only in src/__support/math folder. (#147893)
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-07-12 11:08:58 -04:00
Muhammad Bassiouni
395643e60b [libc][math] Refactor frexpf16 implementation to header-only in src/__support/math folder. (#147889)
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-07-12 00:48:01 -04:00
Muhammad Bassiouni
d02c85a29b [libc] Fix frexpf128 build failure. (#148332) 2025-07-11 23:55:09 -04:00
Muhammad Bassiouni
af6500d14c [libc][math] Refactor frexpf128 implementation to header-only in src/… (#147822)
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-07-11 22:59:09 -04:00
Muhammad Bassiouni
c25a5e08ba [libc][math] Refactor expf16 implementation to header-only in src/__support/math folder. (#147428)
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-07-10 22:21:48 -04:00
lntue
d1ca8d891f [libc][math] Refactor expf implementation to header-only in src/__support/math folder. (#143790)
This is a step 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-06-12 13:18:30 -04:00
lntue
d87eea35fa [libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187)
This is the first step 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-06-11 16:25:27 -04:00
Joseph Huber
e376f3129a [libc] Make RPC allocation size query constexpr
Summary:
Let this be used for a static array.
2025-03-26 09:21:43 -05:00
Joseph Huber
8437b7f558 [libc] Make RPC server handling header only (#131205)
Summary:
This patch moves the RPC server handling to be a header only utility
stored in the `shared/` directory. This is intended to be shared within
LLVM for the loaders and `offload/` handling.

Generally, this makes it easier to share code without weird
cross-project binaries being plucked out of the build system. It also
allows us to soon move the loader interface out of the `libc` project so
that we don't need to bootstrap those and can build them in LLVM.
2025-03-13 19:23:21 -05:00
Joseph Huber
f855ceeefc [libc][NFC] use __has_builtin instead of checking macros. 2025-01-04 15:36:08 -06:00
Joseph Huber
9cb68b4dda [libc] Make the RPC headers work when included from CUDA or HIP (#120016)
Summary:
In order for this to work with CUDA we need to declare functions as
__host__ and __device__ while also making sure we only call the GPU
functions during the CUDA / HIP compile stage.
2024-12-16 09:09:03 -06:00
Jinsong Ji
e85a9f5540 libc: Prefix RPC Status code to avoid conflict in windows build (#119991)
Somehow conflict with define in wingdi.h.

Fix build failures:

[ 52%] Building CXX object
projects/offload/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/RPC.cpp.obj
In file included from
...llvm\offload\plugins-nextgen\common\src\RPC.cpp:16:
...\llvm\libc\shared\rpc.h(48,3): error: expected identifier
   48 |   ERROR = 0x1000,
      |   ^
c:\Program files (x86)\Windows
Kits\10\include\10.0.22000.0\um\wingdi.h(118,29): note: expanded from
macro 'ERROR'
  118 | #define ERROR               0
      |                             ^
...\llvm\offload\plugins-nextgen\common\src\RPC.cpp(75,17): error:
expected unqualified-id
   75 |     return rpc::ERROR;
      |                 ^
c:\Program files (x86)\Windows
Kits\10\include\10.0.22000.0\um\wingdi.h(118,29): note: expanded from
macro 'ERROR'
  118 | #define ERROR               0
      |                             ^
2 errors generated.
2024-12-15 09:35:44 -05:00
Joseph Huber
a6ef0debb1 [libc][NFC] Rename RPC opcodes to better reflect their usage
Summary:
RPC_ is a generic prefix here, use LIBC_ to indicate that these are
opcodes used to implement the C library
2024-12-02 15:35:08 -06:00