Commit Graph

429 Commits

Author SHA1 Message Date
wldfngrs
ecf4f95c4f [libc][math][c23] Add tanf16 function (#121018)
- Implementation of tan for 16-bit floating point inputs.
- Exhaustive tests across the 16-bit input range
2025-01-12 23:46:53 -05:00
Nick Desaulniers
85711bdda3 [libc][docs] update docs on how to build linux kernel headers from src (#122381)
It's simpler than the directions we have; which are very very Debian specific.
2025-01-10 14:40:57 -08:00
Prashanth
0afee850de [libc][docs] Add net/if.h documentation by referring to POSIX standards (#122406)
This pull request introduces the following changes to the project with
reference to issue ( #122006 ):

1. **Documentation Update**:
- Added a new YAML file `if.yaml` under `net` to document network
interface functions and macros.
   - The `if.yaml` file includes the following functions and macros:
     - Functions:
       - `if_freenameindex`
       - `if_indextoname`
       - `if_nameindex`
       - `if_nametoindex`
     - Macros:
       - `IF_NAMESIZE`

2. **CMake Configuration Update**:
- Updated the `CMakeLists.txt` file to create the necessary directory
for the `net` headers.
- Included the `net/if` documentation in the Sphinx build configuration.

3. **Index Update**:
- Updated the `index.rst` file to include a reference to the newly added
`net/if` documentation.

**Purpose**:
- This pull request adds documentation for network interface functions
and macros, ensuring they are included in the project's documentation.
- Updates the CMake configuration to support the new documentation.

**Testing**:
- Verified that the new YAML file is correctly referenced in the
`index.rst`.
- Ensured that the documentation builds without errors and includes the
new network interface documentation.

Co-authored-by: Nick Desaulniers <ndesaulniers@google.com>
2025-01-10 09:27:40 -08:00
Prashanth
dff7ef2353 [libc][docs] Add netinet/in header documentation by referring to POSIX standards (#122411)
This pull request introduces the following changes to the project with
reference to ( #122006 ):

1. **Documentation Update**:
- Added a new YAML file `in.yaml` to document network protocol and
address macros.
   - The `in.yaml` file includes the following macros:
     - `IPPROTO_IP`
     - `IPPROTO_IPV6`
     - `IPPROTO_ICMP`
     - `IPPROTO_RAW`
     - `IPPROTO_TCP`
     - `IPPROTO_UDP`
     - `INADDR_ANY`
     - `INADDR_BROADCAST`
     - `INET_ADDRSTRLEN`
     - `IPV6_JOIN_GROUP`
     - `IPV6_LEAVE_GROUP`
     - `IPV6_MULTICAST_HOPS`
     - `IPV6_MULTICAST_IF`
     - `IPV6_MULTICAST_LOOP`
     - `IPV6_UNICAST_HOPS`
     - `IPV6_V6ONLY`
     - `IN6_IS_ADDR_UNSPECIFIED`
     - `IN6_IS_ADDR_LOOPBACK`
     - `IN6_IS_ADDR_MULTICAST`
     - `IN6_IS_ADDR_LINKLOCAL`
     - `IN6_IS_ADDR_SITELOCAL`
     - `IN6_IS_ADDR_V4MAPPED`
     - `IN6_IS_ADDR_V4COMPAT`
     - `IN6_IS_ADDR_MC_NODELOCAL`
     - `IN6_IS_ADDR_MC_LINKLOCAL`
     - `IN6_IS_ADDR_MC_SITELOCAL`
     - `IN6_IS_ADDR_MC_ORGLOCAL`
     - `IN6_IS_ADDR_MC_GLOBAL`

_I believe, all these macros are necessary and should be documented._

2. **CMake Configuration Update**:
- Updated the `CMakeLists.txt` file to create the necessary directory
for the `netinet` headers.
- Included the `netinet/in` documentation in the Sphinx build
configuration.

3. **Index Update**:
- Updated the `index.rst` file to include a reference to the newly added
`netinet/in` documentation.

**Purpose**:
- This pull request adds documentation for network protocol and address
macros in the `netinet/in` header.
- Updates the CMake configuration to support the new documentation.

**Testing**:
- Verified that the new YAML file is correctly referenced in the
`index.rst`.
- Ensured that the documentation builds without errors and includes the
new network interface documentation.

This pull request ensures that the `netinet/in` header macros are
documented and included in the project's documentation, and updates the
CMake configuration to support these changes.
2025-01-10 09:24:02 -08:00
Prashanth
20f0290af0 [docs][libc] Add AIO documentation refering POSIX and include in build (#122219)
With reference to #122006 , add a new header reference (aio.yaml) to doc
2025-01-10 09:23:42 -08:00
Nick Desaulniers
98b3191a34 [libc][docgen] regen docgen via cmake (#119628)
Now, `ninja docs-libc-html` will re-run docgen.

Previously, we would run docgen offline, and commit the result.

Now we no longer need to do that; docgen is invoked from the
dependencies of the `docs-libc-html` target on demand. This
commit removes the dynamically generated .rst files (keeping
the static ones that haven't been converted to docgen), and
fixes up some mistakes I failed to cleanup recently since I
didn't have such automation in place to catch such bugs.
2025-01-06 08:52:08 -08:00
Roland McGrath
62cd050b63 [libc] Move hdrgen yaml files into include/ (#121443)
The .yaml files should live next to the corresponding .h.def
files in libc/include/, rather than next to the implementation of
the tool in libc/utils/hdrgen/.  As with the .h.def files, there
is no need for a yaml/ subdirectory under include/.  This simpler
layout is more natural for maintenance and also simplifies build
integration outside the LLVM CMake build.
2025-01-01 17:03:35 -08:00
Roland McGrath
9abcca5e25 [libc] Move hdrgen into utils/ subdirectory (#121256) 2024-12-30 15:36:53 -08:00
Michael Jones
0a94ee694f [libc] update host build docs (#120147)
Update the host build docs to better reflect the current recommended
process.
2024-12-19 13:13:55 -08:00
Nick Desaulniers
d2413d4413 [libc][docs] convert stdio.h to docgen (#120334)
Add info from n3220 and POSIX.1-2024.
2024-12-18 09:05:55 -08:00
Shourya Goel
c98e79d856 [libc][complex] Implement different flavors of the cproj function (#119722)
Refer section 7.3.9.5 of ISO/IEC 9899:2023
2024-12-18 02:04:50 +05:30
Nick Desaulniers
4c5ddc9ed4 [libc][docs] add redirect for math/index.html (#120274)
commit a9aff440d9 ("[libc][docs] reorganize documentation (#118836)")

moved https://libc.llvm.org/math/index.html to
https://libc.llvm.org/headers/math/index.html which makes links from
various slide decks stale.

There's an extension for sphinx that can generate redirects. Add a dependency
on that, then use it to create a redirect so that those older links still work.

I was able to install this sphinx extension via:

    $ sudo apt install python3-sphinx-reredirects

We may need to install this on whatever server generates the llvm
documentation.
2024-12-17 10:37:21 -08:00
Nick Desaulniers
13449c3de4 [libc][docs] split up platform and arch support (#120125)
Creates a new toctree "Support" under which we have distinct links to arch,
platform, and compiler support.

* Moved "Platform Support" from index landing page to new doc.
* Created explicit "Architecture Support". Requested in https://github.com/llvm/llvm-project/issues/118964#issuecomment-2531503046.
* Moved "Compiler Support" from Status toctree to new Support toctree.

---------

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2024-12-16 15:17:18 -08:00
Nick Desaulniers
750cb896ca [libc][docs] Refresh landing page (#120122)
- Replace section on ABI Compatibility with a rephrased warning at the
top of
  the page.
- Add links to the Note.
- Update C and POSIX standards.
- Inline link to fuzzing.
2024-12-16 10:47:37 -08:00
Joseph Huber
6d1a51303e [libc][Docs] Update libc documentation for RPC and others (#120018)
Summary:
A few of these were out of date, update them now that the C library
interface into RPC was deleted.
2024-12-16 09:09:19 -06:00
wldfngrs
6a865b6d3d [libc][math][c23] Add cosf16 function (#118785) 2024-12-15 18:58:54 +01:00
lntue
e5ab6e9607 [libc][doc] Add links to LLVM dev meeting talks related to LLVM libc. (#119918) 2024-12-13 15:57:31 -05:00
Nick Desaulniers
c047a5b3f6 [libc][docgen] simplify posix links (#119595)
Usually posix functions have individual doc pages, and each header has its own
list of required macro definitions. Use a simpler key of "in-latest-posix" to
signal that the URL convention can be followed.

Add support for a "removed-in-posix-2008" key which will link to the 2004 docs
for functions like bcmp, bcopy, bzero, index, and rindex from strings.h.

I don't want to add all of these links for pthreads.h, so automating this will
make documenting these go much faster.
2024-12-12 10:49:55 -08:00
Nick Desaulniers
e17d2b585b [libc][docgen] support non-top-level headers (#119621)
such as arpa/inet, sys/*
2024-12-12 09:21:04 -08:00
Nick Desaulniers
02e39a13c3 [libc][docs] split "String Functions" into string.h, strings.h, stdlib.h, and inttypes.h (#118860)
bcmp, bcopy, and bzero should be moved from libc/src/string/ to
lib/src/strings/ in order for docgen to use existing conventions to find
whether we implement a function or not.

We should add support to docgen for mentioning glibc extensions (mempcpy) or
extensions from other libcs.
2024-12-10 12:59:46 -08:00
Nick Desaulniers
1bf1e5f459 [libc] remove old hdrgen diagram (#119424)
FWICT, it was unused even before #117220.

Link: #117220
2024-12-10 10:12:00 -08:00
Shourya Goel
78c2b6d483 [libc][complex] Implement different flavors of the conj function (#118671)
Refer section 7.3.9.4 of ISO/IEC 9899:2023
2024-12-10 10:05:11 +05:30
Nick Desaulniers
429f0f1e1c [libc][docs] add missing c99 docs (#119239)
Looks like we were missing docs for:
- float.h
- wchar.h
- wctype.h

Which AFAICT were added in ISO C99.
2024-12-09 14:02:08 -08:00
Nick Desaulniers
a4e2927ab6 [libc][docs] add c11 threads and uchar (#119250)
FWICT, these were the newly added headers for c11.
2024-12-09 12:35:44 -08:00
Guillaume Chatelet
4873968649 [libc] Remove automemcpy folder (#118781)
The build is currently broken and we don't have the resources to keep it
up to date :-/
2024-12-06 09:30:13 +01:00
Schrodinger ZHU Yifan
2dba66b853 [libc] document supported os ranges (#118863) 2024-12-05 18:25:07 -05:00
Nick Desaulniers
7329086d4e [libc][docs] stub out assert, errno, and locale (#118852)
[libc][docs] stub out assert, errno, and locale

These were the remaining c89 library headers (besides string.h and
stdlib.h; I
will split strings.rst in a follow up commit).

The macro support detection in docgen doesn't quite work for some of
these
headers. Add the stubs for these headers for now, and fix up docgen
later.

See the "NIST publication":
Link: https://www.open-std.org/jtc1/sc22/wg14/www/projects.html
2024-12-05 14:20:03 -08:00
Nick Desaulniers
a9aff440d9 [libc][docs] reorganize documentation (#118836)
This commit does a few things:
* creates libc/docs/headers/ and moves all user API related headers under it.
* updates paths and docgen
* updates the top level index to put these headers under a new "Implementation
  Status" tab.
* rename some of the files to be foo.rst for foo.h (except strings, which is
  currently a mix of string.h and stdlib.h)
* update the heading of some files to be in the form foo.h.
2024-12-05 13:54:09 -08:00
Nick Desaulniers
fdb90cef75 [libc][docgen] update to POSIX.1-2024 (#118717)
The recently ratified POSIX.1-2024 is newer than POSIX.1-2017.
2024-12-05 08:23:40 -08:00
Nick Desaulniers
659834df0e docgen refresh (#118709)
- **[libc][docgen] Use Macro for macro table name**
- **fix setjmp json, otherwise can't regen**
- **regen all docs**
2024-12-04 15:43:52 -08:00
Nick Desaulniers
06c831d7fb [libc] rename newhdrgen to just hdrgen (#118545)
Link: #117208
Fixes: #117254
2024-12-04 08:48:12 -08:00
Nick Desaulniers
e0ae7793fc [libc] delete hdrgen (#117220)
Thanks to the effort of @RoseZhang03 and @aaryanshukla under the
guidance of
@michaelrj-google and @amykhuang, we now have newhdrgen and no longer
have a
dependency on TableGen and thus LLVM in order to start bootstrapping a
full
build.

This PR removes:
- LIBC_HDRGEN_EXE; the in tree newhdrgen is the only hdrgen that can be
used.
- LIBC_USE_NEW_HEADER_GEN; newhdrgen is the default and only option.
- LIBC_HDRGEN_ONLY; there is no need to have a distinct build step for
old
  hdrgen.
- libc-api-test and libc-api-test-tidy build targets.
- Deletes all .td files.

It does not rename newhdrgen to just hdrgen. Will follow up with a
distinct PR
for that.

Link: #117209
Link: #117254
Fixes: #117208
2024-12-03 12:34:26 -08:00
wldfngrs
cd04653c4e [libc][math][c23] Add sinf16 C23 math function (#116674)
Co-authored-by: OverMighty <its.overmighty@gmail.com>
2024-12-03 21:08:46 +01:00
Joseph Huber
27d25d1c12 [libc] Increase RPC opcode to 32-bit and use a class byte (#116905)
Summary:
Currently, the RPC interface uses a basic opcode to communicate with the
server. This currently is 16 bits. There's no reason for this to be 16
bits, because on the GPU a 32-bit write is the same as a 16-bit write
performance wise.

Additionally, I am now making all the `libc` based opcodes qualified
with the 'c' type, mimiciing how Linux handles `ioctls` all coming from
the same driver. This will make it easier to extend the interface when
it's exported directly.
2024-11-19 21:56:10 -06:00
lntue
c342d11375 [libc][doc] Add links to slides and video from Siva's CppNow 2023 talk. (#116038) 2024-11-13 11:35:45 -05:00
Duncan
396ed9c2a1 [libc][search] implement posix lfind function (#114692)
# Changes
- Implement the POSIX
[`lfind`](https://man7.org/linux/man-pages/man3/lsearch.3.html)
function.

- Put a checkmark in the [posix support table
docs](https://libc.llvm.org/libc_search.html) next to `lfind`.
2024-11-11 09:53:20 -08:00
wldfngrs
f7bb12901e [libc][math][c23] Add tanpif16 function (#115183)
- Implementation of `tan` for 16-bit floating point inputs scaled by pi.
i.e,. `tanpif16()`
- Implementation of Tanpi in MPFRWrapper for MPFR versions < 4.2
- Exhaustive tests for `tanpif16()`
2024-11-08 09:56:31 -05:00
OverMighty
faefedf7f8 [libc][math][c23] Add exp10m1f C23 math function (#87992)
Fixes #86503.
2024-11-07 23:56:00 +01:00
Shourya Goel
ffe04e0351 [libc][complex] implement different flavors of creal and cimag functions (#113300)
I have commented out the test for `neg_zero`(creal) because : 

1. real(neg_zero + 0.0i) equals zero. 
2. real(neg_zero - 0.0i) equals neg_zero.

I am not sure if this is the intended behaviour. 

[EDIT]
I have updated tests for `neg_zero` (creal) to be : 

```
    EXPECT_FP_EQ(func(CFPT(neg_zero - zero * 1.0i)), neg_zero);
    EXPECT_FP_EQ(func(CFPT(neg_zero + zero * 1.0i)), zero);
```

because all three [gcc, clang and GNU MPC] also give the same result. 
https://godbolt.org/z/hxhcn6aof
and it seems that it is indeed the correct behaviour since Imaginary
types are not supported yet, refer #113671
2024-11-03 09:38:09 +05:30
c8ef
b57b3f6425 [NFC] Simple typo correction. (#114548) 2024-11-02 00:40:57 +08:00
wldfngrs
7395ef5419 [libc][math][c23] Add cospif16 function (#113001)
Implementation of `cos` for half precision floating point inputs scaled
by pi (i.e., `cospi`), correctly rounded for all rounding modes.

---------

Co-authored-by: OverMighty <its.overmighty@gmail.com>
2024-10-29 03:39:57 -07:00
OverMighty
d97f6d1ae9 [libc][math][c23] Add sqrtf16 C23 math function (#112406)
Part of #95250.
2024-10-19 01:41:52 +02:00
OverMighty
69d3a44ede [libc][math][c23] Add log10f16 C23 math function (#106091)
Part of #95250.
2024-10-19 01:40:40 +02:00
OverMighty
6d347fdfbd [libc][math][c23] Add log2f16 C23 math function (#106084)
Part of #95250.
2024-10-19 01:10:32 +02:00
OverMighty
65cf7afb6d [libc][math][c23] Add logf16 C23 math function (#106072)
Part of #95250.
2024-10-18 22:35:12 +02:00
Joseph Huber
00d30bd61e [libc] Commit document formatting change someone left 2024-10-18 10:09:28 -05:00
lntue
b0dbd2ca5b [libc][math] Add option to set a specific exponent for frexp with Inf/NaN inputs. (#112387)
In IEEE 754 and C standards, when calling `frexp` with Inf/Nan inputs,
the exponent result is unspecified. In this case, FreeBSD libc and musl
just passthrough `exp`, while glibc, FreeBSD libm set exp = 0, and MSVC
set exp = -1.

By default, LLVM libc will passthrough `exp` just as FreeBSD libc and
musl, but we also allow users to explicitly choose the return exp value
in this case for compatibility with other libc.

Notice that, gcc did generate passthrough `exp` for `frexp(NaN/Inf,
exp)`: https://godbolt.org/z/sM8fEej4E
2024-10-18 09:58:15 -04:00
OverMighty
fdd7c0353f [libc][math][c23] Add tanhf16 C23 math function (#106006)
Part of #95250.
2024-10-18 14:22:45 +02:00
OverMighty
ed3d051782 [libc][math][c23] Add sinhf16 and coshf16 C23 math functions (#105947)
Part of #95250.
2024-10-17 20:44:23 +02:00
OverMighty
95c24cb9de [libc][math][c23] Add exp10m1f16 C23 math function (#105706)
Part of #95250.
2024-10-16 16:33:13 +02:00