Skip to content

Commit e2770c3

Browse files
authored
Merge pull request #606 from dhardy/ci
Fix simd_support (stable and nightly)
2 parents 9ad4668 + cbee7c8 commit e2770c3

File tree

8 files changed

+26
-19
lines changed

8 files changed

+26
-19
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ sudo: false
5656
# `cargo test --package rand_core --no-default-features`
5757
# `cargo test --package rand_isaac --features=serde1`
5858
# `cargo test --package rand_xorshift --features=serde1`
59+
#
60+
# TODO: SIMD support on stable releases
61+
# NOTE: SIMD support is unreliable on nightly; we track the latest release
5962
matrix:
6063
include:
6164
- rust: 1.22.0
@@ -77,7 +80,8 @@ matrix:
7780
- rustup target add aarch64-apple-ios
7881
script:
7982
- cargo test --lib --no-default-features
80-
- cargo test --features=serde1,log,i128_support
83+
# TODO: add simd_support feature:
84+
- cargo test --features=serde1,log
8185
- cargo test --examples
8286
- cargo test --package rand_core
8387
- cargo test --package rand_core --no-default-features
@@ -90,7 +94,8 @@ matrix:
9094
install:
9195
script:
9296
- cargo test --lib --no-default-features
93-
- cargo test --features=serde1,log,i128_support
97+
# TODO: add simd_support feature:
98+
- cargo test --features=serde1,log
9499
- cargo test --examples
95100
- cargo test --package rand_core
96101
- cargo test --package rand_core --no-default-features

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ benchmark results in the PR (or to report nothing's changed).
8888
```sh
8989
# Benchmarks (requires nightly)
9090
cargo bench
91-
# Some benchmarks have a faster path with i128_support
91+
# Potentially nightly features allow different code paths
9292
cargo bench --features=nightly
9393
```

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ rand_core = { path = "rand_core", version = "0.2", default-features = false }
3636
rand_isaac = { path = "rand_isaac", version = "0.1" }
3737
rand_xorshift = { path = "rand_xorshift", version = "0.1" }
3838
log = { version = "0.4", optional = true }
39-
packed_simd = { version = "0.1", optional = true, features = ["into_bits"] }
39+
40+
[dependencies.packed_simd]
41+
# NOTE: so far no version works reliably due to dependence on unstable features
42+
version = "0.3"
43+
# git = "https://github.com/rust-lang-nursery/packed_simd"
44+
optional = true
45+
features = ["into_bits"]
4046

4147
[target.'cfg(unix)'.dependencies]
4248
libc = { version = "0.2", optional = true }

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ build: false
3333

3434
test_script:
3535
- cargo test --lib --no-default-features --features alloc
36-
- cargo test --all-features
36+
# TODO: use --all-features once simd_support is sufficiently stable:
37+
- cargo test --features=serde1,log
3738
- cargo test --benches --features=nightly
3839
- cargo test --examples
3940
- cargo test --package rand_core

benches/distributions.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
// except according to those terms.
88

99
#![feature(test)]
10-
#![cfg_attr(all(feature="i128_support", feature="nightly"), allow(stable_features))] // stable since 2018-03-27
11-
#![cfg_attr(all(feature="i128_support", feature="nightly"), feature(i128_type, i128))]
1210

1311
extern crate test;
1412
extern crate rand;
@@ -108,7 +106,6 @@ distr_int!(distr_uniform_i8, i8, Uniform::new(20i8, 100));
108106
distr_int!(distr_uniform_i16, i16, Uniform::new(-500i16, 2000));
109107
distr_int!(distr_uniform_i32, i32, Uniform::new(-200_000_000i32, 800_000_000));
110108
distr_int!(distr_uniform_i64, i64, Uniform::new(3i64, 123_456_789_123));
111-
#[cfg(feature = "i128_support")]
112109
distr_int!(distr_uniform_i128, i128, Uniform::new(-123_456_789_123i128, 123_456_789_123_456_789));
113110

114111
distr_float!(distr_uniform_f32, f32, Uniform::new(2.26f32, 2.319));
@@ -138,7 +135,6 @@ distr_int!(distr_standard_i8, i8, Standard);
138135
distr_int!(distr_standard_i16, i16, Standard);
139136
distr_int!(distr_standard_i32, i32, Standard);
140137
distr_int!(distr_standard_i64, i64, Standard);
141-
#[cfg(feature = "i128_support")]
142138
distr_int!(distr_standard_i128, i128, Standard);
143139

144140
distr!(distr_standard_bool, bool, Standard);
@@ -195,7 +191,6 @@ gen_range_int!(gen_range_i8, i8, -20i8, 100);
195191
gen_range_int!(gen_range_i16, i16, -500i16, 2000);
196192
gen_range_int!(gen_range_i32, i32, -200_000_000i32, 800_000_000);
197193
gen_range_int!(gen_range_i64, i64, 3i64, 123_456_789_123);
198-
#[cfg(feature = "i128_support")]
199194
gen_range_int!(gen_range_i128, i128, -12345678901234i128, 123_456_789_123_456_789);
200195

201196
// construct and sample from a floating-point range

src/distributions/uniform.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ uniform_int_impl! { usize, isize, usize, isize, usize }
481481
#[cfg(rust_1_26)]
482482
uniform_int_impl! { u128, u128, u128, i128, u128 }
483483

484-
#[cfg(feature = "simd_support")]
484+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
485485
macro_rules! uniform_simd_int_impl {
486486
($ty:ident, $unsigned:ident, $u_scalar:ident) => {
487487
// The "pick the largest zone that can fit in an `u32`" optimization
@@ -588,15 +588,15 @@ macro_rules! uniform_simd_int_impl {
588588
};
589589
}
590590

591-
#[cfg(feature = "simd_support")]
591+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
592592
uniform_simd_int_impl! {
593593
(u64x2, i64x2),
594594
(u64x4, i64x4),
595595
(u64x8, i64x8),
596596
u64
597597
}
598598

599-
#[cfg(feature = "simd_support")]
599+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
600600
uniform_simd_int_impl! {
601601
(u32x2, i32x2),
602602
(u32x4, i32x4),
@@ -605,7 +605,7 @@ uniform_simd_int_impl! {
605605
u32
606606
}
607607

608-
#[cfg(feature = "simd_support")]
608+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
609609
uniform_simd_int_impl! {
610610
(u16x2, i16x2),
611611
(u16x4, i16x4),
@@ -615,7 +615,7 @@ uniform_simd_int_impl! {
615615
u16
616616
}
617617

618-
#[cfg(feature = "simd_support")]
618+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
619619
uniform_simd_int_impl! {
620620
(u8x2, i8x2),
621621
(u8x4, i8x4),
@@ -1054,7 +1054,7 @@ mod tests {
10541054
#[cfg(rust_1_26)]
10551055
t!(i128, u128);
10561056

1057-
#[cfg(feature = "simd_support")]
1057+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
10581058
{
10591059
t!(u8x2, u8x4, u8x8, u8x16, u8x32, u8x64 => u8);
10601060
t!(i8x2, i8x4, i8x8, i8x16, i8x32, i8x64 => i8);

src/distributions/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ wmul_impl_usize! { u32 }
148148
#[cfg(target_pointer_width = "64")]
149149
wmul_impl_usize! { u64 }
150150

151-
#[cfg(feature = "simd_support")]
151+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
152152
mod simd_wmul {
153153
#[cfg(target_arch = "x86")]
154154
use core::arch::x86::*;
@@ -215,7 +215,7 @@ mod simd_wmul {
215215
wmul_impl_large! { (u32x16,) u32, 16 }
216216
wmul_impl_large! { (u64x2, u64x4, u64x8,) u64, 32 }
217217
}
218-
#[cfg(feature = "simd_support")]
218+
#[cfg(all(feature = "simd_support", feature = "nightly"))]
219219
pub use self::simd_wmul::*;
220220

221221

utils/ci/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ main() {
2222
cross test --package rand_xorshift --features=serde1 --target $TARGET
2323
else # have stable Rust
2424
cross test --lib --no-default-features --target $TARGET
25-
cross test --features=serde1,log,i128_support --target $TARGET
25+
cross test --features=serde1,log --target $TARGET
2626
cross test --examples --target $TARGET
2727
cross test --package rand_core --target $TARGET
2828
cross test --package rand_core --no-default-features --target $TARGET

0 commit comments

Comments
 (0)