<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libc/utils, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[Clang] Gut the libc wrapper headers and simplify (#168438)</title>
<updated>2025-11-19T13:18:13+00:00</updated>
<author>
<name>Joseph Huber</name>
<email>huberjn@outlook.com</email>
</author>
<published>2025-11-19T13:18:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7fe35641672b6431134e99af658bd79fd438da54'/>
<id>7fe35641672b6431134e99af658bd79fd438da54</id>
<content type='text'>
Summary:
These were originally intended to represent the functions that are
present on the GPU as to be provided by the LLVM libc implementation.
The original plan was that LLVM libc would report which functions were
supported and then the offload interface would mark those as supported.
The problem is that these wrapper headers are very difficult to make
work given the various libc extensions everyone does so they were
extremely fragile.

OpenMP already declares all functions used inside of a target region as
implicitly host / device, while these headers weren't even used for CUDA
/ HIP yet anyway. The only things we need to define right now are the
stdio FILE types. If we want to make this work for CUDA we'd need to
define these manually, but we're a ways off and that's way easier
because they do proper overloading.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Summary:
These were originally intended to represent the functions that are
present on the GPU as to be provided by the LLVM libc implementation.
The original plan was that LLVM libc would report which functions were
supported and then the offload interface would mark those as supported.
The problem is that these wrapper headers are very difficult to make
work given the various libc extensions everyone does so they were
extremely fragile.

OpenMP already declares all functions used inside of a target region as
implicitly host / device, while these headers weren't even used for CUDA
/ HIP yet anyway. The only things we need to define right now are the
stdio FILE types. If we want to make this work for CUDA we'd need to
define these manually, but we're a ways off and that's way easier
because they do proper overloading.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][hdrgen] Sort identifiers with leading underscores specially (#165745)</title>
<updated>2025-10-30T18:49:22+00:00</updated>
<author>
<name>Roland McGrath</name>
<email>mcgrathr@google.com</email>
</author>
<published>2025-10-30T18:49:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a24a7548b845eba93d8c03079f8c6fcd923306a6'/>
<id>a24a7548b845eba93d8c03079f8c6fcd923306a6</id>
<content type='text'>
This makes the sorting behavior more uniform: functions and
macros are always sorted (separately), not only when merging.

This changes the sort order used for functions and other things
sorted by their symbol names.  Symbols are sorted alphabetically
without regard to leading underscores, and then for identifiers
that differ only in the number of leading underscores, the fewer
underscores the earlier in the sort order.  For the functions
declared in a generated header, adjacent names with and without
underscores will be grouped together without blank lines.

This is implemented by factoring the name field, equality, and
sorting support out of the various entity classes into a new
common superclass (hdrgen.Symbol).

This uncovered YAML's requirement to quote the string "NULL" to
avoid pyyaml parsing it as None (equivalent to Javascript null)
rather than a string.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes the sorting behavior more uniform: functions and
macros are always sorted (separately), not only when merging.

This changes the sort order used for functions and other things
sorted by their symbol names.  Symbols are sorted alphabetically
without regard to leading underscores, and then for identifiers
that differ only in the number of leading underscores, the fewer
underscores the earlier in the sort order.  For the functions
declared in a generated header, adjacent names with and without
underscores will be grouped together without blank lines.

This is implemented by factoring the name field, equality, and
sorting support out of the various entity classes into a new
common superclass (hdrgen.Symbol).

This uncovered YAML's requirement to quote the string "NULL" to
avoid pyyaml parsing it as None (equivalent to Javascript null)
rather than a string.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][hdrgen] Add extra_standards and license_text (#165459)</title>
<updated>2025-10-30T17:00:51+00:00</updated>
<author>
<name>Roland McGrath</name>
<email>mcgrathr@google.com</email>
</author>
<published>2025-10-30T17:00:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=22079e3f3698d5c367c7b67f63de8c838791ae76'/>
<id>22079e3f3698d5c367c7b67f63de8c838791ae76</id>
<content type='text'>
This adds a few new features to hdrgen, all meant to facilitate
using it with inputs and outputs that are outside the llvm-libc
source tree.

The new `extra_standards` field is a dictionary to augment the
set of names that can be used in `standards` lists.  The keys are
the identifiers used in YAML ("stdc") and the values are the
pretty names generated in the header comments ("Standard C").
This lets a libc project that's leveraging the llvm-libc sources
along with its own code define new APIs outside the formal and de
facto standards that llvm-libc draws its supported APIs from.

The new `license_text` field is a list of lines of license text
that replaces the standard LLVM license text used at the top of
each generated header.  This lets other projects use hdrgen with
their own inputs to produce generated headers that are not tied
to the LLVM project.

Finally, for any function attributes that are not in a canonical
list known to be provided by __llvm-libc-common.h, an include
will be generated for "llvm-libc-macros/{attribute name}.h",
expecting that file to define the "attribute" name as a macro.

All this can be used immediately by builds that drive hdrgen and
build libc code outside the LLVM CMake build.  Future changes
could add CMake plumbing to facilitate augmenting the LLVM CMake
build of libc with outside sources via overlays and cache files.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds a few new features to hdrgen, all meant to facilitate
using it with inputs and outputs that are outside the llvm-libc
source tree.

The new `extra_standards` field is a dictionary to augment the
set of names that can be used in `standards` lists.  The keys are
the identifiers used in YAML ("stdc") and the values are the
pretty names generated in the header comments ("Standard C").
This lets a libc project that's leveraging the llvm-libc sources
along with its own code define new APIs outside the formal and de
facto standards that llvm-libc draws its supported APIs from.

The new `license_text` field is a list of lines of license text
that replaces the standard LLVM license text used at the top of
each generated header.  This lets other projects use hdrgen with
their own inputs to produce generated headers that are not tied
to the LLVM project.

Finally, for any function attributes that are not in a canonical
list known to be provided by __llvm-libc-common.h, an include
will be generated for "llvm-libc-macros/{attribute name}.h",
expecting that file to define the "attribute" name as a macro.

All this can be used immediately by builds that drive hdrgen and
build libc code outside the LLVM CMake build.  Future changes
could add CMake plumbing to facilitate augmenting the LLVM CMake
build of libc with outside sources via overlays and cache files.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][hdrgen] Fix `includes` sorting in JSON emission (#165460)</title>
<updated>2025-10-28T20:16:20+00:00</updated>
<author>
<name>Roland McGrath</name>
<email>mcgrathr@google.com</email>
</author>
<published>2025-10-28T20:16:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=10afda0796cf543390fa5670d757b3ff7a558224'/>
<id>10afda0796cf543390fa5670d757b3ff7a558224</id>
<content type='text'>
The JSON output support in hdrgen had a bug that tripped when
used with headers that use special-case headers like &lt;stdint.h&gt;
to supply some times, as well as llvm-libc-types/*.h headers.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The JSON output support in hdrgen had a bug that tripped when
used with headers that use special-case headers like &lt;stdint.h&gt;
to supply some times, as well as llvm-libc-types/*.h headers.</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC][CI] Use Fully Qualified Names for All Containers</title>
<updated>2025-10-08T22:08:46+00:00</updated>
<author>
<name>Aiden Grossman</name>
<email>aidengrossman@google.com</email>
</author>
<published>2025-10-08T22:08:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4d2d21331bf058cf901d30a9b902008e0a8e9e20'/>
<id>4d2d21331bf058cf901d30a9b902008e0a8e9e20</id>
<content type='text'>
Fix the rest of the containers sitting around in the monorepo.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the rest of the containers sitting around in the monorepo.
</pre>
</div>
</content>
</entry>
<entry>
<title>[libc] Add -Wextra for libc tests (#153321)</title>
<updated>2025-09-22T16:56:38+00:00</updated>
<author>
<name>Vinay Deshmukh</name>
<email>vinay_deshmukh@outlook.com</email>
</author>
<published>2025-09-22T16:56:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=beb743b9823d0ea6ce2e25c8520b588db8aa2314'/>
<id>beb743b9823d0ea6ce2e25c8520b588db8aa2314</id>
<content type='text'>
RE apply https://github.com/llvm/llvm-project/pull/133643/commits#top</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
RE apply https://github.com/llvm/llvm-project/pull/133643/commits#top</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c23] Add rsqrtf16() function  (#137545)</title>
<updated>2025-09-17T14:19:20+00:00</updated>
<author>
<name>Anton Shepelev</name>
<email>44649959+amemov@users.noreply.github.com</email>
</author>
<published>2025-09-17T14:19:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=80f9c72a1e045aa012b88c1b32cc6c5bb008a3db'/>
<id>80f9c72a1e045aa012b88c1b32cc6c5bb008a3db</id>
<content type='text'>
Addresses #132818 
Part of #95250</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Addresses #132818 
Part of #95250</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Add sqrtbf16 math function (#156654)</title>
<updated>2025-09-06T09:06:02+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-09-06T09:06:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8dda18f83611803588c470be5e2c3c1203d3ae2b'/>
<id>8dda18f83611803588c470be5e2c3c1203d3ae2b</id>
<content type='text'>
This PR adds sqrtbf16 higher math function for BFloat16 type along with
the tests.

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds sqrtbf16 higher math function for BFloat16 type along with
the tests.

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c23] Implement C23 math function atanpif16 (#150400)</title>
<updated>2025-09-02T19:50:50+00:00</updated>
<author>
<name>Mohamed Emad</name>
<email>hulxxv@gmail.com</email>
</author>
<published>2025-09-02T19:50:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c1d1e0e32fcd8f457a1644a5859d23155ca666ac'/>
<id>c1d1e0e32fcd8f457a1644a5859d23155ca666ac</id>
<content type='text'>
This PR implements `atanpif16(x)` which computes
$\frac{\arctan(x)}{\pi}$ for half-precision floating-point numbers using
polynomial approximation with domain reduction.

## Mathematical Implementation

The implementation uses a 15th-degree Taylor polynomial expansion of
$\frac{\arctan(x)}{\pi}$ that's computed using
[`python-sympy`](https://www.sympy.org/en/index.html) and it's accurate
in $|x| \in [0, 0.5)$:

$$
g(x) = \frac{\arctan(x)}{\pi} \approx 
\begin{aligned}[t]
    &amp; 0.318309886183791x \\
    &amp; - 0.106103295394597x^3 \\
    &amp; + 0.0636619772367581x^5 \\
    &amp; - 0.0454728408833987x^7 \\
    &amp; + 0.0353677651315323x^9 \\
    &amp; - 0.0289372623803446x^{11} \\
    &amp; + 0.0244853758602916x^{13} \\
    &amp; - 0.0212206590789194x^{15} + O(x^{17})
\end{aligned}
$$


--- 

To ensure accuracy across all real inputs, the domain is divided into
three cases with appropriate transformations:

**Case 1: $|x| \leq 0.5$**  
Direct polynomial evaluation: 

$$\text{atanpi}(x) = \text{sign}(x) \cdot g(|x|)$$

**Case 2: $0.5 &lt; |x| \leq 1$**  
Double-angle reduction using:

$$\arctan(x) = 2\arctan\left(\frac{x}{1 + \sqrt{1 + x^2}}\right)$$

$$\text{atanpi}(x) = \text{sign}(x) \cdot 2g\left(\frac{|x|}{1 + \sqrt{1
+ x^2}}\right)$$

**Case 3: $|x| &gt; 1$**  
Reciprocal transformation using 

$$\arctan(x) = \frac{\pi}{2} - \arctan\left(\frac{1}{x}\right) \
\text{for} \ x \gt 0$$

$$\text{atanpi}(x) = \text{sign}(x) \cdot \left(\frac{1}{2} -
g\left(\frac{1}{|x|}\right)\right)$$


Closes #132212</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR implements `atanpif16(x)` which computes
$\frac{\arctan(x)}{\pi}$ for half-precision floating-point numbers using
polynomial approximation with domain reduction.

## Mathematical Implementation

The implementation uses a 15th-degree Taylor polynomial expansion of
$\frac{\arctan(x)}{\pi}$ that's computed using
[`python-sympy`](https://www.sympy.org/en/index.html) and it's accurate
in $|x| \in [0, 0.5)$:

$$
g(x) = \frac{\arctan(x)}{\pi} \approx 
\begin{aligned}[t]
    &amp; 0.318309886183791x \\
    &amp; - 0.106103295394597x^3 \\
    &amp; + 0.0636619772367581x^5 \\
    &amp; - 0.0454728408833987x^7 \\
    &amp; + 0.0353677651315323x^9 \\
    &amp; - 0.0289372623803446x^{11} \\
    &amp; + 0.0244853758602916x^{13} \\
    &amp; - 0.0212206590789194x^{15} + O(x^{17})
\end{aligned}
$$


--- 

To ensure accuracy across all real inputs, the domain is divided into
three cases with appropriate transformations:

**Case 1: $|x| \leq 0.5$**  
Direct polynomial evaluation: 

$$\text{atanpi}(x) = \text{sign}(x) \cdot g(|x|)$$

**Case 2: $0.5 &lt; |x| \leq 1$**  
Double-angle reduction using:

$$\arctan(x) = 2\arctan\left(\frac{x}{1 + \sqrt{1 + x^2}}\right)$$

$$\text{atanpi}(x) = \text{sign}(x) \cdot 2g\left(\frac{|x|}{1 + \sqrt{1
+ x^2}}\right)$$

**Case 3: $|x| &gt; 1$**  
Reciprocal transformation using 

$$\arctan(x) = \frac{\pi}{2} - \arctan\left(\frac{1}{x}\right) \
\text{for} \ x \gt 0$$

$$\text{atanpi}(x) = \text{sign}(x) \cdot \left(\frac{1}{2} -
g\left(\frac{1}{|x|}\right)\right)$$


Closes #132212</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Add {nearbyint,rint,lrint,llrint,lround,llround}bf16 math functions (#153882)</title>
<updated>2025-08-24T15:21:02+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-08-24T15:21:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=60743358d15f19b89e3ef5daa1b28e7b1bef453e'/>
<id>60743358d15f19b89e3ef5daa1b28e7b1bef453e</id>
<content type='text'>
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- nearbyintbf16
- rintbf16
- lrintbf16
- llrintbf16
- lroundbf16
- llroundbf16

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- nearbyintbf16
- rintbf16
- lrintbf16
- llrintbf16
- lroundbf16
- llroundbf16

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</pre>
</div>
</content>
</entry>
</feed>
