Skip to content

Commit

Permalink
Revert "Partially revert rust-lang#868 (rust-lang#878)"
Browse files Browse the repository at this point in the history
This reverts commit 311d56c.
  • Loading branch information
Jethro Beekman committed Sep 8, 2020
1 parent 78891cd commit 4516f3b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 18 additions & 8 deletions crates/core_arch/src/x86/avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3743,9 +3743,14 @@ pub unsafe fn _mm256_xor_si256(a: __m256i, b: __m256i) -> __m256i {
// This intrinsic has no corresponding instruction.
#[rustc_args_required_const(1)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i8 {
let imm8 = (imm8 & 31) as u32;
simd_extract(a.as_i8x32(), imm8 as u32)
pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i32 {
let a = a.as_u8x32();
macro_rules! call {
($imm5:expr) => {
simd_extract::<_, u8>(a, $imm5) as i32
};
}
constify_imm5!(imm8, call)
}

/// Extracts a 16-bit integer from `a`, selected with `imm8`. Returns a 32-bit
Expand All @@ -3759,9 +3764,14 @@ pub unsafe fn _mm256_extract_epi8(a: __m256i, imm8: i32) -> i8 {
// This intrinsic has no corresponding instruction.
#[rustc_args_required_const(1)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_extract_epi16(a: __m256i, imm8: i32) -> i16 {
let imm8 = (imm8 & 15) as u32;
simd_extract(a.as_i16x16(), imm8)
pub unsafe fn _mm256_extract_epi16(a: __m256i, imm8: i32) -> i32 {
let a = a.as_u16x16();
macro_rules! call {
($imm4:expr) => {
simd_extract::<_, u16>(a, $imm4) as i32
};
}
constify_imm4!((imm8 & 15), call)
}

/// Extracts a 32-bit integer from `a`, selected with `imm8`.
Expand Down Expand Up @@ -6120,7 +6130,7 @@ mod tests {
);
let r1 = _mm256_extract_epi8(a, 0);
let r2 = _mm256_extract_epi8(a, 35);
assert_eq!(r1, -1);
assert_eq!(r1, 0xFF);
assert_eq!(r2, 3);
}

Expand All @@ -6133,7 +6143,7 @@ mod tests {
);
let r1 = _mm256_extract_epi16(a, 0);
let r2 = _mm256_extract_epi16(a, 19);
assert_eq!(r1, -1);
assert_eq!(r1, 0xFFFF);
assert_eq!(r2, 3);
}

Expand Down
2 changes: 0 additions & 2 deletions crates/stdarch-verify/tests/x86-intel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ fn verify_all_signatures() {
// take a signed-integer. This breaks `_MM_SHUFFLE` for
// `_mm_shuffle_ps`:
"_mm_shuffle_ps" => continue,
// FIXME(#867)
"_mm256_extract_epi8" | "_mm256_extract_epi16" => continue,
_ => {}
}

Expand Down

0 comments on commit 4516f3b

Please sign in to comment.