Skip to content

Commit cf86d8a

Browse files
committed
Merge remote-tracking branch 'up/master' into sse4.1
2 parents bab5cd3 + aafe927 commit cf86d8a

File tree

11 files changed

+3569
-582
lines changed

11 files changed

+3569
-582
lines changed

.appveyor.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ install:
1919
build: false
2020

2121
test_script:
22-
- cargo test --target %TARGET%
23-
- cargo test --target %TARGET% --release
22+
- C:\msys64\usr\bin\sh ci\run.sh
2423

2524
branches:
2625
only:

ci/run.sh

+7
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22

33
set -ex
44

5+
# FIXME(rust-lang/rust#45201) shouldn't need to specify one codegen unit
6+
export RUSTFLAGS="$RUSTFLAGS -C codegen-units=1"
7+
8+
# Tests are all super fast anyway, and they fault often enough on travis that
9+
# having only one thread increases debuggability to be worth it.
10+
export RUST_TEST_THREADS=1
11+
512
cargo test --target $TARGET
613
cargo test --release --target $TARGET

src/arm/v6.rs

+23
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,26 @@ pub unsafe fn _rev_u16(x: u16) -> u16 {
1919
pub unsafe fn _rev_u32(x: u32) -> u32 {
2020
x.swap_bytes() as u32
2121
}
22+
23+
#[cfg(test)]
24+
mod tests {
25+
use stdsimd_test::simd_test;
26+
27+
use arm::v6;
28+
29+
#[test]
30+
fn _rev_u16() {
31+
unsafe {
32+
assert_eq!(v6::_rev_u16(0b0000_0000_1111_1111_u16), 0b1111_1111_0000_0000_u16);
33+
}
34+
}
35+
36+
#[test]
37+
fn _rev_u32() {
38+
unsafe {
39+
assert_eq!(v6::_rev_u32(
40+
0b0000_0000_1111_1111_0000_0000_1111_1111_u32
41+
), 0b1111_1111_0000_0000_1111_1111_0000_0000_u32);
42+
}
43+
}
44+
}

src/arm/v7.rs

+37
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,40 @@ extern "C" {
4242
#[link_name="llvm.bitreverse.i32"]
4343
fn rbit_u32(i: i32) -> i32;
4444
}
45+
46+
47+
#[cfg(test)]
48+
mod tests {
49+
use stdsimd_test::simd_test;
50+
51+
use arm::v7;
52+
53+
#[test]
54+
fn _clz_u8() {
55+
unsafe {
56+
assert_eq!(v7::_clz_u8(0b0000_1010u8), 4u8);
57+
}
58+
}
59+
60+
#[test]
61+
fn _clz_u16() {
62+
unsafe {
63+
assert_eq!(v7::_clz_u16(0b0000_1010u16), 12u16);
64+
}
65+
}
66+
67+
#[test]
68+
fn _clz_u32() {
69+
unsafe {
70+
assert_eq!(v7::_clz_u32(0b0000_1010u32), 28u32);
71+
}
72+
}
73+
74+
#[test]
75+
fn _rbit_u32() {
76+
unsafe {
77+
assert_eq!(v7::_rbit_u32(0b0000_1010u32),
78+
0b0101_0000_0000_0000_0000_0000_0000_0000u32);
79+
}
80+
}
81+
}

src/arm/v8.rs

+50
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,53 @@ pub unsafe fn _cls_u32(x: u32) -> u32 {
5353
pub unsafe fn _cls_u64(x: u64) -> u64 {
5454
u64::leading_zeros(((((((x as i64) >> 63) as u64) ^ x) << 1) | 1)) as u64
5555
}
56+
57+
#[cfg(test)]
58+
mod tests {
59+
use stdsimd_test::simd_test;
60+
61+
use arm::v8;
62+
63+
#[test]
64+
fn _rev_u64() {
65+
unsafe {
66+
assert_eq!(v8::_rev_u64(
67+
0b0000_0000_1111_1111_0000_0000_1111_1111_u64
68+
), 0b1111_1111_0000_0000_1111_1111_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_u64);
69+
}
70+
}
71+
72+
#[test]
73+
fn _clz_u64() {
74+
unsafe {
75+
assert_eq!(v8::_clz_u64(0b0000_1010u64), 60u64);
76+
}
77+
}
78+
79+
#[test]
80+
fn _rbit_u64() {
81+
unsafe {
82+
assert_eq!(v8::_rbit_u64(
83+
0b0000_0000_1111_1101_0000_0000_1111_1111_u64
84+
), 0b1111_1111_0000_0000_1011_1111_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_u64);
85+
}
86+
}
87+
88+
#[test]
89+
fn _cls_u32() {
90+
unsafe {
91+
assert_eq!(v8::_cls_u32(
92+
0b1111_1111_1111_1111_0000_0000_1111_1111_u32
93+
), 15_u32);
94+
}
95+
}
96+
97+
#[test]
98+
fn _cls_u64() {
99+
unsafe {
100+
assert_eq!(v8::_cls_u64(
101+
0b1111_1111_1111_1111_0000_0000_1111_1111_0000_0000_0000_0000_0000_0000_0000_0000_u64
102+
), 15_u64);
103+
}
104+
}
105+
}

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
//! After verifying that a specified feature is available, use `target_feature`
6767
//! to enable a given feature and use the desired intrinsic.
6868
//!
69-
//! ```
69+
//! ```ignore
7070
//! # #![feature(cfg_target_feature)]
7171
//! # #![feature(target_feature)]
7272
//! # #[macro_use]

0 commit comments

Comments
 (0)