-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Match LLVM ABI in extern "C"
functions for f128
on Windows
#128388
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
bors
merged 1 commit into
rust-lang:master
from
beetrees:f16-f128-slightly-improve-windows-abi
Jul 31, 2024
Merged
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 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,39 @@ | ||
//@ assembly-output: emit-asm | ||
//@ compile-flags: -O | ||
//@ only-windows | ||
//@ only-x86_64 | ||
|
||
#![feature(f16, f128)] | ||
#![crate_type = "lib"] | ||
|
||
// CHECK-LABEL: second_f16 | ||
// CHECK: movaps %xmm1, %xmm0 | ||
// CHECK-NEXT: retq | ||
#[no_mangle] | ||
pub extern "C" fn second_f16(_: f16, x: f16) -> f16 { | ||
x | ||
} | ||
|
||
// CHECK-LABEL: second_f32 | ||
// CHECK: movaps %xmm1, %xmm0 | ||
// CHECK-NEXT: retq | ||
#[no_mangle] | ||
pub extern "C" fn second_f32(_: f32, x: f32) -> f32 { | ||
x | ||
} | ||
|
||
// CHECK-LABEL: second_f64 | ||
// CHECK: movaps %xmm1, %xmm0 | ||
// CHECK-NEXT: retq | ||
#[no_mangle] | ||
pub extern "C" fn second_f64(_: f64, x: f64) -> f64 { | ||
x | ||
} | ||
|
||
// CHECK-LABEL: second_f128 | ||
// CHECK: movaps %xmm1, %xmm0 | ||
// CHECK-NEXT: retq | ||
#[no_mangle] | ||
pub extern "C" fn second_f128(_: f128, x: f128) -> f128 { | ||
x | ||
} |
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.
Is the ABI bug not present on 32-bit x86, i.e.
x86
tests onwindows
would pass if symbols were available?(Unfortunately the symbols aren't yet available even with the builtins update, #128358)
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.
Also you can add a couple
try-job: <ci job name>
s to the bottom of the PR for any jobs that should be run as a test.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.
On 32-bit x86 Windows
f16
is passed on the stack and returned in XMM registers andf128
is passed on the stack and returned indirectly. Both LLVM and GCC use this ABI, which is the same as the ABI used on other operating systems.I've added some
try-job
s to the PR description.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.
Great, thanks for confirming. That should be testable once builtins is working then.