diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a100d320..160f2219 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -75,7 +75,7 @@ jobs: strategy: matrix: - rust: [stable,nightly] + rust: [stable] features: ["", "std"] steps: diff --git a/src/i16x16_.rs b/src/i16x16_.rs index 1917b465..510ebef3 100644 --- a/src/i16x16_.rs +++ b/src/i16x16_.rs @@ -295,7 +295,7 @@ impl i16x16 { pub fn move_mask(self) -> i32 { pick! { if #[cfg(target_feature="avx2")] { - (move_mask_i8_m256i(pack_i16_to_i8_m256i(self.avx2,shuffle_ai_i64_all_m256i::<0b00_01_10_11>(self.avx2))) & 0xffff) as i32 + (move_mask_i8_m256i(pack_i16_to_i8_m256i(self.avx2,shuffle_ai_i64_all_m256i::<0b01_00_11_10>(self.avx2))) & 0xffff) as i32 } else { self.a.move_mask() | (self.b.move_mask() << 8) } diff --git a/tests/all_tests/t_i16x16.rs b/tests/all_tests/t_i16x16.rs index 2354d405..c54a7e2c 100644 --- a/tests/all_tests/t_i16x16.rs +++ b/tests/all_tests/t_i16x16.rs @@ -586,8 +586,21 @@ fn impl_from_i8x16() { #[test] fn test_i16x16_move_mask() { + let indexes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + + for x in 0..256 { + // multiply by prime number to mix bits a bit + let i = x * 251; + + let a = + i16x16::from(indexes.map(|x| if i & (1 << x) != 0 { -1 } else { 0 })); + + assert_eq!(a.move_mask(), i); + } + let a = i16x16::from([-1, 0, -2, -3, -1, 0, -2, -3, -1, 0, -1, 0, -1, 0, -1, 0]); + let expected = 0b0101010111011101; let actual = a.move_mask(); assert_eq!(expected, actual);