Fix undefined behavior in movemask_epi8 (#1354)
Fixes https://github.com/rust-lang/stdarch/issues/1347
This commit is contained in:
parent
75127705cc
commit
83cd38d056
2 changed files with 6 additions and 2 deletions
|
|
@ -2001,7 +2001,9 @@ pub unsafe fn _mm256_min_epu8(a: __m256i, b: __m256i) -> __m256i {
|
|||
#[cfg_attr(test, assert_instr(vpmovmskb))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mm256_movemask_epi8(a: __m256i) -> i32 {
|
||||
simd_bitmask::<_, u32>(a.as_i8x32()) as i32
|
||||
let z = i8x32::splat(0);
|
||||
let m: i8x32 = simd_lt(a.as_i8x32(), z);
|
||||
simd_bitmask::<_, u32>(m) as i32
|
||||
}
|
||||
|
||||
/// Computes the sum of absolute differences (SADs) of quadruplets of unsigned
|
||||
|
|
|
|||
|
|
@ -1378,7 +1378,9 @@ pub unsafe fn _mm_insert_epi16<const IMM8: i32>(a: __m128i, i: i32) -> __m128i {
|
|||
#[cfg_attr(test, assert_instr(pmovmskb))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mm_movemask_epi8(a: __m128i) -> i32 {
|
||||
simd_bitmask::<_, u16>(a.as_i8x16()) as u32 as i32
|
||||
let z = i8x16::splat(0);
|
||||
let m: i8x16 = simd_lt(a.as_i8x16(), z);
|
||||
simd_bitmask::<_, u16>(m) as u32 as i32
|
||||
}
|
||||
|
||||
/// Shuffles 32-bit integers in `a` using the control in `IMM8`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue