-
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
Implement comparesf2/comparedf2 intrinsics #222
Conversation
E.g. take a look at the assembly output for: pub fn comparesf2(a: f32, b: f32) -> bool { a > b } pub fn comparedf2(a: f64, b: f64) -> bool { a > b } which will include calls to __gtsf2 and __gtdf2.
Thanks! Could at least one test be written? Exercising at least a few of the code paths? Additionally can you gist the error that cargo test has on nightly? Finally, should these return |
Oh and also, do we compile the C version of these intrinsics? If so, can those files be removed from compilation? |
The CI error is an ICE:
The error on nightly (
|
Note that this changes semantics: pub extern "C" fn __eqsf2(a: f32, b: f32) -> bool { cmp(a, b).to_le_abi() != 0 } is not the same as pub extern "C" fn __eqsf2(a: f32, b: f32) -> i32 { cmp(a, b).to_le_abi() } However, compiler-rt does the latter, so this is actually an improvement.
Good catch, this is actually a divergence from compiler-rt's ABI, since the values are different too (consider the -1 case). I don't think it actually matters but it is a good thing to stay consistent.
Done. |
There's also another test failure I get when running locally, if I comment out the
|
Ok it looks like the quickcheck style tests only run on |
Excellent catch! There actually was a bug related to signedness handling. I've added tests (not for |
Thanks! Looks like the failure on arm is relevant? |
Fixed |
build.rs
Outdated
@@ -5127,8 +5443,6 @@ mod c { | |||
"arm/bswapsi2.S", | |||
"arm/clzdi2.S", | |||
"arm/clzsi2.S", | |||
"arm/comparesf2.S", | |||
"arm/divmodsi4.S", |
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.
Was this deletion accidental perhaps? (or is the assembly weird like that?)
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.
Oh, oops.
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.
Fixed.
@bors: r+ |
📌 Commit 205322b has been approved by |
Implement comparesf2/comparedf2 intrinsics These intrinsics are indeed called on soft-float targets, you can verify this by compiling: ```rust #![no_std] fn comparesf2(a: f32, b: f32) -> bool { a > b } fn comparedf2(a: f64, b: f64) -> bool { a > b } ``` and looking at the disassembly. Doesn't come with tests because I'm not about to write *fourteen* of these horrifying build.rs structs by hand, and also because `cargo test` fails on latest nightly.
💥 Test timed out |
@bors: retry |
Implement comparesf2/comparedf2 intrinsics These intrinsics are indeed called on soft-float targets, you can verify this by compiling: ```rust #![no_std] fn comparesf2(a: f32, b: f32) -> bool { a > b } fn comparedf2(a: f64, b: f64) -> bool { a > b } ``` and looking at the disassembly. Doesn't come with tests because I'm not about to write *fourteen* of these horrifying build.rs structs by hand, and also because `cargo test` fails on latest nightly.
💔 Test failed - status-travis |
Ah right haven't fixed that yet... |
@whitequark mind helping diagnosing a few issues I think are with this PR? I believe this PR is the cause of this failure, notably on ARM Android we're getting a number of weird floating point results. I tried to correct what I thought were some typos, namely defining our own aeabi aliases (not using compiler-rt's) and fixing the arugments on Do you know what's going on here? Do you know if there's an ABI mismatch perhaps with how floats are being passed? Have you tested this locally for the target you're working with? |
Yes, for OR1K, it's out-of-tree.
Maybe the arguments are swapped? Just like for __aeabi_memcpy and friends. |
Hm ok, it looks like the __aeabi ABI is slightly different not with arguments but at least with return value, I'm testing that out to see if it resolves the problems I found. I still think though that |
Yes, that's obviously correct. |
These intrinsics are indeed called on soft-float targets, you can verify this by compiling:
and looking at the disassembly.
Doesn't come with tests because I'm not about to write fourteen of these horrifying build.rs structs by hand, and also because
cargo test
fails on latest nightly.