-
Notifications
You must be signed in to change notification settings - Fork 236
Implement {add,sub,mul,neg,div} vfp #153
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
Conversation
Why do these need to be implemented in assembly? |
@parched I think there are two questions here:
I'm not sure. LLVM should be capable of just emitting the instructions, surely?
If LLVM lowers float operations to these functions, that using Rust to implement them would cause an infinite loop because the functions would end up calling themselves. Also, these functions have a special calling convention so they can't be implemented in Rust, if the comment at the top of this file is to be believed. The compiler-rt comments mention a "Darwin calling convention" which is presumably different than aapcs otherwise we'd just use that. I think both points can be attributed to "Apple weirdness." At the end of the day, we need these to be defined otherwise things don't compile and that's good enough for me. |
Yeah, I bet it probably does in release mode but this has be written to always work so you a right, it needs to be in assembly. It could be worth adding a note, these are written in assembly not Rust to avoid infinite recursion.
That is strange because they are just using AAPCS or AAPCS_VFP depending on whether it's hard float or not. It also says arg passing only using general purpose registers but it clearly isn't for hard float |
I think that these builtins are only used when generating Thumb1 code (pre-ARMv6). Before ARMv6, Thumb code can't encode floating-point instructions and the compiler must therefore emit a call to an external function (which uses the ARM encoding instead of Thumb) instead. |
Some googling seems to corroborate @Amanieu's idea, so I'll add a comment about that. |
Interesting, so these might fail to build on the target that needs them.
What target have you found that needs them? Do they build correctly for it? |
Most (all?) ARM code has thumb code mixed in. EABI in particular requires function-level granularity between thumb and ARM code.
I was hoping that travis would answer this question since I borked my linux partition, but nightly cargo broke travis. So I set up a VM to test and it turns out there are two issues:
I guess it's time to split up the arm module so we don't end up in |
I'm going to close this PR for now. I want to rethink the way we build ARM stuff to be split with more granularity based on target features. That's the tough part, porting the intrinsics is little more than copy-paste. Thanks @parched, your questions helped me get to this conclusion faster than I would have otherwise. |
Fixed uint overflow in floorf for negative exponents
No description provided.