-
Notifications
You must be signed in to change notification settings - Fork 215
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
Use a C-safe return type for __rust_[ui]128_*
overflowing intrinsics
#735
Merged
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 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 |
---|---|---|
|
@@ -66,31 +66,39 @@ intrinsics! { | |
AddSub::add(a,b) | ||
} | ||
|
||
pub extern "C" fn __rust_i128_addo(a: i128, b: i128) -> (i128, bool) { | ||
a.addo(b) | ||
pub extern "C" fn __rust_i128_addo(a: i128, b: i128, oflow: &mut i32) -> i128 { | ||
let (add, o) = a.addo(b); | ||
*oflow = o.into(); | ||
add | ||
} | ||
|
||
pub extern "C" fn __rust_u128_add(a: u128, b: u128) -> u128 { | ||
AddSub::add(a,b) | ||
} | ||
|
||
pub extern "C" fn __rust_u128_addo(a: u128, b: u128) -> (u128, bool) { | ||
a.addo(b) | ||
pub extern "C" fn __rust_u128_addo(a: u128, b: u128, oflow: &mut i32) -> u128 { | ||
let (add, o) = a.addo(b); | ||
*oflow = o.into(); | ||
add | ||
} | ||
|
||
pub extern "C" fn __rust_i128_sub(a: i128, b: i128) -> i128 { | ||
AddSub::sub(a,b) | ||
} | ||
|
||
pub extern "C" fn __rust_i128_subo(a: i128, b: i128) -> (i128, bool) { | ||
a.subo(b) | ||
pub extern "C" fn __rust_i128_subo(a: i128, b: i128, oflow: &mut i32) -> i128 { | ||
let (sub, o) = a.subo(b); | ||
*oflow = o.into(); | ||
sub | ||
} | ||
|
||
pub extern "C" fn __rust_u128_sub(a: u128, b: u128) -> u128 { | ||
AddSub::sub(a,b) | ||
} | ||
|
||
pub extern "C" fn __rust_u128_subo(a: u128, b: u128) -> (u128, bool) { | ||
a.subo(b) | ||
pub extern "C" fn __rust_u128_subo(a: u128, b: u128, oflow: &mut i32) -> u128 { | ||
let (sub, o) = a.subo(b); | ||
*oflow = o.into(); | ||
sub | ||
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. cg_clif doesn't actually use the add/sub intrinsics, so I opened #745 to remove them. |
||
} | ||
} |
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
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.
Would you mind keeping the existing functions for a bit and adding new functions with the new ABI? That way the cg_clif update and the compiler-builtins update don't have to be done at the exact same time.
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 can do so if it helps, but why would this be needed? We pin the version of
compiler_builtins
with=
now so it shouldn't get out of sync, and I won't merge this until the r-l/rust PR gets approved.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.
In that case I guess it is fine to keep as-is.