Skip to content

Commit

Permalink
wasm32: Add relaxed simd instructions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexcrichton authored and Amanieu committed Mar 19, 2023
1 parent 4b0258b commit b162158
Show file tree
Hide file tree
Showing 5 changed files with 458 additions and 7 deletions.
7 changes: 3 additions & 4 deletions ci/docker/wasm32-wasi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
xz-utils \
clang

RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v0.29.0/wasmtime-v0.29.0-x86_64-linux.tar.xz | tar xJf -
ENV PATH=$PATH:/wasmtime-v0.29.0-x86_64-linux
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-$(arch)-linux.tar.xz | tar xJf -
ENV PATH=$PATH:/wasmtime-dev-$(arch)-linux

ENV CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime \
--enable-simd \
--enable-threads \
--wasm-features=threads,relaxed-simd \
--mapdir .::/checkout/target/wasm32-wasi/release/deps \
--"
3 changes: 3 additions & 0 deletions crates/core_arch/src/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub use self::atomic::*;
mod simd128;
pub use self::simd128::*;

mod relaxed_simd;
pub use self::relaxed_simd::*;

mod memory;
pub use self::memory::*;

Expand Down
Loading

0 comments on commit b162158

Please sign in to comment.