-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[libc] Fix generated float128 header for aarch64 target. #78017
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
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4690a6c
[libc] Fix generated float128 header for aarch64 target.
lntue 7e476e0
Fix formatting.
lntue e30b666
Sync and consolidate float128 type logic in one place.
lntue 1014ffb
Add missing dependency and fix __copied_hdr__ target issues.
lntue a7773b3
Add TODO to update float128 type detection macros.
lntue 0c53bce
Simplify float128 type detection macros.
lntue 503687a
Fix ifdef.
lntue 76aedc8
Exclude clang from using C23 _Float128 type.
lntue b66c904
Update float128 detection macros.
lntue 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
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
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,31 @@ | ||
| //===-- Definition of float128 type ---------------------------------------===// | ||
| // | ||
| // 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef __LLVM_LIBC_TYPES_FLOAT128_H__ | ||
| #define __LLVM_LIBC_TYPES_FLOAT128_H__ | ||
|
|
||
| #include <include/llvm-libc-macros/float-macros.h> // LDBL_MANT_DIG | ||
|
|
||
| // TODO: https://github.com/llvm/llvm-project/issues/80195 | ||
| // Check _Float128 C23 type detection again when clang supports it. | ||
| #if defined(__STDC_IEC_60559_BFP__) && !defined(__clang__) | ||
| // Use _Float128 C23 type. | ||
| #define LIBC_COMPILER_HAS_C23_FLOAT128 | ||
| typedef _Float128 float128; | ||
| #elif defined(__FLOAT128__) | ||
| // Use __float128 type. | ||
| // clang uses __FLOAT128__ macro to notify the availability of __float128 type: | ||
| // https://reviews.llvm.org/D15120 | ||
| #define LIBC_COMPILER_HAS_FLOAT128_EXTENSION | ||
| typedef __float128 float128; | ||
| #elif (LDBL_MANT_DIG == 113) | ||
| // Use long double. | ||
| typedef long double float128; | ||
| #endif | ||
|
|
||
| #endif // __LLVM_LIBC_TYPES_FLOAT128_H__ | ||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, sorry for causing confusion here, but I do think we'll benefit in the long run by documenting the state of the world.
So some issues we've found:
_Float128in C mode until gcc-7, and C++ mode until gcc-13.__STDC_IEC_60559_BFP__to201404Lso we cannot compare__STDC_IEC_60559_BFP__to202311L(at least doing so won't work for any compiler TODAY). Just having this one check would be ideal, but alas._Float128.__STDC_IEC_60559_BFP__to201404L, so we can't use it to detect compiler support in overlay mode (or not without great pain).So perhaps we can have:
I was hopefully naive that we could just have:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me summarize the current support in the following table:
So far the cleanest check I found without relying on compiler versioning or target architecture is follow:
with comments / TODO to revisit the conditions in the future when clang has support for
_Float128.WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM; we'll hopefully be revisiting this block of preprocessor checks when compilers improve their support. Let's get the build back to green.