115 Commits

Author SHA1 Message Date
Alex Crichton
b5c437e119 Add tests for remaining wasm simd intrinsics
Wasmtime now supports all of the simd proposal, so this commit
uncomments instruction assertions and tests, while also adding more
tests, for all wasm simd instructions. This means that all wasm simd
instructions should be tested and have running instruction assertions,
except for `i64x2.abs`, which will require an LLVM upgrade to LLVM 13.
2021-08-03 00:46:38 +01:00
Alex Crichton
c6356546c0
Updates for wasm simd support (#1110)
* Uncomment some i64-related instruction assertions now that LLVM
  supports the opcodes.
* Fix the codegen for `{i,u}32x4_trunc_sat_f32x4`. This was originally
  introduced using `simd_cast` but that inherits LLVM's UB related to
  float-to-integer casts out of bounds. Since the original inception of
  these intrinsics in LLVM dedicated intrinsics for the wasm
  instructions have been added, so this swithces the implementation to
  using those.
* Uncomment `f64x2_convert_low_i32x4` instruction assertion and add a
  test now that this is implemented in Wasmtime.
2021-04-07 17:05:34 +01:00
Alex Crichton
60e8d7766b Unconditionally expose wasm atomic intrinsics
While they're not very useful in single-threaded mode this makes them
more useful for building libraries because you don't have to always
recompile the standard library to get the desired effect. Additionally
it helps us enable tests on CI for these functions, since the
instructions will now validate without shared memory (thankfully!).
2021-03-21 09:24:39 +00:00
Alex Crichton
8ed0d3cbd5 More wasm SIMD updates
* Sync with the latest LLVM which has a few new intrinsic names
* Move explicit tests back to `assert_instr` since `assert_instr` now
  supports specifying const-generic arguments inline.
* Enable tests where wasmtime implements the instruction as well as LLVM.
* Ensure there are tests for all functions that can be tested at this
  time (those that aren't unimplemented in wasmtime).

There's still a number of `assert_instr` tests that are commented out.
These are either because they're unimplemented in wasmtime at the moment
or LLVM doesn't have an implementation for the instruction yet.
2021-03-21 09:24:39 +00:00
Alex Crichton
e35da555f8
Update WebAssembly SIMD/Atomics (#1073) 2021-03-11 23:30:30 +00:00
Daniel Liu
275bd33492
Enable WASM CI (#1006) 2021-02-14 12:41:58 +00:00
kangshan1157
936e1add97
Implement avx512bf16 intrinsics (#998) 2021-02-10 23:29:27 +00:00
Makoto Kato
e020a85ff0
Run CI for i686-pc-windows-msvc (#934) 2020-10-25 01:32:27 +01:00
Alex Crichton
770964adac
Update and revamp wasm32 SIMD intrinsics (#874)
Lots of time and lots of things have happened since the simd128 support
was first added to this crate. Things are starting to settle down now so
this commit syncs the Rust intrinsic definitions with the current
specification (https://github.com/WebAssembly/simd). Unfortuantely not
everything can be enabled just yet but everything is in the pipeline for
getting enabled soon.

This commit also applies a major revamp to how intrinsics are tested.
The intention is that the setup should be much more lightweight and/or
easy to work with after this commit.

At a high-level, the changes here are:

* Testing with node.js and `#[wasm_bindgen]` has been removed. Instead
  intrinsics are tested with Wasmtime which has a nearly complete
  implementation of the SIMD spec (and soon fully complete!)

* Testing is switched to `wasm32-wasi` to make idiomatic Rust bits a bit
  easier to work with (e.g. `panic!)`

* Testing of this crate's simd128 feature for wasm is re-enabled. This
  will run on CI and both compile and execute intrinsics. This should
  bring wasm intrinsics to the same level of parity as x86 intrinsics,
  for example.

* New wasm intrinsics have been added:
  * `iNNxMM_loadAxA_{s,u}`
  * `vNNxMM_load_splat`
  * `v8x16_swizzle`
  * `v128_andnot`
  * `iNNxMM_abs`
  * `iNNxMM_narrow_*_{u,s}`
  * `iNNxMM_bitmask` - commented out until LLVM is updated to LLVM 11
  * `iNNxMM_widen_*_{u,s}` - commented out until
    bytecodealliance/wasmtime#1994 lands
  * `iNNxMM_{max,min}_{u,s}`
  * `iNNxMM_avgr_u`

* Some wasm intrinsics have been removed:
  * `i64x2_trunc_*`
  * `f64x2_convert_*`
  * `i8x16_mul`

* The `v8x16.shuffle` instruction is exposed. This is done through a
  `macro` (not `macro_rules!`, but `macro`). This is intended to be
  somewhat experimental and unstable until we decide otherwise. This
  instruction has 16 immediate-mode expressions and is as a result
  unsuited to the existing `constify_*` logic of this crate. I'm hoping
  that we can game out over time what a macro might look like and/or
  look for better solutions. For now, though, what's implemented is the
  first of its kind in this crate (an architecture-specific macro), so
  some extra scrutiny looking at it would be appreciated.

* Lots of `assert_instr` annotations have been fixed for wasm.

* All wasm simd128 tests are uncommented and passing now.

This is still missing tests for new intrinsics and it's also missing
tests for various corner cases. I hope to get to those later as the
upstream spec itself gets closer to stabilization.

In the meantime, however, I went ahead and updated the `hex.rs` example
with a wasm implementation using intrinsics. With it I got some very
impressive speedups using Wasmtime:

    test benches::large_default  ... bench:     213,961 ns/iter (+/- 5,108) = 4900 MB/s
    test benches::large_fallback ... bench:   3,108,434 ns/iter (+/- 75,730) = 337 MB/s
    test benches::small_default  ... bench:          52 ns/iter (+/- 0) = 2250 MB/s
    test benches::small_fallback ... bench:         358 ns/iter (+/- 0) = 326 MB/s

or otherwise using Wasmtime hex encoding using SIMD is 15x faster on 1MB
chunks or 7x faster on small <128byte chunks.

All of these intrinsics are still unstable and will continue to be so
presumably until the simd proposal in wasm itself progresses to a later
stage. Additionaly we'll still want to sync with clang on intrinsic
names (or decide not to) at some point in the future.

* wasm: Unconditionally expose SIMD functions

This commit unconditionally exposes SIMD functions from the `wasm32`
module. This is done in such a way that the standard library does not
need to be recompiled to access SIMD intrinsics and use them. This,
hopefully, is the long-term story for SIMD in WebAssembly in Rust.

It's unlikely that all WebAssembly runtimes will end up implementing
SIMD so the standard library is unlikely to use SIMD any time soon, but
we want to make sure it's easily available to folks! This commit enables
all this by ensuring that SIMD is available to the standard library,
regardless of compilation flags.

This'll come with the same caveats as x86 support, where it doesn't make
sense to call these functions unless you're enabling simd support one
way or another locally. Additionally, as with x86, if you don't call
these functions then the instructions won't show up in your binary.

While I was here I went ahead and expanded the WebAssembly-specific
documentation for the wasm32 module as well, ensuring that the current
state of SIMD/Atomics are documented.
2020-07-18 13:32:52 +01:00
Mahmut Bulut
4541757677 feature detection 2020-05-29 19:05:48 +01:00
Daniel Worrall
5b9482f9b6 Convert posix scripts to bash 2020-05-05 23:15:49 +01:00
Amanieu d'Antras
c554b42b2a
Fix CI (#845)
* Use ubuntu 18.04 instead of 18.10 for MIPS CI

* Fix WASM CI
2020-03-29 15:15:59 +01:00
Makoto Kato
2674fff7d2
Install Python3 to wasm32 CI since wabt removes Python2 support (#840)
See https://github.com/WebAssembly/wabt/pull/1321
2020-03-29 13:07:51 +01:00
Taiki Endo
66afa48445 Build documentation with '--edition=2018' 2019-10-26 18:46:57 +02:00
Pietro Albini
9bb7286360 ci: switch mirrors to use our CDN
We recently added a CDN in front of our CI mirrors as it's faster and
cheaper for us. This switches libc's CI to use it instead of accessing
the underlying bucket directly.
2019-10-26 18:46:36 +02:00
Alex Crichton
d7f3c0bbb3
Migrate CI to GitHub Actions (#813)
* Migrate CI to GitHub Actions

This involves less secret and user management than azure pipelines, has
more concurrency by default for repos, and in general has a bit more
modern syntax!

* Disable clippy on CI for now

Looks like it's got quite a few errors
2019-09-24 09:03:56 -05:00
gnzlbg
f876c9fac6 Enable std_detect_env_override feature on CI tests 2019-09-18 12:09:07 +02:00
Luca Barbato
9bfb9e5529 Add the env_override test to the CI 2019-09-17 19:22:18 +02:00
gnzlbg
d27acfcb7a Fix windows build jobs 2019-09-16 23:43:01 +02:00
gnzlbg
7fea683cd9 Move azure-pipelines.yml to the ci directory 2019-08-13 18:04:22 +02:00
gnzlbg
ec7697de1b Disable mips MSA builds - I dont think they can ever work except for the r6 targets 2019-07-14 15:29:19 +02:00
gnzlbg
800039bd23 Update with libc system 2019-07-14 15:29:19 +02:00
gnzlbg
8059e580e3 Upload documentation to gh-pages 2019-07-14 15:29:19 +02:00
gnzlbg
f61cb90d87 Try windows 2019-07-14 15:29:19 +02:00
gnzlbg
dffdd66d81 Disable wasm32 simd128 tests 2019-07-14 15:29:19 +02:00
gnzlbg
d88e30a204 Add windows jobs 2019-07-14 15:29:19 +02:00
gnzlbg
f7a91c7a57 Add Azure Pipelines 2019-07-14 15:29:19 +02:00
gnzlbg
1253c1daed Enable warnings globally 2019-07-09 01:37:07 +02:00
gnzlbg
686b813f5d Update repo name 2019-07-09 01:37:07 +02:00
gnzlbg
127f13f10f Fix assert_instr tests 2019-07-08 22:58:19 +02:00
Luca Barbato
cb34d4bede Unbreak powerpc64 CI 2019-05-13 15:42:36 +02:00
Luca Barbato
90f87bf368 Unbreak powerpc64le CI 2019-05-13 15:42:36 +02:00
gnzlbg
d418d5e1f8 Update Intel SDE and enable RTM full emulation 2019-05-09 13:42:20 +02:00
Alex Crichton
7d992f5d16 Download node binaries 2019-04-25 17:19:51 +02:00
Alex Crichton
7215eb4613 Hook tests up to node.js
We can even test some of the functions!
2019-04-25 17:19:51 +02:00
gnzlbg
7d9e92335b Only test on 64-bit ppc 2019-04-17 14:21:15 +02:00
gnzlbg
28e2f594b8 Run build jobs with target-features on mips and ppc 2019-04-17 14:21:15 +02:00
Radovan Birdic
fd4cf83d42 Added msa jobs for mips*-gnu* targets 2019-04-09 09:43:17 +02:00
Lokathor
b0771647a8 Revert the regression, add a GBA target to avoid this again 2019-03-18 08:57:03 +01:00
Mateusz Mikuła
8e15fba40a Unify PPC Dockerfiles 2019-02-23 22:19:47 +01:00
Mateusz Mikuła
2148ed5db1 Upgrade EOL docker images to Ubuntu 18.04 2019-02-23 22:19:47 +01:00
gnzlbg
c91584d241 Make core_arch compatible with Rust2015 and Rust2018 2019-02-23 01:14:07 +01:00
gnzlbg
a177055824 Test Rust2018 builds 2019-02-23 01:14:07 +01:00
gnzlbg
e56de7344f Fix wasm32 build job 2019-02-14 03:45:57 +01:00
Peter Jin
6681ec36b0 Fix nvptx64 libcore-only build on travis. 2019-02-13 23:07:00 +01:00
gnzlbg
6affc41386 Use builtin nvptx64-nvidia-cuda target 2019-02-13 22:00:20 +01:00
gnzlbg
333784b5ef Fix libcore build 2019-02-12 01:02:07 +01:00
gnzlbg
ff129bff05 Add cargo features to disable usage of file I/O and dlsym in std_detect 2019-02-09 11:47:38 +01:00
Alex Crichton
cf738b0d36
Attempt to fix tests on master (#662)
* Attempt to fix tests on master

* Make all doctests use items from the real `std` rather than this
  crate, it's just easier
* Handle debuginfo weirdness by flagging functions as `no_mangle` that
  we're looking for instructions within.

* Handle double undescores in symbol names
2019-01-30 15:11:35 -08:00
Peter Jin
2c924adce6 Fixes to the nvptx target spec json: disable merge-functions, (#653)
and set the correct datalayout string.
2019-01-25 12:51:13 -07:00