Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/gcc-changelog/git_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
'libffi/',
'libgo/',
'libgrust/rustc-lib/core/',
'libgrust/rustc-lib/stdarch/',
'libphobos/libdruntime/',
'libphobos/src/',
'libsanitizer/',
Expand Down
13 changes: 13 additions & 0 deletions libgrust/rustc-lib/stdarch/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
task:
name: x86_64-unknown-freebsd
freebsd_instance:
image: freebsd-12-1-release-amd64
setup_script:
- pkg install -y curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh --default-toolchain nightly -y
- . $HOME/.cargo/env
- rustup default nightly
test_script:
- . $HOME/.cargo/env
- cargo build --all
209 changes: 209 additions & 0 deletions libgrust/rustc-lib/stdarch/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
name: CI
on:
push:
branches:
- auto
- try
pull_request:
branches:
- master

jobs:
style:
name: Check Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: ci/style.sh

docs:
name: Build Documentation
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: ci/dox.sh
env:
CI: 1
- name: Publish documentation
run: |
cd target/doc
git init
git add .
git -c user.name='ci' -c user.email='ci' commit -m init
git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'

verify:
name: Automatic intrinsic verification
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml

env_override:
name: Env Override
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: RUST_STD_DETECT_UNSTABLE=avx cargo test --features=std_detect_env_override --manifest-path crates/std_detect/Cargo.toml env_override_no_avx

test:
needs: [style]
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
# Dockers that are run through docker on linux
- i686-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-gnu-emulated
- arm-unknown-linux-gnueabihf
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- mips-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- s390x-unknown-linux-gnu
- wasm32-wasi
- i586-unknown-linux-gnu
- x86_64-linux-android
- arm-linux-androideabi
- mipsel-unknown-linux-musl
- aarch64-linux-android
- nvptx64-nvidia-cuda
- thumbv6m-none-eabi
- thumbv7m-none-eabi
- thumbv7em-none-eabi
- thumbv7em-none-eabihf

# macOS targets
- x86_64-apple-darwin
# FIXME: gh-actions build environment doesn't have linker support
# - i686-apple-darwin

# Windows targets
- x86_64-pc-windows-msvc
# FIXME: Disassembly not implemented for the # following targets:
# - x86_64-pc-windows-gnu:
# - i686-pc-windows-gnu:
# - i686-pc-windows-msvc:

include:
- target: i686-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu-emulated
os: ubuntu-latest
test_everything: true
rustflags: --cfg stdarch_intel_sde
- target: arm-unknown-linux-gnueabihf
os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
rustflags: -C target-feature=+neon
- target: mips-unknown-linux-gnu
os: ubuntu-latest
norun: true
- target: mips64-unknown-linux-gnuabi64
os: ubuntu-latest
norun: true
- target: mips64el-unknown-linux-gnuabi64
os: ubuntu-latest
norun: true
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-latest
disable_assert_instr: true
- target: s390x-unknown-linux-gnu
os: ubuntu-latest
- target: wasm32-wasi
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: i586-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-linux-android
os: ubuntu-latest
disable_assert_instr: 1
- target: arm-linux-androideabi
os: ubuntu-latest
disable_assert_instr: 1
- target: mipsel-unknown-linux-musl
os: ubuntu-latest
norun: 1
- target: aarch64-linux-android
os: ubuntu-latest
disable_assert_instr: 1
- target: nvptx64-nvidia-cuda
os: ubuntu-latest
- target: thumbv6m-none-eabi
os: ubuntu-latest
- target: thumbv7m-none-eabi
os: ubuntu-latest
- target: thumbv7em-none-eabi
os: ubuntu-latest
- target: thumbv7em-none-eabihf
os: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Install Rust (rustup)
run: |
rustup update nightly --no-self-update
rustup default nightly
if: matrix.os != 'macos-latest'
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
echo "##[add-path]$HOME/.cargo/bin"
rustup update nightly --no-self-update
rustup default nightly
if: matrix.os == 'macos-latest'
- run: |
rustup default nightly
rustup target add ${{ matrix.target }}
if: "!endsWith(matrix.target, 'emulated')"
- run: cargo generate-lockfile

# Configure some env vars based on matrix configuration
- run: echo "##[set-env name=NORUN]1"
if: matrix.norun != '' || startsWith(matrix.target, 'thumb') || matrix.target == 'nvptx64-nvidia-cuda'
- run: echo "##[set-env name=STDARCH_TEST_EVERYTHING]1"
if: matrix.test_everything != ''
- run: echo "##[set-env name=RUSTFLAGS]${{ matrix.rustflags }}"
if: matrix.rustflags != ''
- run: echo "##[set-env name=STDARCH_DISABLE_ASSERT_INSTR]1"
if: matrix.disable_assert_instr != ''
- run: echo "##[set-env name=NOSTD]1"
if: startsWith(matrix.target, 'thumb') || matrix.target == 'nvptx64-nvidia-cuda'

# Windows & OSX go straight to `run.sh` ...
- run: ./ci/run.sh
shell: bash
if: matrix.os != 'ubuntu-latest' || startsWith(matrix.target, 'thumb')
env:
TARGET: ${{ matrix.target }}

# ... while Linux goes to `run-docker.sh`
- run: ./ci/run-docker.sh ${{ matrix.target }}
shell: bash
if: "matrix.os == 'ubuntu-latest' && !startsWith(matrix.target, 'thumb')"
env:
TARGET: ${{ matrix.target }}
6 changes: 6 additions & 0 deletions libgrust/rustc-lib/stdarch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Cargo.lock
.*.swp
target
tags
crates/stdarch-gen/aarch64.rs
crates/stdarch-gen/arm.rs
80 changes: 80 additions & 0 deletions libgrust/rustc-lib/stdarch/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributing to stdarch

The `stdarch` crate is more than willing to accept contributions! First you'll
probably want to check out the repository and make sure that tests pass for you:

```
$ git clone https://github.com/rust-lang/stdarch
$ cd stdarch
$ cargo +nightly test
```

To run codegen tests, run in release mode:

```
$ cargo +nightly test --release -p coresimd
```

Remember that this repository requires the nightly channel of Rust! If any of
the above steps don't work, [please let us know][new]!

Next up you can [find an issue][issues] to help out on, we've selected a few
with the [`help wanted`][help] and [`impl-period`][impl] tags which could
particularly use some help. You may be most interested in [#40][vendor],
implementing all vendor intrinsics on x86. That issue's got some good pointers
about where to get started!

If you've got general questions feel free to [join us on gitter][gitter] and ask
around! Feel free to ping either @BurntSushi or @alexcrichton with questions.

[gitter]: https://gitter.im/rust-impl-period/WG-libs-simd

# How to write examples for stdarch intrinsics

There are a few features that must be enabled for the given intrinsic to work
properly and the example must only be run by `cargo test --doc` when the feature
is supported by the CPU. As a result, the default `fn main` that is generated by
`rustdoc` will not work (in most cases). Consider using the following as a guide
to ensure your example works as expected.

```rust
/// # // We need cfg_target_feature to ensure the example is only
/// # // run by `cargo test --doc` when the CPU supports the feature
/// # #![feature(cfg_target_feature)]
/// # // We need target_feature for the intrinsic to work
/// # #![feature(target_feature)]
/// #
/// # // rustdoc by default uses `extern crate stdarch`, but we need the
/// # // `#[macro_use]`
/// # #[macro_use] extern crate stdarch;
/// #
/// # // The real main function
/// # fn main() {
/// # // Only run this if `<target feature>` is supported
/// # if cfg_feature_enabled!("<target feature>") {
/// # // Create a `worker` function that will only be run if the target feature
/// # // is supported and ensure that `target_feature` is enabled for your worker
/// # // function
/// # #[target_feature(enable = "<target feature>")]
/// # unsafe fn worker() {
///
/// // Write your example here. Feature specific intrinsics will work here! Go wild!
///
/// # }
/// # unsafe { worker(); }
/// # }
/// # }
```

If some of the above syntax does not look familiar, the [Documentation as tests] section
of the [Rust Book] describes the `rustdoc` syntax quite well. As always, feel free
to [join us on gitter][gitter] and ask us if you hit any snags, and thank you for helping
to improve the documentation of `stdarch`!

[new]: https://github.com/rust-lang/stdarch/issues/new
[issues]: https://github.com/rust-lang/stdarch/issues
[help]: https://github.com/rust-lang/stdarch/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22
[impl]: https://github.com/rust-lang/stdarch/issues?q=is%3Aissue+is%3Aopen+label%3Aimpl-period
[vendor]: https://github.com/rust-lang/stdarch/issues/40
[Documentation as tests]: https://doc.rust-lang.org/book/first-edition/documentation.html#documentation-as-tests
[Rust Book]: https://doc.rust-lang.org/book/first-edition
21 changes: 21 additions & 0 deletions libgrust/rustc-lib/stdarch/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[workspace]
members = [
"crates/stdarch-verify",
"crates/core_arch",
"crates/std_detect",
"crates/stdarch-gen",
"examples/"
]
exclude = [
"crates/wasm-assert-instr-tests"
]

[profile.release]
debug = true
opt-level = 3
incremental = true

[profile.bench]
debug = 1
opt-level = 3
incremental = true
Loading
Loading