gnzlbg 3daebfbc0b 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
2018-08-15 09:20:33 -07:00

76 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
set -ex
: ${TARGET?"The TARGET environment variable must be set."}
# Tests are all super fast anyway, and they fault often enough on travis that
# having only one thread increases debuggability to be worth it.
export RUST_TEST_THREADS=1
#export RUST_BACKTRACE=full
#export RUST_TEST_NOCAPTURE=1
RUSTFLAGS="$RUSTFLAGS --cfg stdsimd_strict"
# FIXME: on armv7 neon intrinsics require the neon target-feature to be
# unconditionally enabled.
# FIXME: on powerpc (32-bit) and powerpc64 (big endian) disable
# the instr tests.
case ${TARGET} in
armv7*)
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+neon"
;;
powerpc-*)
export STDSIMD_DISABLE_ASSERT_INSTR=1
;;
powerpc64-*)
export STDSIMD_DISABLE_ASSERT_INSTR=1
export STDSIMD_TEST_NORUN=1
;;
# On 32-bit use a static relocation model which avoids some extra
# instructions when dealing with static data, notably allowing some
# instruction assertion checks to pass below the 20 instruction limit. If
# this is the default, dynamic, then too many instructions are generated
# when we assert the instruction for a function and it causes tests to fail.
i686-* | i586-*)
export RUSTFLAGS="${RUSTFLAGS} -C relocation-model=static"
;;
*android*)
export STDSIMD_DISABLE_ASSERT_INSTR=1
;;
*)
;;
esac
echo "RUSTFLAGS=${RUSTFLAGS}"
echo "FEATURES=${FEATURES}"
echo "OBJDUMP=${OBJDUMP}"
echo "STDSIMD_DISABLE_ASSERT_INSTR=${STDSIMD_DISABLE_ASSERT_INSTR}"
echo "STDSIMD_TEST_EVERYTHING=${STDSIMD_TEST_EVERYTHING}"
cargo_test() {
cmd="cargo test --target=$TARGET $1"
cmd="$cmd -p coresimd -p stdsimd"
cmd="$cmd -- $2"
$cmd
}
cargo_test
cargo_test "--release"
# 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