479 Commits

Author SHA1 Message Date
amansharma612
3382aef944
[libc] Fixed typo in porting.rst (#134488)
Co-authored-by: Aman Sharma <210100011@iitb.ac.in>
2025-04-07 21:59:41 +01:00
lntue
8741412bdf
[libc][math] Implement a fast pass for atan2f128 with 1ULP error using DyadicFloat<128>. (#133150)
Part of https://github.com/llvm/llvm-project/issues/131642.
2025-04-01 10:57:32 -04:00
Tejas Vipin
8078665bca
[libc][math][c23] Add hypotf16 function (#131991)
Implement hypot for Float16 along with tests.
2025-03-31 10:06:28 -04:00
Tejas Vipin
d22e35be17
[libc][math][c23] Add asinhf16 function (#131351)
Implement asinh for Float16 along with tests. Closes #131001
2025-03-29 13:54:52 +01:00
Michael Jones
6cc208cd3c
[libc] Add maintainers file (#133471)
Based on #133297 by jhuber.

LLVM-libc needs a maintainers file, this patch adds an initial set.
The file is based on `clang/maintainers.rst` and
https://llvm.org/docs/DeveloperPolicy.html#maintainers.
2025-03-28 16:50:19 -07:00
Harrison Hao
445837a363
[libc][math][c23] Add fmaf16 C23 math function. (#130757)
Implementation of fmaf16 function for 16-bit inputs.
2025-03-23 10:48:56 +08:00
Harrison Hao
ee3e17d67f
[libc][math][c23] Add acoshf16 C23 math function. (#130588)
Implementation of acoshf16 function for 16-bit inputs.
2025-03-22 22:08:34 -04:00
Mohamed Emad
adcaf1769d
[libc] [NFC] fix type in docs/uefi/index.rst (#132553)
Closes #132537
2025-03-22 12:16:15 -07:00
lntue
a17b03f0e4
[libc][math] Implement fast pass for double precision atan function. (#132333)
Implement fast pass for double precision `atan` using range reduction
modulo 1/64 and degree-9 Taylor polynomial.
Relative error is bounded by 2^-66.
2025-03-21 14:12:06 -04:00
Prashanth
7063419460
[libc][docs] Add dirent implementation status doc and include in CMakeLists (#132151)
These changes tracks `dirent.h` for the implementation status of
functions and macros, with respect to the issue (
https://github.com/llvm/llvm-project/issues/122006 ).
2025-03-20 11:08:44 -04:00
Prashanth
592a3ba125
[libc][docs] Add sys/utsname header and documentation for uname function (#131817)
These changes tracks `utsname.h` for the implementation status of
functions and macros, with respect to the issue (
https://github.com/llvm/llvm-project/issues/122006 ).
2025-03-18 16:22:01 -04:00
Prashanth
47f7daab06
[libc][docs] Add glob implementation status doc and include in CMakeLists (#126923)
These changes tracks `glob.h` for the implementation status of functions
and macros, with respect to the issue ( #122006 ) .

cc @nickdesaulniers
2025-03-17 13:05:50 -04:00
Tristan Ross
4e841d7d63
[libc] add uefi docs (#131426)
Adds documentation for the UEFI target since #131246 was merged.
2025-03-16 10:21:19 -07: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
598e882ee8
[libc] Template the writing mode for the writer class (#111559)
Summary:
Currently we dispatch the writing mode off of a runtime enum passed in
by the constructor. This causes very unfortunate codegen for the GPU
targets where we get worst-case codegen because of the unused function
pointer for `sprintf`. Instead, this patch moves all of this to a
template so it can be masked out. This results in no dynamic stack and
uses 60 VGPRs instead of 117. It also compiles about 5x as fast.
2025-03-12 13:51:44 -05:00
PiJoules
313e2ef93e
[libc] Mark fixed point type generic macros as complete (#130805)
These were added in https://github.com/llvm/llvm-project/pull/129371.
2025-03-11 11:03:51 -07:00
Aiden Grossman
eac734aab6
[libc][docs] Fix libc docs build post #129138 (#130184)
The docs build action was failing with libc due to checks.rst not
existing in the expected path. This patch adjusts the path to the actual
path which seems to make everything happy. It seems like this did not
show up before as stdfix.rst was not included in a place that actually
caused it to get picked up by sphinx.
2025-03-06 14:07:44 -08:00
PiJoules
1a09adae9f
[libc] Add link to stdfix.h on headers page (#129138)
Co-authored-by: Petr Hosek <phosek@google.com>
2025-03-06 10:31:26 -08:00
OverMighty
d9ac5d0be6
[libc][docs] Add links to Peter Smith's FOSDEM 2025 talk (#129555) 2025-03-03 19:15:21 +01:00
PiJoules
7842954b9d
[stdfix] Update function names (#129129)
The remaining math functions are `mulifx` (int * fx = int), `divifx`
(int / fx = int), `fxdivi` (int / int = fx), and `idivfx` (fx / fx =
int).
2025-02-27 13:51:37 -08:00
Michael Jones
64ae0a102f
[libc] implement l64a (#129099)
Adds l64a, which generates the base 64 string expected by a64l.
2025-02-27 12:48:39 -08:00
PiJoules
9a32af25b4
[stdfix] Check fxbits as complete (#129107)
These were added in https://github.com/llvm/llvm-project/pull/114912 by
@smallp-o-p.
2025-02-27 12:04:06 -08:00
Krishna Pandey
f6bfa33cdb
[libc][stdfix] Implement fixed point bitsfx functions in llvm libc (#128413)
Fixes #113359

---------

Signed-off-by: krishna2803 <kpandey81930@gmail.com>
2025-02-27 13:05:27 -05:00
Alexey Samsonov
829e2a5526
[libc][hdrgen] Allow to treat hdrgen Python code as a Python module. (#128955)
Move the hdrgen code under a subdirectory to treat it as a Python
module.

This mimics the structure used by llvm/utils/lit and
llvm/utils/mlgo-utils and simplifies integration of hdrgen to the build
system which rely on Python modules. In addition to that, it clarifies
which imports are coming from the hdrgen-specific helpers (e.g. "from
type import ..." becomes "from hdrgen.type import ...".

Leave the entrypoints (top-level main.py and yaml_to_classes.py) as-is:
they can keep being referred by the CMake build system w/o any changes.
2025-02-26 15:41:30 -08:00
wldfngrs
3e284554a8
[libc][math][c23] Add acosf16() function (#127731)
- Implementation of acosf16 (inverse cosine) function for 16-bit inputs.
- Exhaustive tests across the 16-bit input range.
2025-02-23 19:46:46 +01:00
Joseph Huber
6b3e7657cf
[libc] Enable 'strftime' for the GPU targets (#128220)
Summary:
These should allow us to build with locale support for libcxx.
2025-02-21 16:29:15 -06:00
Fabian Ritter
a2f9ae1421
[AMDGPU] Replace gfx940 and gfx941 with gfx942 in offload and libclc (#125826)
gfx940 and gfx941 are no longer supported. This is one of a series of
PRs to remove them from the code base.

For SWDEV-512631 and SWDEV-512633
2025-02-19 09:56:04 +01:00
Joseph Huber
0d2722c20d [libc][Docs] Add proper 'offload' build to use libc with offload
Summary:
Since this was added the offloading target now requires `offload`.

Fixes: https://github.com/llvm/llvm-project/issues/127458
2025-02-17 12:42:37 -06:00
Michael Jones
398f865499
[libc] Implement strftime (#122556)
Implements the posix-specified strftime conversions for the default
locale, along with comprehensive unit tests. This reuses a lot of design
from printf, as well as the printf writer.

Roughly based on #111305, but with major rewrites.
2025-02-14 15:56:55 -08:00
Alex Bradbury
db2953d801
[doc] Add Discord invite link alongside channel links (#126352)
By far the most important part of this patch is updating
GettingInvolved.rst to include the invite link, but I've grepped for any
other discord.com links.

I'm no Discord expert, but from my experience (confirmed via @preames
kindly testing as well) the direct channel links provide a confusing
experience if you haven't already found and used an invite link to the
LLVM Discord server. If you're logged into Discord but not a member of
LLVM's sever, the web app opens and then...nothing. No channel opens, no
prompt to join the server or even a hint that you need to find an invite
link (and if you're not used to Discord, you likely don't even know
that's necessary).

This patch addresses the issue by providing the invite link where
Discord is mentioned.
2025-02-13 15:00:21 +00:00
Krishna Pandey
1f51038036
[libc][stdfix] Implement countlsfx functions in libc. (#126597)
fixes #113357

---------

Signed-off-by: krishna2803 <kpandey81930@gmail.com>
2025-02-12 14:12:44 -05:00
Prashanth
6a8439b593
[libc][docs] Add sys/statvfs to documentation and YAML definitions (#126413)
These changes ensure that the sys/statvfs header is documented properly
with respect to the issue (
https://github.com/llvm/llvm-project/issues/122006 ) .
2025-02-10 08:58:46 -08:00
wldfngrs
7ee56b9afc
[libc][math][c23] Add asinf16() function (#124212)
Co-authored-by: OverMighty <its.overmighty@gmail.com>
2025-02-10 12:38:55 +01:00
Joseph Huber
7623d91784 Revert "[libc][stdfix] Fix buildbot failure because of a typo. (#126291)"
This reverts commit bada9220b87e73c0f4a498b82f883e17eda928d1.

Revert "[libc][stdfix] Implement fixed point `countlsfx` functions in llvm-libc (#125356)"

This reverts commit f2a1103b323492160d7d27a1575fbda709b49036.
2025-02-07 14:34:40 -06:00
Krishna Pandey
f2a1103b32
[libc][stdfix] Implement fixed point countlsfx functions in llvm-libc (#125356)
fixes #113357
2025-02-07 13:53:17 -05:00
c8ef
6807164500
[libc] Add the <endian.h> header. (#125168)
Closes [#124631](https://github.com/llvm/llvm-project/issues/124631).
ref:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html

This patch adds the implementation of `endian.h`, which includes the
header itself and three related macros. These macros in the header rely
on the compiler preprocessor, similar to how
https://github.com/llvm/llvm-project/blob/main/libc/src/__support/endian_internal.h
does. Hopefully this will meet the requirements for compiling llvm with
llvm-libc.
2025-02-07 09:20:18 +08:00
Simon Tatham
b53da77c50
[libc] Alternative algorithm for decimal FP printf (#123643)
The existing options for bin→dec float conversion are all based on the
Ryū algorithm, which generates 9 output digits at a time using a table
lookup. For users who can't afford the space cost of the table, the
table-lookup subroutine is replaced with one that computes the needed
table entry on demand, but the algorithm is otherwise unmodified.

The performance problem with computing table entries on demand is that
now you need to calculate a power of 10 for each 9 digits you output.
But if you're calculating a custom power of 10 anyway, it's easier to
just compute one, and multiply the _whole_ mantissa by it.

This patch adds a header file alongside `float_dec_converter.h`, which
replaces the whole Ryū system instead of just the table-lookup routine,
implementing this alternative simpler algorithm. The result is accurate
enough to satisfy (minimally) the accuracy demands of IEEE 754-2019 even
in 128-bit long double. The new float128 test cases demonstrate this by
testing the cases closest to the 39-digit rounding boundary.

In my tests of generating 39 output digits (the maximum number supported
by this algorithm) this code is also both faster and smaller than the
USE_DYADIC_FLOAT version of the existing Ryū code.
2025-02-04 08:57:54 +00:00
Joseph Huber
26f4e2a701 [libc][docs] Fix the RPC documentation leaking ports
Summary:
Forgot to close it, that'll make it deadlock after awhile.
2025-01-28 15:26:10 -06:00
Joseph Huber
7b1becd940
[libc] Add CMake cache file for the GPU build (#124589)
Summary:
This introduces libc cache files and adds one for building the GPU
support. The cache files will set defaults for these arguments which can
be overridden if the user needs to. They also serve as documentation for
how the builid is expected to look.
2025-01-27 11:46:35 -06:00
siya100
d398c0c97a
[libc][cpio] Add cpio.h header. (#123798)
[libc][docs] add cpio to documentation and include related functi… 
These changes ensure that the cpio header is documented properly
with respect to the issue
(https://github.com/llvm/llvm-project/issues/122006 ).

**Changes:**
1. **cpio.yaml**: Created a new YAML file for cpio with functions
and related macros.
2. **CMakeLists.txt**: Added cpio to the documentation
directories.
3. **index.rst**: Included `cpio` in the documentation index.

---------

Co-authored-by: siya <siya@Siya.com>
2025-01-24 12:32:51 -08:00
Prashanth
24b1373650
[libc][docs] Add Unistd header's page to the status of implementations doc (#123068)
These changes ensure that the unistd header is documented properly with
respect to the issue ( https://github.com/llvm/llvm-project/issues/122006 ) .
2025-01-23 11:30:01 -08:00
Joseph Huber
db6b7a84e6
[libc][NFC] Strip all training whitespace and missing newlines (#124163) 2025-01-23 12:02:54 -06:00
Nick Desaulniers
ddb8607fe8
[libc][docs] disable pthreads docs (#123824)
Having a target named pthreads is breaking when multiple runtimes are enabled.
Disable this target for now so that the builds go back to green (and sites get
updated).

Link: https://github.com/llvm/llvm-zorg/issues/359#issuecomment-2600285688
Link: #122006
Link: #122497
Link: #123821
2025-01-22 09:33:53 -08:00
Prashanth
f12e0c9c3a
[libc][docs] Add sys/stat page to the status of implementations docs (#122997)
These changes ensure that the sys/stat header is documented properly
with respect to the issue ( #122006 ) .
2025-01-17 10:19:22 -08:00
Prashanth
d54d8d7e5a
[libc][docs] Add termios page to the status of implementations docs (#123004)
These changes ensure that the termios header is documented properly with
respect to the issue ( https://github.com/llvm/llvm-project/issues/122006 ) .
2025-01-17 08:59:49 -08:00
Prashanth
9f627cf540
[libc][docs] Add sys/time page to the status of implementations docs (#123000)
These changes ensure that the sys/time header is documented properly
with respect to the issue ( #122006 ) .
2025-01-17 08:38:03 -08:00
Prashanth
fadb0e9b52
[libc][docs] add sys/wait to documentation and include related functi… (#122598)
These changes ensure that the `sys/wait` header is documented properly
with respect to the issue (#122006 ).

**Changes:**
1. **wait.yaml**: Created a new YAML file for `sys/wait` with functions
(`wait`, `waitid`, `waitpid`) and related macros.
2. **CMakeLists.txt**: Added `sys/wait` to the documentation
directories.
3. **index.rst**: Included `sys/wait` in the documentation index.
2025-01-15 15:45:16 -08:00
Nick Desaulniers
692c77f2af
[libc][docs] reorder docs to be more beginner friendly (#122376)
This commit does a few things, with the intent to make it more straightforward
to potential future users how to get started with llvm-libc. Answers to "What's
the status and how do I use it?" are front and center, "above the fold."

This commit does a few things:
* reorganize the landing page's toctree: start with implementation status, arch
* support, platform support, and
    compiler support.
  * Then a (new) simple getting started page using full host builds. Then more
  * Advanced topics such as host vs cross builds, overlay mode,
    gpu builds and additional configuration options.
* Remove c23 status, the old fullbuild_mode landing page, and
  usage_modes landing pages. c23 status isn't as interesting as I originally
  thought it might.

We should point people at full host builds to start, then link to more info on
cross compilation, or overlay mode as more advanced topics. I assert most users
starting out won't care about those.
2025-01-14 09:38:15 -08:00
Nick Desaulniers
539b15b41a
[libc][docs] stub out pthread.h support (#122497)
Link: #122006
2025-01-14 08:48:38 -08:00
Prashanth
c2771ca284
[libc][docs] Add sys/resource header's implementation status (#122563)
### Add sys/resource header's implementation status ( #122006 )

#### Changes:
1. **CMakeLists.txt**: Added `sys/resource` to the list of documentation
directories.
2. **index.rst**: Included `sys/resource` in the documentation index.
3. **resource.yaml**: Created a new YAML file for `sys/resource` with
functions and macros which manages system resources.

This PR adds documentation support for the `sys/resource` header,
including functions and macros as per the latest POSIX standards.
2025-01-14 08:44:46 -08:00