Update WebAssembly SIMD/Atomics (#1073)

This commit is contained in:
Alex Crichton
2021-03-11 17:30:30 -06:00
committed by GitHub
parent 7af3c0af25
commit e35da555f8
8 changed files with 1235 additions and 425 deletions

View File

@@ -77,7 +77,7 @@ jobs:
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- s390x-unknown-linux-gnu
# - wasm32-wasi
- wasm32-wasi
- i586-unknown-linux-gnu
- x86_64-linux-android
- arm-linux-androideabi
@@ -131,8 +131,8 @@ jobs:
disable_assert_instr: true
- target: s390x-unknown-linux-gnu
os: ubuntu-latest
# - target: wasm32-wasi
# os: ubuntu-latest
- target: wasm32-wasi
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
norun: true

View File

@@ -7,8 +7,8 @@ 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.22.1/wasmtime-v0.22.1-x86_64-linux.tar.xz | tar xJf -
ENV PATH=$PATH:/wasmtime-v0.22.1-x86_64-linux
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v0.24.0/wasmtime-v0.24.0-x86_64-linux.tar.xz | tar xJf -
ENV PATH=$PATH:/wasmtime-v0.24.0-x86_64-linux
ENV CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime \
--enable-simd \

View File

@@ -88,10 +88,12 @@ case ${TARGET} in
cargo_test "--release"
;;
wasm32*)
prev="$RUSTFLAGS"
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
cargo_test "--release"
export RUSTFLAGS="$prev"
# TODO: need to re-enable simd testing for wasm32
# TODO: should enable atomics testing for wasm32
# prev="$RUSTFLAGS"
# export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128,+unimplemented-simd128"
# cargo_test "--release"
# export RUSTFLAGS="$prev"
;;
# FIXME: don't build anymore
#mips-*gnu* | mipsel-*gnu*)

View File

@@ -1,17 +1,3 @@
use std::env;
fn main() {
println!("cargo:rustc-cfg=core_arch_docs");
// Used to tell our `#[assert_instr]` annotations that all simd intrinsics
// are available to test their codegen, since some are gated behind an extra
// `-Ctarget-feature=+unimplemented-simd128` that doesn't have any
// equivalent in `#[target_feature]` right now.
println!("cargo:rerun-if-env-changed=RUSTFLAGS");
if env::var("RUSTFLAGS")
.unwrap_or_default()
.contains("unimplemented-simd128")
{
println!("cargo:rustc-cfg=all_simd");
}
}

View File

@@ -12,11 +12,11 @@
use stdarch_test::assert_instr;
extern "C" {
#[link_name = "llvm.wasm.atomic.wait.i32"]
#[link_name = "llvm.wasm.memory.atomic.wait.i32"]
fn llvm_atomic_wait_i32(ptr: *mut i32, exp: i32, timeout: i64) -> i32;
#[link_name = "llvm.wasm.atomic.wait.i64"]
#[link_name = "llvm.wasm.memory.atomic.wait.i64"]
fn llvm_atomic_wait_i64(ptr: *mut i64, exp: i64, timeout: i64) -> i32;
#[link_name = "llvm.wasm.atomic.notify"]
#[link_name = "llvm.wasm.memory.atomic.notify"]
fn llvm_atomic_notify(ptr: *mut i32, cnt: i32) -> i32;
}

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@ cfg-if = "0.1"
# time, and we want to make updates to this explicit rather than automatically
# picking up updates which might break CI with new instruction names.
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasmprinter = "=0.2.6"
wasmprinter = "=0.2.24"
[features]
default = []

View File

@@ -183,10 +183,10 @@ unsafe fn hex_encode_simd128<'a>(mut src: &[u8], dst: &'a mut [u8]) -> Result<&'
// original source text order. The first element (res1) we'll store uses
// all the low bytes from the 2 masks and the second element (res2) uses
// all the upper bytes.
let res1 = v8x16_shuffle::<0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23>(
let res1 = i8x16_shuffle::<0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23>(
masked2, masked1,
);
let res2 = v8x16_shuffle::<8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31>(
let res2 = i8x16_shuffle::<8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31>(
masked2, masked1,
);