-
Notifications
You must be signed in to change notification settings - Fork 273
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
Add numeric instructions for Wasm not available in core
#1677
base: master
Are you sure you want to change the base?
Conversation
ee6b75e
to
9f1540f
Compare
Oh nice! Seems reasonable to me :) I thought I had also seen some chatter on the Rust Zulip about making more floating-point methods available in libcore, so it might be good to sync up on that perhaps? I think it might also be best to start these out as unstable and then perhaps quickly follow up with a stabilization request with the rationale outlined? For code changes, perhaps the documentation of one of these functions could explain why it's available as an intrinsic and why you might not want to use it most of the time (e.g. the float methods all do the same thing). Other methods could then all link to that one instance of the documentation to avoid duplicating everything here. |
5c27494
to
59bf920
Compare
Couldn't find anything related on the quick, would appreciate a link if you have it on hand.
Sounds good, marked as unstable.
I just added a one-liner to each function and linked to the appropriate method in |
Took some digging as I also forgot, but I found:
I don't think that should hold this up personally though, but probably is worth considering for stabilization |
Ah, thanks. I was already aware of those and left a note in the OP. |
59bf920
to
508fbcd
Compare
508fbcd
to
2b8eb66
Compare
CI seems to be unblocked again. |
This seems fine to add on nightly, but I wouldn't expect these to be actually stabilized: I would much prefer if we could have this functionality work directly on floats, even with If you still think this is worth it, please create a tracking issue and add the number the unstable attributes. |
The recently added
wasm32v1-none
target comes withoutstd
. This has caused somef32
andf64
methods to not be available for this target:f32/f64::ceil()
f32/f64::floor()
f32/f64::trunc()
andf32/f64::fract()
f32/f64::round_ties_even()
f32/f64::sqrt()
However, all these methods are available in Wasm via instructions that are part of Wasm v1. This PR exposes these methods as platform specific intrinsics.
It should be noted that there is a tracking issue (rust-lang/rust#50145) for bringing
f32/f64::sqrt()
tocore
, which would make adding this instruction obsolete.I also made these functions insta-stable, is that alright? Should I make an ACP first? I'm also targetting v1.84, the release of the new
wasm32v1-none
target. Considering that the fork date is the 22nd, its unlikely this will make it in time.Cc @alexcrichton.