about summary refs log tree commit diff
path: root/library/stdarch/ci
diff options
context:
space:
mode:
authorgnzlbg <gnzlbg@users.noreply.github.com>2018-08-15 18:20:33 +0200
committerAlex Crichton <alex@alexcrichton.com>2018-08-15 09:20:33 -0700
commit3daebfbc0b4654dba164500bdd1e96a2b814173e (patch)
tree6a6687269d154de3b638a0c2b5cb3472d41ceab1 /library/stdarch/ci
parentdafc8d9fbd7f16a141c55873f53df4d376d55a5e (diff)
downloadrust-3daebfbc0b4654dba164500bdd1e96a2b814173e.tar.gz
rust-3daebfbc0b4654dba164500bdd1e96a2b814173e.zip
Add wasm32 simd128 intrinsics (#549)
* Add wasm32 simd128 intrinsics

* test wasm32 simd128 instructions

* Run wasm tests like all other tests

* use modules instead of types to access wasm simd128 interpretations

* generate docs for wasm32-unknown-unknown

* fix typo

* Enable #[assert_instr] on wasm32

* Shell out to Node's `execSync` to execute `wasm2wat` over our wasm file
* Parse the wasm file line-by-line, looking for various function markers and
  such
* Use the `elem` section to build a function pointer table, allowing us to map
  exactly from function pointer to a function
* Avoid losing debug info (the names section) in release mode by stripping
  `--strip-debug` from `rust-lld`.

* remove exclude list from Cargo.toml

* fix assert_instr for non-wasm targets

* re-format assert-instr changes

* add crate that uses assert_instr

* Fix instructions having extra quotes

* Add assert_instr for wasm memory intrinsics

* Remove hacks for git wasm-bindgen

* add wasm_simd128 feature

* make wasm32 build correctly

* run simd128 tests on ci

* remove wasm-assert-instr-tests
Diffstat (limited to 'library/stdarch/ci')
-rw-r--r--library/stdarch/ci/docker/wasm32-unknown-unknown/Dockerfile37
-rwxr-xr-xlibrary/stdarch/ci/dox.sh1
-rw-r--r--library/stdarch/ci/lld-shim.rs11
-rwxr-xr-xlibrary/stdarch/ci/run-docker.sh6
-rwxr-xr-xlibrary/stdarch/ci/run.sh6
5 files changed, 57 insertions, 4 deletions
diff --git a/library/stdarch/ci/docker/wasm32-unknown-unknown/Dockerfile b/library/stdarch/ci/docker/wasm32-unknown-unknown/Dockerfile
new file mode 100644
index 00000000000..56eef71204f
--- /dev/null
+++ b/library/stdarch/ci/docker/wasm32-unknown-unknown/Dockerfile
@@ -0,0 +1,37 @@
+FROM ubuntu:18.04
+
+RUN apt-get update -y && apt-get install -y --no-install-recommends \
+  ca-certificates \
+  clang \
+  cmake \
+  curl \
+  git \
+  libc6-dev \
+  make \
+  python \
+  xz-utils
+
+# Install `wasm2wat`
+RUN git clone --recursive https://github.com/WebAssembly/wabt
+RUN make -C wabt -j$(nproc)
+ENV PATH=$PATH:/wabt/bin
+
+# Install `wasm-bindgen-test-runner`
+RUN curl -L https://github.com/rustwasm/wasm-bindgen/releases/download/0.2.16/wasm-bindgen-0.2.16-x86_64-unknown-linux-musl.tar.gz \
+  | tar xzf -
+ENV PATH=$PATH:/wasm-bindgen-0.2.16-x86_64-unknown-linux-musl
+ENV CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner
+
+# Install `node`
+RUN curl https://nodejs.org/dist/v10.8.0/node-v10.8.0-linux-x64.tar.xz | tar xJf -
+ENV PATH=$PATH:/node-v10.8.0-linux-x64/bin
+
+# We use a shim linker that removes `--strip-debug` when passed to LLD. While
+# this typically results in invalid debug information in release mode it doesn't
+# result in an invalid names section which is what we're interested in.
+COPY lld-shim.rs /
+ENV CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER=/tmp/lld-shim
+
+# Rustc isn't available until this container starts, so defer compilation of the
+# shim.
+ENTRYPOINT /rust/bin/rustc /lld-shim.rs -o /tmp/lld-shim && exec bash "$@"
diff --git a/library/stdarch/ci/dox.sh b/library/stdarch/ci/dox.sh
index a604fb541dd..fe7e04711df 100755
--- a/library/stdarch/ci/dox.sh
+++ b/library/stdarch/ci/dox.sh
@@ -44,6 +44,7 @@ dox aarch64 aarch64-unknown-linux-gnu
 dox powerpc64le powerpc64le-unknown-linux-gnu
 dox mips mips-unknown-linux-gnu
 dox mips64 mips64-unknown-linux-gnuabi64
+dox wasm32 wasm32-unknown-unknown
 
 # If we're on travis, not a PR, and on the right branch, publish!
 if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
diff --git a/library/stdarch/ci/lld-shim.rs b/library/stdarch/ci/lld-shim.rs
new file mode 100644
index 00000000000..10263869e8d
--- /dev/null
+++ b/library/stdarch/ci/lld-shim.rs
@@ -0,0 +1,11 @@
+use std::os::unix::prelude::*;
+use std::process::Command;
+use std::env;
+
+fn main() {
+    let args = env::args()
+        .skip(1)
+        .filter(|s| s != "--strip-debug")
+        .collect::<Vec<_>>();
+    panic!("failed to exec: {}", Command::new("rust-lld").args(&args).exec());
+}
diff --git a/library/stdarch/ci/run-docker.sh b/library/stdarch/ci/run-docker.sh
index 0c560c825c9..52263634107 100755
--- a/library/stdarch/ci/run-docker.sh
+++ b/library/stdarch/ci/run-docker.sh
@@ -13,8 +13,8 @@ run() {
       --user `id -u`:`id -g` \
       --rm \
       --init \
-      --volume $HOME/.cargo:/cargo \
-      --env CARGO_HOME=/cargo \
+      --volume $HOME/.cargo:/cargo-h \
+      --env CARGO_HOME=/cargo-h \
       --volume `rustc --print sysroot`:/rust:ro \
       --env TARGET=$target \
       --env STDSIMD_TEST_EVERYTHING \
@@ -25,7 +25,7 @@ run() {
       --privileged \
       stdsimd \
       bash \
-      -c 'PATH=$PATH:/rust/bin exec ci/run.sh'
+      -c 'PATH=/rust/bin:$PATH exec ci/run.sh'
 }
 
 if [ -z "$1" ]; then
diff --git a/library/stdarch/ci/run.sh b/library/stdarch/ci/run.sh
index d2350fc6c70..8bc915d38ba 100755
--- a/library/stdarch/ci/run.sh
+++ b/library/stdarch/ci/run.sh
@@ -59,13 +59,17 @@ cargo_test() {
 cargo_test
 cargo_test "--release"
 
-# Test x86 targets compiled with AVX.
+# Test targets compiled with extra features.
 case ${TARGET} in
     x86*)
         RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
         export STDSIMD_DISABLE_ASSERT_INSTR=1
         cargo_test "--release"
         ;;
+    wasm32-unknown-unknown*)
+        # export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128"
+        cargo_test "--release --features=wasm_simd128"
+        ;;
     *)
         ;;
 esac