Skip to content

Commit 08c32d5

Browse files
committed
split into mips and mips64 modules
1 parent 8b12979 commit 08c32d5

File tree

9 files changed

+83
-55
lines changed

9 files changed

+83
-55
lines changed

.travis.yml

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ rust: nightly
55
matrix:
66
fast_finish: true
77
include:
8-
#- env: TARGET=i586-unknown-linux-gnu
9-
#- env: TARGET=i686-unknown-linux-gnu
10-
#- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
11-
#- env: TARGET=x86_64-unknown-linux-gnu-emulated NO_ADD=1 STDSIMD_TEST_EVERYTHING=1 FEATURES="intel_sde"
12-
#- env: TARGET=arm-unknown-linux-gnueabihf
13-
#- env: TARGET=armv7-unknown-linux-gnueabihf
14-
#- env: TARGET=aarch64-unknown-linux-gnu
15-
- env: TARGET=mips64-unknown-linux-gnuabi64
8+
- env: TARGET=i586-unknown-linux-gnu
9+
- env: TARGET=i686-unknown-linux-gnu
10+
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
11+
- env: TARGET=x86_64-unknown-linux-gnu-emulated NO_ADD=1 STDSIMD_TEST_EVERYTHING=1 FEATURES="intel_sde"
12+
- env: TARGET=arm-unknown-linux-gnueabihf
13+
- env: TARGET=armv7-unknown-linux-gnueabihf
14+
- env: TARGET=aarch64-unknown-linux-gnu
15+
- env: TARGET=powerpc-unknown-linux-gnu
16+
- env: TARGET=powerpc64-unknown-linux-gnu
17+
- env: TARGET=powerpc64le-unknown-linux-gnu
18+
- os: osx
19+
env: TARGET=i686-apple-darwin
20+
script: ci/run.sh
21+
- os: osx
22+
env: TARGET=x86_64-apple-darwin NO_ADD=1
23+
script: ci/run.sh
1624
- env: TARGET=wasm32-unknown-unknown
1725
before_script:
1826
- git clone --recursive https://github.com/WebAssembly/wabt
@@ -26,32 +34,26 @@ matrix:
2634
- cat wasm.wat
2735
- grep current_memory wasm.wat
2836
- grep grow_memory wasm.wat
29-
#- env: TARGET=mips64el-unknown-linux-gnuabi64
30-
#- env: TARGET=powerpc-unknown-linux-gnu
31-
#- env: TARGET=powerpc64-unknown-linux-gnu
32-
#- env: TARGET=powerpc64le-unknown-linux-gnu
33-
#- os: osx
34-
# env: TARGET=i686-apple-darwin
35-
# script: ci/run.sh
36-
#- os: osx
37-
# env: TARGET=x86_64-apple-darwin NO_ADD=1
38-
# script: ci/run.sh
39-
#- env: DOCUMENTATION
40-
# install: true
41-
# script: ci/dox.sh
42-
#- script: cargo test --manifest-path crates/stdsimd-verify/Cargo.toml
43-
# install: true
44-
#- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
45-
# before_script:
46-
# - rustup component add rustfmt-preview
47-
# script:
48-
# - cargo fmt --all -- --write-mode=diff
49-
#- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
50-
# script: |
51-
# cargo install clippy
52-
# cargo clippy --all -- -D clippy-pedantic
53-
#allow_failures:
54-
#- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
37+
- env: DOCUMENTATION
38+
install: true
39+
script: ci/dox.sh
40+
- script: cargo test --manifest-path crates/stdsimd-verify/Cargo.toml
41+
install: true
42+
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
43+
before_script:
44+
- rustup component add rustfmt-preview
45+
script:
46+
- cargo fmt --all -- --write-mode=diff
47+
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
48+
script: |
49+
cargo install rustfmt-nightly --force
50+
cargo fmt --all -- --write-mode=diff
51+
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
52+
script: |
53+
cargo install clippy
54+
cargo clippy --all -- -D clippy-pedantic
55+
allow_failures:
56+
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
5557

5658
before_install:
5759
# FIXME (travis-ci/travis-ci#8920) shouldn't be necessary...

ci/dox.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ dox arm armv7-unknown-linux-gnueabihf
4242
dox aarch64 aarch64-unknown-linux-gnu
4343
dox powerpc powerpc-unknown-linux-gnu
4444
dox powerpc64 powerpc64-unknown-linux-gnu
45+
dox mips mips-unknown-linux-gnu
4546
dox mips64 mips64-unknown-linux-gnuabi64
4647

4748
# If we're on travis, not a PR, and on the right branch, publish!

ci/run.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/sh
22

3-
#set -ex
3+
set -ex
44

55
# Tests are all super fast anyway, and they fault often enough on travis that
66
# having only one thread increases debuggability to be worth it.
77
export RUST_TEST_THREADS=1
88
#export RUST_BACKTRACE=1
9-
export RUST_TEST_NOCAPTURE=1
9+
#export RUST_TEST_NOCAPTURE=1
1010

1111
# FIXME(rust-lang-nursery/stdsimd#120) run-time feature detection for ARM Neon
1212
case ${TARGET} in
@@ -31,7 +31,6 @@ cargo_test() {
3131
cmd="$cmd -p coresimd -p stdsimd --manifest-path crates/stdsimd/Cargo.toml"
3232
cmd="$cmd -- $2"
3333
$cmd
34-
more /checkout/target/mips64-unknown-linux-gnuabi64/debug/build/backtrace-sys-3428ad8e56e1b724/out/config.log
3534
}
3635

3736
cargo_test

coresimd/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ pub mod simd {
2929
/// * [`x86_64`]
3030
/// * [`arm`]
3131
/// * [`aarch64`]
32+
/// * [`mips`]
3233
/// * [`mips64`]
3334
///
3435
/// [`x86`]: https://rust-lang-nursery.github.io/stdsimd/x86/stdsimd/arch/index.html
3536
/// [`x86_64`]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/arch/index.html
3637
/// [`arm`]: https://rust-lang-nursery.github.io/stdsimd/arm/stdsimd/arch/index.html
3738
/// [`aarch64`]: https://rust-lang-nursery.github.io/stdsimd/aarch64/stdsimd/arch/index.html
39+
/// [`mips`]: https://rust-lang-nursery.github.io/stdsimd/mips/stdsimd/arch/index.html
3840
/// [`mips64`]: https://rust-lang-nursery.github.io/stdsimd/mips64/stdsimd/arch/index.html
3941
#[unstable(feature = "stdsimd", issue = "0")]
4042
pub mod arch {
@@ -111,7 +113,7 @@ mod aarch64;
111113
#[cfg(target_arch = "wasm32")]
112114
mod wasm32;
113115

114-
#[cfg(target_arch = "mips")]
116+
#[cfg(any(target_arch = "mips", target_arch = "mips64"))]
115117
mod mips;
116118

117119
mod nvptx;

crates/coresimd/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,3 @@ use _core::ptr;
8383
use _core::result;
8484
#[allow(unused_imports)]
8585
use _core::slice;
86-
87-
pub fn foo() -> coresimd::simd::i8x16 {
88-
use coresimd::simd::i8x16;
89-
let a = i8x16::splat(1);
90-
unsafe { coresimd::arch::mips::__msa_add_a_b(a, a) }
91-
}

stdsimd/arch/detect/linux/auxvec.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ use _std::io::Read;
99
any(target_arch = "aarch64",
1010
target_arch = "arm",
1111
target_arch = "powerpc64",
12+
target_arch = "mips",
1213
target_arch = "mips64"))))]
1314
compile_error!("ELF auxiliary vectors are not implemented for this target.");
1415

1516
/// Key to access the CPU Hardware capabilities bitfield.
1617
#[cfg(any(target_arch = "aarch64",
1718
target_arch = "arm",
1819
target_arch = "powerpc64",
20+
target_arch = "mips",
1921
target_arch = "mips64"))]
2022
pub const AT_HWCAP: usize = 16;
2123
/// Key to access the CPU Hardware capabilities 2 bitfield.
@@ -32,6 +34,7 @@ pub struct AuxVec {
3234
target_arch = "aarch64",
3335
target_arch = "arm",
3436
target_arch = "powerpc64",
37+
target_arch = "mips",
3538
target_arch = "mips64",
3639
))]
3740
pub hwcap: usize,
@@ -68,7 +71,7 @@ pub fn auxv() -> Result<AuxVec, ()> {
6871
// Try to call a dynamically-linked getauxval function.
6972
if let Ok(hwcap) = getauxval(AT_HWCAP) {
7073
// Targets with only AT_HWCAP:
71-
#[cfg(any(target_arch = "aarch64", target_arch = "mips64"))] {
74+
#[cfg(any(target_arch = "aarch64", target_arch = "mips", target_arch = "mips64"))] {
7275
if hwcap != 0 {
7376
return Ok(AuxVec { hwcap });
7477
}
@@ -82,7 +85,7 @@ pub fn auxv() -> Result<AuxVec, ()> {
8285
}
8386
}
8487
}
85-
#[cfg(not(any(target_arch = "aarch64", target_arch = "mips64",
88+
#[cfg(not(any(target_arch = "aarch64", target_arch = "mips", target_arch = "mips64",
8689
target_arch = "arm", target_arch = "powerpc64"
8790
)))] {
8891
compile_error!("function not implemented for this target");
@@ -136,7 +139,7 @@ fn auxv_from_file(file: &str) -> Result<AuxVec, ()> {
136139
/// function returns `Err`.
137140
fn auxv_from_buf(buf: &[usize; 64]) -> Result<AuxVec, ()> {
138141
// Targets with only AT_HWCAP:
139-
#[cfg(any(target_arch = "aarch64", target_arch = "mips64"))]
142+
#[cfg(any(target_arch = "aarch64", target_arch = "mips", target_arch = "mips64"))]
140143
{
141144
for el in buf.chunks(2) {
142145
match el[0] {
@@ -163,7 +166,8 @@ fn auxv_from_buf(buf: &[usize; 64]) -> Result<AuxVec, ()> {
163166
}
164167
}
165168

166-
#[cfg(not(any(target_arch = "aarch64", target_arch = "mips64",
169+
#[cfg(not(any(target_arch = "aarch64", target_arch = "mips",
170+
target_arch = "mips64",
167171
target_arch = "arm", target_arch = "powerpc64")))] {
168172
compile_error!("this function is not implemented for this target");
169173
}
@@ -190,7 +194,7 @@ mod tests {
190194

191195
// Reads the Auxiliary Vector key from getauxval()
192196
// using the auxv crate.
193-
#[cfg(not(target_arch = "mips64"))]
197+
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
194198
fn auxv_crate_getauxval(key: usize) -> Option<usize> {
195199
use self::auxv_crate::AuxvType;
196200
use self::auxv_crate::getauxval::Getauxval;
@@ -210,10 +214,9 @@ mod tests {
210214
}
211215
}
212216

213-
214-
// FIXME: on mips64 getauxval returns 0, and /proc/self/auxv
217+
// FIXME: on mips/mips64 getauxval returns 0, and /proc/self/auxv
215218
// does not always contain the AT_HWCAP key under qemu.
216-
#[cfg(not(target_arch = "mips64"))]
219+
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
217220
#[test]
218221
fn auxv_crate() {
219222
let v = auxv();

stdsimd/arch/detect/linux/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
//! Run-time feature detection on Linux
22
3-
#[cfg(not(target_arch = "mips64"))]
3+
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
44
pub mod cpuinfo;
55

66
#[cfg(any(target_arch = "aarch64",
77
target_arch = "arm",
88
target_arch = "powerpc64",
9+
target_arch = "mips",
910
target_arch = "mips64"))]
1011
pub mod auxvec;

stdsimd/arch/detect/mod.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ cfg_if! {
1616
} else if #[cfg(target_arch = "powerpc64")] {
1717
#[path = "powerpc64.rs"]
1818
mod arch;
19+
} else if #[cfg(target_arch = "mips")] {
20+
#[path = "mips.rs"]
21+
mod arch;
1922
} else if #[cfg(target_arch = "mips64")] {
2023
#[path = "mips64.rs"]
2124
mod arch;
@@ -35,6 +38,7 @@ cfg_if! {
3538
any(target_arch = "arm",
3639
target_arch = "aarch64",
3740
target_arch = "powerpc64",
41+
target_arch = "mips",
3842
target_arch = "mips64"
3943
)))]
4044
mod linux;
@@ -114,12 +118,29 @@ guarding it behind a cfg(target_arch) as follows:
114118
};
115119
}
116120

117-
#[cfg(not(target_arch = "mips64"))]
121+
#[cfg(not(target_arch = "mips"))]
118122
#[macro_export]
119123
#[unstable(feature = "stdsimd", issue = "0")]
120-
macro_rules! is_mips64_feature_detected {
124+
macro_rules! is_mips_feature_detected {
121125
($t:tt) => {
122126
compile_error!(r#"
127+
is_mips_feature_detected can only be used on MIPS targets.
128+
You can prevent it from being used in other architectures by
129+
guarding it behind a cfg(target_arch) as follows:
130+
131+
#[cfg(target_arch = "mips")] {
132+
if is_mips_feature_detected(...) { ... }
133+
}
134+
"#)
135+
};
136+
}
137+
138+
#[cfg(not(target_arch = "mips64"))]
139+
#[macro_export]
140+
#[unstable(feature = "stdsimd", issue = "0")]
141+
macro_rules! is_mips64_feature_detected {
142+
($t:tt) => {
143+
compile_error!(r#"
123144
is_mips64_feature_detected can only be used on MIPS64 targets.
124145
You can prevent it from being used in other architectures by
125146
guarding it behind a cfg(target_arch) as follows:

stdsimd/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,14 @@
188188
/// * [`x86_64`]
189189
/// * [`arm`]
190190
/// * [`aarch64`]
191+
/// * [`mips`]
191192
/// * [`mips64`]
192193
///
193194
/// [`x86`]: https://rust-lang-nursery.github.io/stdsimd/i686/stdsimd/arch/x86/index.html
194195
/// [`x86_64`]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/arch/x86_64/index.html
195196
/// [`arm`]: https://rust-lang-nursery.github.io/stdsimd/arm/stdsimd/arch/arm/index.html
196197
/// [`aarch64`]: https://rust-lang-nursery.github.io/stdsimd/aarch64/stdsimd/arch/aarch64/index.html
198+
/// [`mips`]: https://rust-lang-nursery.github.io/stdsimd/aarch64/stdsimd/arch/mips/index.html
197199
/// [`mips64`]: https://rust-lang-nursery.github.io/stdsimd/aarch64/stdsimd/arch/mips64/index.html
198200
///
199201
/// # Examples
@@ -358,6 +360,9 @@ pub mod arch {
358360
#[cfg(target_arch = "wasm32")]
359361
pub use coresimd::arch::wasm32;
360362

363+
#[cfg(target_arch = "mips")]
364+
pub use coresimd::arch::mips;
365+
361366
#[cfg(target_arch = "mips64")]
362367
pub use coresimd::arch::mips64;
363368

0 commit comments

Comments
 (0)