Skip to content

Add signed division functions #44

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 2 commits into from
Aug 19, 2016
Merged

Add signed division functions #44

merged 2 commits into from
Aug 19, 2016

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Aug 18, 2016

No description provided.

@Amanieu Amanieu force-pushed the sdiv branch 3 times, most recently from 5382cf5 to aa2561a Compare August 18, 2016 23:47
@@ -30,6 +30,43 @@ pub unsafe fn __aeabi_uldivmod() {
intrinsics::unreachable();
}

#[naked]
#[cfg_attr(not(test), no_mangle)]
pub unsafe fn __aeabi_idivmod() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add a test for this assembly routine (and the one below)? Just to check its expected signature (fn(u32, u32) -> (u32,u32) in this case, I think) works as expected?

@japaric
Copy link
Member

japaric commented Aug 19, 2016

I thought the aeabi intrinsics could have been tested by calling let (q, r) = __aeabi_uldivmod(n, d) in the test function (instead of the current asm! block) but I guess is not possible because of the custom calling convention these intrinsics use?

@Amanieu
Copy link
Member Author

Amanieu commented Aug 19, 2016

Yea, you need asm to call them with the custom convention.

}

macro_rules! divmod {
($intrinsic:ident, $div:ident: $ty:ty, $uty:ty) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$uty is not used in this macro?

@japaric
Copy link
Member

japaric commented Aug 19, 2016

Yea, you need asm to call them with the custom convention.

OK. Thanks for clarifying.

I left some comments about nits. r=me after those are addressed.

@Amanieu Amanieu force-pushed the sdiv branch 2 times, most recently from ca354ff to 95d3b84 Compare August 19, 2016 11:12
@japaric japaric merged commit 8603e64 into rust-lang:master Aug 19, 2016
@japaric
Copy link
Member

japaric commented Aug 19, 2016

Thanks @Amanieu!

tgross35 pushed a commit to tgross35/compiler-builtins that referenced this pull request Feb 23, 2025
108: coshf tanhf and atan2f r=japaric a=burrbull

closes rust-lang#44
closes rust-lang#52
closes rust-lang#41

Co-authored-by: Andrey Zgarbul <[email protected]>
Co-authored-by: Zgarbul Andrey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants