-
Notifications
You must be signed in to change notification settings - Fork 100
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
wasm32 and aarch64 intrinsics for rint and rintf #430
Conversation
8c1cadc
to
4543883
Compare
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.
For the record: there's a bunch of other libm functions that could be added here (sqrt, fma, probably floor/ceil/trunc as well) but I won't have time to work on 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.
Eventually I will probably attempt to script together the operations from https://github.com/kraj/musl/tree/eb4309b142bb7a8bdc839ef1faf18811b9ff31c8/src/math/aarch64 (and the other architectures), most of the rounding-related ops are covered there. But yeah, it isn't a priority for the time being.
Thanks for jumping on this, the wasm changes look good to me. For aarch64, is there any reason not to just use assembly to get the non-vector version? For reference https://github.com/kraj/musl/blob/eb4309b142bb7a8bdc839ef1faf18811b9ff31c8/src/math/aarch64/rint.c |
Also just as a note, wasm checks the build but doesn't actually run any tests. I am not sure of a good way to do so, but am open to ideas if you have any. |
I don't think there's any fundamental obstacle (I though MSRV might be a problem but apparently not), I just don't fully trust myself to write that inline asm correctly and the only cost from using the vector variant is an extra vdup, which is very cheap. (I don't think the scalar vs. vector form makes any difference for the performance of rounding operation itself, at least as long as you stick to 64 bit vectors.)
You can run |
For anything where MSRV would be a problem, I have just been gating things under
I do need to document this better but the only tests enabled by default are a handful of spotchecks, it needs the Thanks for the additions here! |
For what it's worth, wasi-libc uses a lightly modified musl for its libm and is used by Rust's wasm32-wasip1 target as part of |
I didn't bother with x86 because SSE4.1-exclusive code paths are extra testing burden that's unlikely to benefit many people.
Closes #421