Skip to content

Commit 10a6b90

Browse files
powerboat9CohenArthur
authored andcommitted
Import stdarch 1.49.0
This commit imports stdarch 1.49.0 into libgrust/rustc-lib/stdarch. This is necessary for compiling libcore, as libcore attempts to reuse some files from stdarch. Signed-off-by: Owen Avery <[email protected]>
1 parent 4280d3a commit 10a6b90

File tree

216 files changed

+358363
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+358363
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
task:
2+
name: x86_64-unknown-freebsd
3+
freebsd_instance:
4+
image: freebsd-12-1-release-amd64
5+
setup_script:
6+
- pkg install -y curl
7+
- curl https://sh.rustup.rs -sSf --output rustup.sh
8+
- sh rustup.sh --default-toolchain nightly -y
9+
- . $HOME/.cargo/env
10+
- rustup default nightly
11+
test_script:
12+
- . $HOME/.cargo/env
13+
- cargo build --all
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- auto
6+
- try
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
style:
13+
name: Check Style
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@master
17+
- name: Install Rust
18+
run: rustup update nightly && rustup default nightly
19+
- run: ci/style.sh
20+
21+
docs:
22+
name: Build Documentation
23+
needs: [style]
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@master
27+
- name: Install Rust
28+
run: rustup update nightly && rustup default nightly
29+
- run: ci/dox.sh
30+
env:
31+
CI: 1
32+
- name: Publish documentation
33+
run: |
34+
cd target/doc
35+
git init
36+
git add .
37+
git -c user.name='ci' -c user.email='ci' commit -m init
38+
git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages
39+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
40+
41+
verify:
42+
name: Automatic intrinsic verification
43+
needs: [style]
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@master
47+
- name: Install Rust
48+
run: rustup update nightly && rustup default nightly
49+
- run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml
50+
51+
env_override:
52+
name: Env Override
53+
needs: [style]
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@master
57+
- name: Install Rust
58+
run: rustup update nightly && rustup default nightly
59+
- run: RUST_STD_DETECT_UNSTABLE=avx cargo test --features=std_detect_env_override --manifest-path crates/std_detect/Cargo.toml env_override_no_avx
60+
61+
test:
62+
needs: [style]
63+
name: Test
64+
runs-on: ${{ matrix.os }}
65+
strategy:
66+
matrix:
67+
target:
68+
# Dockers that are run through docker on linux
69+
- i686-unknown-linux-gnu
70+
- x86_64-unknown-linux-gnu
71+
- x86_64-unknown-linux-gnu-emulated
72+
- arm-unknown-linux-gnueabihf
73+
- armv7-unknown-linux-gnueabihf
74+
- aarch64-unknown-linux-gnu
75+
- powerpc64le-unknown-linux-gnu
76+
- mips-unknown-linux-gnu
77+
- mips64-unknown-linux-gnuabi64
78+
- mips64el-unknown-linux-gnuabi64
79+
- s390x-unknown-linux-gnu
80+
- wasm32-wasi
81+
- i586-unknown-linux-gnu
82+
- x86_64-linux-android
83+
- arm-linux-androideabi
84+
- mipsel-unknown-linux-musl
85+
- aarch64-linux-android
86+
- nvptx64-nvidia-cuda
87+
- thumbv6m-none-eabi
88+
- thumbv7m-none-eabi
89+
- thumbv7em-none-eabi
90+
- thumbv7em-none-eabihf
91+
92+
# macOS targets
93+
- x86_64-apple-darwin
94+
# FIXME: gh-actions build environment doesn't have linker support
95+
# - i686-apple-darwin
96+
97+
# Windows targets
98+
- x86_64-pc-windows-msvc
99+
# FIXME: Disassembly not implemented for the # following targets:
100+
# - x86_64-pc-windows-gnu:
101+
# - i686-pc-windows-gnu:
102+
# - i686-pc-windows-msvc:
103+
104+
include:
105+
- target: i686-unknown-linux-gnu
106+
os: ubuntu-latest
107+
- target: x86_64-unknown-linux-gnu
108+
os: ubuntu-latest
109+
- target: x86_64-unknown-linux-gnu-emulated
110+
os: ubuntu-latest
111+
test_everything: true
112+
rustflags: --cfg stdarch_intel_sde
113+
- target: arm-unknown-linux-gnueabihf
114+
os: ubuntu-latest
115+
- target: armv7-unknown-linux-gnueabihf
116+
os: ubuntu-latest
117+
rustflags: -C target-feature=+neon
118+
- target: mips-unknown-linux-gnu
119+
os: ubuntu-latest
120+
norun: true
121+
- target: mips64-unknown-linux-gnuabi64
122+
os: ubuntu-latest
123+
norun: true
124+
- target: mips64el-unknown-linux-gnuabi64
125+
os: ubuntu-latest
126+
norun: true
127+
- target: powerpc64le-unknown-linux-gnu
128+
os: ubuntu-latest
129+
disable_assert_instr: true
130+
- target: s390x-unknown-linux-gnu
131+
os: ubuntu-latest
132+
- target: wasm32-wasi
133+
os: ubuntu-latest
134+
- target: aarch64-unknown-linux-gnu
135+
os: ubuntu-latest
136+
- target: x86_64-apple-darwin
137+
os: macos-latest
138+
- target: x86_64-pc-windows-msvc
139+
os: windows-latest
140+
- target: i586-unknown-linux-gnu
141+
os: ubuntu-latest
142+
- target: x86_64-linux-android
143+
os: ubuntu-latest
144+
disable_assert_instr: 1
145+
- target: arm-linux-androideabi
146+
os: ubuntu-latest
147+
disable_assert_instr: 1
148+
- target: mipsel-unknown-linux-musl
149+
os: ubuntu-latest
150+
norun: 1
151+
- target: aarch64-linux-android
152+
os: ubuntu-latest
153+
disable_assert_instr: 1
154+
- target: nvptx64-nvidia-cuda
155+
os: ubuntu-latest
156+
- target: thumbv6m-none-eabi
157+
os: ubuntu-latest
158+
- target: thumbv7m-none-eabi
159+
os: ubuntu-latest
160+
- target: thumbv7em-none-eabi
161+
os: ubuntu-latest
162+
- target: thumbv7em-none-eabihf
163+
os: ubuntu-latest
164+
165+
steps:
166+
- uses: actions/checkout@master
167+
- name: Install Rust (rustup)
168+
run: |
169+
rustup update nightly --no-self-update
170+
rustup default nightly
171+
if: matrix.os != 'macos-latest'
172+
- name: Install Rust (macos)
173+
run: |
174+
curl https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
175+
echo "##[add-path]$HOME/.cargo/bin"
176+
rustup update nightly --no-self-update
177+
rustup default nightly
178+
if: matrix.os == 'macos-latest'
179+
- run: |
180+
rustup default nightly
181+
rustup target add ${{ matrix.target }}
182+
if: "!endsWith(matrix.target, 'emulated')"
183+
- run: cargo generate-lockfile
184+
185+
# Configure some env vars based on matrix configuration
186+
- run: echo "##[set-env name=NORUN]1"
187+
if: matrix.norun != '' || startsWith(matrix.target, 'thumb') || matrix.target == 'nvptx64-nvidia-cuda'
188+
- run: echo "##[set-env name=STDARCH_TEST_EVERYTHING]1"
189+
if: matrix.test_everything != ''
190+
- run: echo "##[set-env name=RUSTFLAGS]${{ matrix.rustflags }}"
191+
if: matrix.rustflags != ''
192+
- run: echo "##[set-env name=STDARCH_DISABLE_ASSERT_INSTR]1"
193+
if: matrix.disable_assert_instr != ''
194+
- run: echo "##[set-env name=NOSTD]1"
195+
if: startsWith(matrix.target, 'thumb') || matrix.target == 'nvptx64-nvidia-cuda'
196+
197+
# Windows & OSX go straight to `run.sh` ...
198+
- run: ./ci/run.sh
199+
shell: bash
200+
if: matrix.os != 'ubuntu-latest' || startsWith(matrix.target, 'thumb')
201+
env:
202+
TARGET: ${{ matrix.target }}
203+
204+
# ... while Linux goes to `run-docker.sh`
205+
- run: ./ci/run-docker.sh ${{ matrix.target }}
206+
shell: bash
207+
if: "matrix.os == 'ubuntu-latest' && !startsWith(matrix.target, 'thumb')"
208+
env:
209+
TARGET: ${{ matrix.target }}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Cargo.lock
2+
.*.swp
3+
target
4+
tags
5+
crates/stdarch-gen/aarch64.rs
6+
crates/stdarch-gen/arm.rs
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Contributing to stdarch
2+
3+
The `stdarch` crate is more than willing to accept contributions! First you'll
4+
probably want to check out the repository and make sure that tests pass for you:
5+
6+
```
7+
$ git clone https://github.com/rust-lang/stdarch
8+
$ cd stdarch
9+
$ cargo +nightly test
10+
```
11+
12+
To run codegen tests, run in release mode:
13+
14+
```
15+
$ cargo +nightly test --release -p coresimd
16+
```
17+
18+
Remember that this repository requires the nightly channel of Rust! If any of
19+
the above steps don't work, [please let us know][new]!
20+
21+
Next up you can [find an issue][issues] to help out on, we've selected a few
22+
with the [`help wanted`][help] and [`impl-period`][impl] tags which could
23+
particularly use some help. You may be most interested in [#40][vendor],
24+
implementing all vendor intrinsics on x86. That issue's got some good pointers
25+
about where to get started!
26+
27+
If you've got general questions feel free to [join us on gitter][gitter] and ask
28+
around! Feel free to ping either @BurntSushi or @alexcrichton with questions.
29+
30+
[gitter]: https://gitter.im/rust-impl-period/WG-libs-simd
31+
32+
# How to write examples for stdarch intrinsics
33+
34+
There are a few features that must be enabled for the given intrinsic to work
35+
properly and the example must only be run by `cargo test --doc` when the feature
36+
is supported by the CPU. As a result, the default `fn main` that is generated by
37+
`rustdoc` will not work (in most cases). Consider using the following as a guide
38+
to ensure your example works as expected.
39+
40+
```rust
41+
/// # // We need cfg_target_feature to ensure the example is only
42+
/// # // run by `cargo test --doc` when the CPU supports the feature
43+
/// # #![feature(cfg_target_feature)]
44+
/// # // We need target_feature for the intrinsic to work
45+
/// # #![feature(target_feature)]
46+
/// #
47+
/// # // rustdoc by default uses `extern crate stdarch`, but we need the
48+
/// # // `#[macro_use]`
49+
/// # #[macro_use] extern crate stdarch;
50+
/// #
51+
/// # // The real main function
52+
/// # fn main() {
53+
/// # // Only run this if `<target feature>` is supported
54+
/// # if cfg_feature_enabled!("<target feature>") {
55+
/// # // Create a `worker` function that will only be run if the target feature
56+
/// # // is supported and ensure that `target_feature` is enabled for your worker
57+
/// # // function
58+
/// # #[target_feature(enable = "<target feature>")]
59+
/// # unsafe fn worker() {
60+
///
61+
/// // Write your example here. Feature specific intrinsics will work here! Go wild!
62+
///
63+
/// # }
64+
/// # unsafe { worker(); }
65+
/// # }
66+
/// # }
67+
```
68+
69+
If some of the above syntax does not look familiar, the [Documentation as tests] section
70+
of the [Rust Book] describes the `rustdoc` syntax quite well. As always, feel free
71+
to [join us on gitter][gitter] and ask us if you hit any snags, and thank you for helping
72+
to improve the documentation of `stdarch`!
73+
74+
[new]: https://github.com/rust-lang/stdarch/issues/new
75+
[issues]: https://github.com/rust-lang/stdarch/issues
76+
[help]: https://github.com/rust-lang/stdarch/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22
77+
[impl]: https://github.com/rust-lang/stdarch/issues?q=is%3Aissue+is%3Aopen+label%3Aimpl-period
78+
[vendor]: https://github.com/rust-lang/stdarch/issues/40
79+
[Documentation as tests]: https://doc.rust-lang.org/book/first-edition/documentation.html#documentation-as-tests
80+
[Rust Book]: https://doc.rust-lang.org/book/first-edition
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[workspace]
2+
members = [
3+
"crates/stdarch-verify",
4+
"crates/core_arch",
5+
"crates/std_detect",
6+
"crates/stdarch-gen",
7+
"examples/"
8+
]
9+
exclude = [
10+
"crates/wasm-assert-instr-tests"
11+
]
12+
13+
[profile.release]
14+
debug = true
15+
opt-level = 3
16+
incremental = true
17+
18+
[profile.bench]
19+
debug = 1
20+
opt-level = 3
21+
incremental = true

0 commit comments

Comments
 (0)