Skip to content
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

wasm: Mark simd intrinsics as stable #1179

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

alexcrichton
Copy link
Member

This is a follow-up from rust-lang/rust#74372 which has finished FCP for
the stabilization of wasm intrinsics. This marks them all stable, as-is
and additionally marks the functions which create integer vectors as
const-stable as well. The only remaining unstable bits are that
f32x4 and f64x2 are const-unstable. Mostly just because I couldn't
figure out how to make them const-stable.

@rust-highfive
Copy link

r? @Amanieu

(rust-highfive has picked a reviewer for you, use r? to override)

This is a follow-up from rust-lang/rust#74372 which has finished FCP for
the stabilization of wasm intrinsics. This marks them all stable, as-is
and additionally marks the functions which create integer vectors as
`const`-stable as well. The only remaining unstable bits are that
`f32x4` and `f64x2` are `const`-unstable. Mostly just because I couldn't
figure out how to make them `const`-stable.
@Amanieu
Copy link
Member

Amanieu commented Jun 10, 2021

What is the problem with const f32x4/f64x2 and what does it have to do with rust-lang/rust#73288?

@alexcrichton
Copy link
Member Author

Attempting to const-stabilize them as-is yields:

error: `simd128::<impl simd::f32x4>::v128` is not yet stable as a const fn
   --> crates/core_arch/src/wasm32/simd128.rs:723:5
    |
723 |     simd::f32x4(a0, a1, a2, a3).v128()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: Const-stable functions can only call other const-stable functions

Attempting to const-stabilize the v128 helper yields:

error: const-stable function cannot use `#[feature(const_fn_transmute)]`
  --> crates/core_arch/src/wasm32/simd128.rs:59:30
   |
59 |                       unsafe { mem::transmute(self) }
   |                                ^^^^^^^^^^^^^^^^^^^^

Basically since v128 is a i32x4 under the hood, I don't think there's a const-stable way in Rust to convert from a float to an integer using a bitcast at compile time.

I was trying to follow the same reasons as this unstable annotation but it appears I got the issues mixed up. The issue that points to is rust-lang/rust#72447. I'll update the links here to point to that issue.

@Amanieu Amanieu merged commit 1e05dff into rust-lang:master Jun 10, 2021
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jun 11, 2021
This commit performs two changes to stabilize Rust support for
WebAssembly simd intrinsics:

* The stdarch submodule is updated to pull in rust-lang/stdarch#1179.
* The `wasm_target_feature` feature gate requirement for the `simd128`
  feature has been removed, stabilizing the name `simd128`.

This should conclude the FCP started on rust-lang#74372 and...

Closes rust-lang#74372
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 11, 2021
std: Stabilize wasm simd intrinsics

This commit performs two changes to stabilize Rust support for
WebAssembly simd intrinsics:

* The stdarch submodule is updated to pull in rust-lang/stdarch#1179.
* The `wasm_target_feature` feature gate requirement for the `simd128`
  feature has been removed, stabilizing the name `simd128`.

This should conclude the FCP started on rust-lang#74372 and...

Closes rust-lang#74372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants