forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 1
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
[DFP] Initial changes to supprt DFP under APFloat and parse declarations #41
Open
shafik
wants to merge
1
commit into
main
Choose a base branch
from
shafik_dfp_dfpfloat_dfptypes_dfpast
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -2238,12 +2238,19 @@ bool Type::hasUnsignedIntegerRepresentation() const { | |
bool Type::isFloatingType() const { | ||
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) | ||
return BT->getKind() >= BuiltinType::Half && | ||
BT->getKind() <= BuiltinType::Ibm128; | ||
BT->getKind() <= BuiltinType::DecimalFloatDPD128; | ||
if (const auto *CT = dyn_cast<ComplexType>(CanonicalType)) | ||
return CT->getElementType()->isFloatingType(); | ||
return false; | ||
} | ||
|
||
bool Type::isDecimalFloatType() const { | ||
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we call this function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function already exists in the |
||
return BT->getKind() >= BuiltinType::DecimalFloatBID32 && | ||
BT->getKind() <= BuiltinType::DecimalFloatDPD128; | ||
return false; | ||
} | ||
|
||
bool Type::hasFloatingRepresentation() const { | ||
if (const auto *VT = dyn_cast<VectorType>(CanonicalType)) | ||
return VT->getElementType()->isFloatingType(); | ||
|
@@ -2270,7 +2277,7 @@ bool Type::isRealType() const { | |
bool Type::isArithmeticType() const { | ||
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) | ||
return BT->getKind() >= BuiltinType::Bool && | ||
BT->getKind() <= BuiltinType::Ibm128; | ||
BT->getKind() <= BuiltinType::DecimalFloatDPD128; | ||
if (const auto *ET = dyn_cast<EnumType>(CanonicalType)) | ||
// GCC allows forward declaration of enum types (forbid by C99 6.7.2.3p2). | ||
// If a body isn't seen by the time we get here, return false. | ||
|
@@ -3379,6 +3386,15 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const { | |
return "__float128"; | ||
case Ibm128: | ||
return "__ibm128"; | ||
case DecimalFloatBID32: | ||
case DecimalFloatDPD32: | ||
return "_Decimal32"; | ||
case DecimalFloatBID64: | ||
case DecimalFloatDPD64: | ||
return "_Decimal64"; | ||
case DecimalFloatBID128: | ||
case DecimalFloatDPD128: | ||
return "_Decimal128"; | ||
case WChar_S: | ||
case WChar_U: | ||
return Policy.MSWChar ? "__wchar_t" : "wchar_t"; | ||
|
This file contains 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 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 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,9 @@ | ||
// RUN: %clang_cc1 -x c -ast-dump %s | FileCheck %s --strict-whitespace | ||
|
||
_Decimal32 x; | ||
_Decimal64 y; | ||
_Decimal128 z; | ||
|
||
//CHECK: |-VarDecl {{.*}} x '_Decimal32' | ||
//CHECK-NEXT: |-VarDecl {{.*}} y '_Decimal64' | ||
//CHECK-NEXT: `-VarDecl {{.*}} z '_Decimal128' |
This file contains 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
Oops, something went wrong.
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.
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.
For consistency shouldn't we have
DecimalFloatBID32Ty, DecimalFloatBID64Ty and DecimalFloatBID64Ty
?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.
I think we should only have
DecimalFloat32/64/128Ty
with no prefix and differentiate the decoding via thefltSematics
. 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.
I agree with @zahiraam; there should be just one set of types with behavior differentiated based on semantics.
These types are already present in the
dfp
branch.