-
Notifications
You must be signed in to change notification settings - Fork 18.1k
[compiler-rt][builtins] introduce libc math routines #197950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hulxv
merged 8 commits into
llvm:main
from
hulxv:compiler_rt/builtins/init-libc-integration-project
Jul 2, 2026
+72
−0
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1277b1c
[compiler-rt][builtins] introduce libc math routines
hulxv 18d62c3
[CI] Add precommit CIs to test compiler-rt + LLVM libc integration.
hulxv 099fa9f
allow all branches
hulxv 34db9e6
remove `--privileged`` option
hulxv 276ea60
remove shell option
hulxv 31501d8
Merge branch 'ci/compiler-rt-libc-builtins-tests' into compiler_rt/bu…
hulxv cbd2016
Merge branch 'main' into compiler_rt/builtins/init-libc-integration-p…
hulxv 911af80
Split "[CI] Add precommit CIs to test compiler-rt + LLVM libc integra…
hulxv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- lib/addtf3.cpp - Quad-precision addition (libc-backed) --*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // __addtf3 implemented on top of LLVM-libc's shared::addtf3 instruction. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #define QUAD_PRECISION | ||
| #include "fp_lib.h" | ||
|
|
||
| #include "fp_libc_config.h" | ||
| #include "int_lib.h" | ||
| #include "shared/builtins/addtf3.h" | ||
|
|
||
| extern "C" COMPILER_RT_ABI fp_t __addtf3(fp_t a, fp_t b) { | ||
| return LIBC_NAMESPACE::shared::addtf3(a, b); | ||
|
hulxv marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| //===-- lib/fp_libc_config.h - LLVM-libc compile config --------*- C -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Compile-time configuration consumed by LLVM-libc's fputil headers when they | ||
| // are included from compiler-rt builtins under COMPILER_RT_USE_LIBC_MATH. | ||
| // Pins the libc namespace to __llvm_libc_rt to avoid clashing with libc's own | ||
| // symbols, and disables errno / FP-exception bookkeeping inside libc routines | ||
| // called from builtins. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef FP_LIBC_CONFIG_H | ||
|
hulxv marked this conversation as resolved.
|
||
| #define FP_LIBC_CONFIG_H | ||
|
|
||
| #ifndef LIBC_NAMESPACE | ||
| #define LIBC_NAMESPACE __llvm_libc_rt | ||
| #endif | ||
|
|
||
|
hulxv marked this conversation as resolved.
|
||
| #define LIBC_MATH (LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT) | ||
|
|
||
| #endif // FP_LIBC_CONFIG_H | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.