-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[X86] Add ABI handling for __float128 to match with GCC #75156
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 all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -target-feature +sse2 < %s | FileCheck %s --check-prefixes=CHECK | ||
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -target-feature -sse2 < %s | FileCheck %s --check-prefixes=CHECK | ||
|
||
struct st1 { | ||
__float128 a; | ||
}; | ||
|
||
struct st1 h1(__float128 a) { | ||
// CHECK: define{{.*}}fp128 @h1(fp128 | ||
struct st1 x; | ||
x.a = a; | ||
return x; | ||
} | ||
|
||
__float128 h2(struct st1 x) { | ||
// CHECK: define{{.*}}fp128 @h2(fp128 | ||
return x.a; | ||
} | ||
|
||
struct st2 { | ||
__float128 a; | ||
int b; | ||
}; | ||
|
||
struct st2 h3(__float128 a, int b) { | ||
// CHECK: define{{.*}}void @h3(ptr {{.*}}sret(%struct.st2) | ||
struct st2 x; | ||
x.a = a; | ||
x.b = b; | ||
return x; | ||
} | ||
|
||
__float128 h4(struct st2 x) { | ||
// CHECK: define{{.*}}fp128 @h4(ptr {{.*}}byval(%struct.st2) | ||
return x.a; | ||
} |
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.
Worth adding a non-SSE RUN?
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.
This patch only changes for 64-bit ABI, non-SSE is not a valid case for 64-bit.
OTOH, -sse just generate identical output with +sse2, which doesn't match with GCC https://godbolt.org/z/4nxnhnovd
I think we may need to add a semacheck for it. Do you think we should add it with this patch or a follow up?
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.
If you're dealing with it soon then handling it in a followup sounds good to me
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 decided not to report error for
-sse
after investigating the current diagnosis machinism.We didn't report the SSE error in semacheck but in backend due to backend crash.
__float128
doesn't have crash issue and can be passed on GPR registers without SSE enabled.IIUC, we prefer to be compatible with early version rather than always to GCC. So I'd like to keep the convention as is.
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.
OK - so we have test coverage for non-SSE cases already in the backend?
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.
Yes, e.g,
llvm/test/CodeGen/X86/{soft-fp,x87}.ll
, though I doubt if they can work in reality since they are calling to the same lib functions.