Skip to content

Commit 9100b8d

Browse files
committed
Update WebAssembly SIMD/Atomics
This commit syncs the atomics/simd intrinsics used on WebAssembly with LLVM 12 and the current specifications. LLVM 12 uses new names for atomic intrinsics and the SIMD specification has added a lot of intrinsics and renamed a few as well. I was hoping to hold off on this until more of SIMD had landed since there are some opcode renumberings that have happened at the spec level but haven't happened in LLVM. Additionally there's a small handful of instructions that have yet to be implemented in LLVM. This means that many tests for the simd128 feature are ignored right now and/or are known to not pass. The breakage in the name of the atomic intrinsics, however, has prompted me to want to update this and land ahead of time. For now I've disabled the SIMD testing and I'll get back to it once things have settled a bit more with LLVM and runtimes.
1 parent cee53b6 commit 9100b8d

File tree

7 files changed

+1232
-422
lines changed

7 files changed

+1232
-422
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- mips64-unknown-linux-gnuabi64
7878
- mips64el-unknown-linux-gnuabi64
7979
- s390x-unknown-linux-gnu
80-
# - wasm32-wasi
80+
- wasm32-wasi
8181
- i586-unknown-linux-gnu
8282
- x86_64-linux-android
8383
- arm-linux-androideabi
@@ -131,8 +131,8 @@ jobs:
131131
disable_assert_instr: true
132132
- target: s390x-unknown-linux-gnu
133133
os: ubuntu-latest
134-
# - target: wasm32-wasi
135-
# os: ubuntu-latest
134+
- target: wasm32-wasi
135+
os: ubuntu-latest
136136
- target: aarch64-apple-darwin
137137
os: macos-latest
138138
norun: true

ci/docker/wasm32-wasi/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
77
xz-utils \
88
clang
99

10-
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v0.22.1/wasmtime-v0.22.1-x86_64-linux.tar.xz | tar xJf -
11-
ENV PATH=$PATH:/wasmtime-v0.22.1-x86_64-linux
10+
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v0.24.0/wasmtime-v0.24.0-x86_64-linux.tar.xz | tar xJf -
11+
ENV PATH=$PATH:/wasmtime-v0.24.0-x86_64-linux
1212

1313
ENV CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime \
1414
--enable-simd \

ci/run.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ case ${TARGET} in
8888
cargo_test "--release"
8989
;;
9090
wasm32*)
91-
prev="$RUSTFLAGS"
92-
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
93-
cargo_test "--release"
94-
export RUSTFLAGS="$prev"
91+
# TODO: need to re-enable simd testing for wasm32
92+
# TODO: should enable atomics testing for wasm32
93+
# prev="$RUSTFLAGS"
94+
# export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
95+
# cargo_test "--release"
96+
# export RUSTFLAGS="$prev"
9597
;;
9698
# FIXME: don't build anymore
9799
#mips-*gnu* | mipsel-*gnu*)

crates/core_arch/build.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
use std::env;
2-
31
fn main() {
42
println!("cargo:rustc-cfg=core_arch_docs");
5-
6-
// Used to tell our `#[assert_instr]` annotations that all simd intrinsics
7-
// are available to test their codegen, since some are gated behind an extra
8-
// `-Ctarget-feature=+unimplemented-simd128` that doesn't have any
9-
// equivalent in `#[target_feature]` right now.
10-
println!("cargo:rerun-if-env-changed=RUSTFLAGS");
11-
if env::var("RUSTFLAGS")
12-
.unwrap_or_default()
13-
.contains("unimplemented-simd128")
14-
{
15-
println!("cargo:rustc-cfg=all_simd");
16-
}
173
}

crates/core_arch/src/wasm32/atomic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
use stdarch_test::assert_instr;
1313

1414
extern "C" {
15-
#[link_name = "llvm.wasm.atomic.wait.i32"]
15+
#[link_name = "llvm.wasm.memory.atomic.wait.i32"]
1616
fn llvm_atomic_wait_i32(ptr: *mut i32, exp: i32, timeout: i64) -> i32;
17-
#[link_name = "llvm.wasm.atomic.wait.i64"]
17+
#[link_name = "llvm.wasm.memory.atomic.wait.i64"]
1818
fn llvm_atomic_wait_i64(ptr: *mut i64, exp: i64, timeout: i64) -> i32;
19-
#[link_name = "llvm.wasm.atomic.notify"]
19+
#[link_name = "llvm.wasm.memory.atomic.notify"]
2020
fn llvm_atomic_notify(ptr: *mut i32, cnt: i32) -> i32;
2121
}
2222

0 commit comments

Comments
 (0)