-
Notifications
You must be signed in to change notification settings - Fork 275
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: Add relaxed simd instructions #1393
Conversation
r? @Amanieu (rustbot has picked a reviewer for you, use r? to override) |
This commit adds intrinsics to the `wasm32` to support the [relaxed SIMD proposal][proposal]. These are added with the same naming conventions of existing simd-related intrinsics for wasm which is similar to the instruction name but matches sign in a few places. This additionally updates Wasmtime to execute tests with support for the relaxed simd proposal. No release has been made yet so this uses the `dev` release, and I can make a PR in April when the support in Wasmtime has been released to an official release. The `wasmprinter` crate is also updated to understand these instruction opcodes as well. Documentation has been added for all intrinsics, but tests have only been added for some of them so far. I hope to follow-up later with more tests. [proposal]: https://github.com/WebAssembly/relaxed-simd
36f188b
to
41b2aad
Compare
#[cfg_attr(test, assert_instr(f64x2.relaxed_madd))] | ||
#[target_feature(enable = "relaxed-simd")] | ||
#[doc(alias("f64x2.relaxed_madd"))] | ||
pub fn f64x2_relaxed_madd(a: v128, b: v128, c: v128) -> v128 { |
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.
std
calls this mul_add, would it make sense to adopt the same naming convention here? (If not, maybe as an alias?)
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.
We already deviate from the name of the instructions themselves so I think it's reasonable to have a different name here, especially because the doc aliases cover folks searching for the instruction itself.
Looking for prior inspiration, it appears that clang
doesn't actually have support for relaxed simd instructions in the public wasm_simd128.h
header. There is a __builtin_wasm_relaxed_madd_f32x4
intrinsic but I believe that's intended to be clang-specific and not used as a public interface. In that sense no inspiration to draw from.
I'd be a bit worried about the mouthful of f64x2_relaxed_neg_mul_add
but I don't mind changing these to that. Also happy to defer to a later date and track this as part of a tracking issue.
ping @Amanieu, would you have a chance to look at this? I'd prefer to defer the naming question to a tracking issue for stabilization myself, but I can of course rename here-and-now too. |
LGTM. I'm a bit uncomfortable depending on a dev version of wasmtime in CI, but it's fine for now as long as this is updated when a new version of wasmtime is released. |
…wiser Stabilize Wasm relaxed SIMD This PR stabilizes [Wasm relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) which has already reached [phase 4](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180?tab=readme-ov-file#phase-4---standardize-the-feature-wg). Tracking issue: rust-lang#111196 Implementation PR: rust-lang/stdarch#1393 Documentation: rust-lang/reference#1421 Stdarch: rust-lang/stdarch#1494 Closes rust-lang#111196.
…crichton Stabilize Wasm relaxed SIMD This PR stabilizes [Wasm relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) which has already reached [phase 4](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180?tab=readme-ov-file#phase-4---standardize-the-feature-wg). Tracking issue: rust-lang#111196 Implementation PR: rust-lang/stdarch#1393 Documentation: rust-lang/reference#1421 Stdarch: rust-lang/stdarch#1494 Closes rust-lang#111196.
…ichton Stabilize Wasm relaxed SIMD This PR stabilizes [Wasm relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) which has already reached [phase 4](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180?tab=readme-ov-file#phase-4---standardize-the-feature-wg). Tracking issue: rust-lang#111196 Implementation PR: rust-lang/stdarch#1393 Documentation: rust-lang/reference#1421 Stdarch: rust-lang/stdarch#1494 Closes rust-lang#111196.
Stabilize Wasm relaxed SIMD This PR stabilizes [Wasm relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) which has already reached [phase 4](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180?tab=readme-ov-file#phase-4---standardize-the-feature-wg). Tracking issue: #111196 Implementation PR: rust-lang/stdarch#1393 Documentation: rust-lang/reference#1421 Stdarch: rust-lang/stdarch#1494 Closes #111196.
This commit adds intrinsics to the
wasm32
to support the relaxed SIMD proposal. These are added with the same naming conventions of existing simd-related intrinsics for wasm which is similar to the instruction name but matches sign in a few places.This additionally updates Wasmtime to execute tests with support for the relaxed simd proposal. No release has been made yet so this uses the
dev
release, and I can make a PR in April when the support in Wasmtime has been released to an official release. Thewasmprinter
crate is also updated to understand these instruction opcodes as well.Documentation has been added for all intrinsics, but tests have only been added for some of them so far. I hope to follow-up later with more tests.