Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 60 additions & 8 deletions crates/core_arch/src/x86/avx512bw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10440,7 +10440,7 @@ pub fn _kortestz_mask64_u8(a: __mmask64, b: __mmask64) -> u8 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftli_mask32<const COUNT: u32>(a: __mmask32) -> __mmask32 {
a << COUNT
a.unbounded_shl(COUNT)
}

/// Shift the bits of 64-bit mask a left by count while shifting in zeros, and store the least significant 32 bits of the result in k.
Expand All @@ -10451,7 +10451,7 @@ pub fn _kshiftli_mask32<const COUNT: u32>(a: __mmask32) -> __mmask32 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftli_mask64<const COUNT: u32>(a: __mmask64) -> __mmask64 {
a << COUNT
a.unbounded_shl(COUNT)
}

/// Shift the bits of 32-bit mask a right by count while shifting in zeros, and store the least significant 32 bits of the result in k.
Expand All @@ -10462,7 +10462,7 @@ pub fn _kshiftli_mask64<const COUNT: u32>(a: __mmask64) -> __mmask64 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftri_mask32<const COUNT: u32>(a: __mmask32) -> __mmask32 {
a >> COUNT
a.unbounded_shr(COUNT)
}

/// Shift the bits of 64-bit mask a right by count while shifting in zeros, and store the least significant 32 bits of the result in k.
Expand All @@ -10473,7 +10473,7 @@ pub fn _kshiftri_mask32<const COUNT: u32>(a: __mmask32) -> __mmask32 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftri_mask64<const COUNT: u32>(a: __mmask64) -> __mmask64 {
a >> COUNT
a.unbounded_shr(COUNT)
}

/// Compute the bitwise AND of 32-bit masks a and b, and if the result is all zeros, store 1 in dst,
Expand Down Expand Up @@ -20315,6 +20315,18 @@ mod tests {
let r = _kshiftli_mask32::<3>(a);
let e: __mmask32 = 0b0100101101001011_0100101101001000;
assert_eq!(r, e);

let r = _kshiftli_mask32::<31>(a);
let e: __mmask32 = 0b1000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftli_mask32::<32>(a);
let e: __mmask32 = 0b0000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftli_mask32::<33>(a);
let e: __mmask32 = 0b0000000000000000_0000000000000000;
assert_eq!(r, e);
}

#[simd_test(enable = "avx512bw")]
Expand All @@ -20323,21 +20335,61 @@ mod tests {
let r = _kshiftli_mask64::<3>(a);
let e: __mmask64 = 0b0110100101101001011_0100101101001000;
assert_eq!(r, e);

let r = _kshiftli_mask64::<63>(a);
let e: __mmask64 = 0b1000000000000000_0000000000000000_0000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftli_mask64::<64>(a);
let e: __mmask64 = 0b0000000000000000_0000000000000000_0000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftli_mask64::<65>(a);
let e: __mmask64 = 0b0000000000000000_0000000000000000_0000000000000000_0000000000000000;
assert_eq!(r, e);
}

#[simd_test(enable = "avx512bw")]
unsafe fn test_kshiftri_mask32() {
let a: __mmask32 = 0b0110100101101001_0110100101101001;
let a: __mmask32 = 0b1010100101101001_0110100101101001;
let r = _kshiftri_mask32::<3>(a);
let e: __mmask32 = 0b0000110100101101_0010110100101101;
let e: __mmask32 = 0b0001010100101101_0010110100101101;
assert_eq!(r, e);

let r = _kshiftri_mask32::<31>(a);
let e: __mmask32 = 0b0000000000000000_0000000000000001;
assert_eq!(r, e);

let r = _kshiftri_mask32::<32>(a);
let e: __mmask32 = 0b0000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftri_mask32::<33>(a);
let e: __mmask32 = 0b0000000000000000_0000000000000000;
assert_eq!(r, e);
}

#[simd_test(enable = "avx512bw")]
unsafe fn test_kshiftri_mask64() {
let a: __mmask64 = 0b0110100101101001011_0100101101001000;
let a: __mmask64 = 0b1010100101101001011_0100101101001000;
let r = _kshiftri_mask64::<3>(a);
let e: __mmask64 = 0b0110100101101001_0110100101101001;
let e: __mmask64 = 0b1010100101101001_0110100101101001;
assert_eq!(r, e);

let r = _kshiftri_mask64::<34>(a);
let e: __mmask64 = 0b0000000000000000_0000000000000000_0000000000000000_0000000000000001;
assert_eq!(r, e);

let r = _kshiftri_mask64::<35>(a);
let e: __mmask64 = 0b0000000000000000_0000000000000000_0000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftri_mask64::<64>(a);
let e: __mmask64 = 0b0000000000000000_0000000000000000_0000000000000000_0000000000000000;
assert_eq!(r, e);

let r = _kshiftri_mask64::<65>(a);
let e: __mmask64 = 0b0000000000000000_0000000000000000_0000000000000000_0000000000000000;
assert_eq!(r, e);
}

Expand Down
32 changes: 28 additions & 4 deletions crates/core_arch/src/x86/avx512dq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4602,7 +4602,7 @@ pub fn _kortestz_mask8_u8(a: __mmask8, b: __mmask8) -> u8 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftli_mask8<const COUNT: u32>(a: __mmask8) -> __mmask8 {
a << COUNT
a.unbounded_shl(COUNT)
}

/// Shift 8-bit mask a right by count bits while shifting in zeros, and store the result in dst.
Expand All @@ -4613,7 +4613,7 @@ pub fn _kshiftli_mask8<const COUNT: u32>(a: __mmask8) -> __mmask8 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftri_mask8<const COUNT: u32>(a: __mmask8) -> __mmask8 {
a >> COUNT
a.unbounded_shr(COUNT)
}

/// Compute the bitwise AND of 16-bit masks a and b, and if the result is all zeros, store 1 in dst,
Expand Down Expand Up @@ -9856,13 +9856,37 @@ mod tests {
let r = _kshiftli_mask8::<3>(a);
let e: __mmask8 = 0b01001000;
assert_eq!(r, e);

let r = _kshiftli_mask8::<7>(a);
let e: __mmask8 = 0b10000000;
assert_eq!(r, e);

let r = _kshiftli_mask8::<8>(a);
let e: __mmask8 = 0b00000000;
assert_eq!(r, e);

let r = _kshiftli_mask8::<9>(a);
let e: __mmask8 = 0b00000000;
assert_eq!(r, e);
}

#[simd_test(enable = "avx512dq")]
unsafe fn test_kshiftri_mask8() {
let a: __mmask8 = 0b01101001;
let a: __mmask8 = 0b10101001;
let r = _kshiftri_mask8::<3>(a);
let e: __mmask8 = 0b00001101;
let e: __mmask8 = 0b00010101;
assert_eq!(r, e);

let r = _kshiftri_mask8::<7>(a);
let e: __mmask8 = 0b00000001;
assert_eq!(r, e);

let r = _kshiftri_mask8::<8>(a);
let e: __mmask8 = 0b00000000;
assert_eq!(r, e);

let r = _kshiftri_mask8::<9>(a);
let e: __mmask8 = 0b00000000;
assert_eq!(r, e);
}

Expand Down
32 changes: 28 additions & 4 deletions crates/core_arch/src/x86/avx512f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29090,7 +29090,7 @@ pub fn _kortestz_mask16_u8(a: __mmask16, b: __mmask16) -> u8 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftli_mask16<const COUNT: u32>(a: __mmask16) -> __mmask16 {
a << COUNT
a.unbounded_shl(COUNT)
}

/// Shift 16-bit mask a right by count bits while shifting in zeros, and store the result in dst.
Expand All @@ -29101,7 +29101,7 @@ pub fn _kshiftli_mask16<const COUNT: u32>(a: __mmask16) -> __mmask16 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "stdarch_x86_avx512", since = "1.89")]
pub fn _kshiftri_mask16<const COUNT: u32>(a: __mmask16) -> __mmask16 {
a >> COUNT
a.unbounded_shr(COUNT)
}

/// Load 16-bit mask from memory
Expand Down Expand Up @@ -56001,13 +56001,37 @@ mod tests {
let r = _kshiftli_mask16::<3>(a);
let e: __mmask16 = 0b1011011000011000;
assert_eq!(r, e);

let r = _kshiftli_mask16::<15>(a);
let e: __mmask16 = 0b1000000000000000;
assert_eq!(r, e);

let r = _kshiftli_mask16::<16>(a);
let e: __mmask16 = 0b0000000000000000;
assert_eq!(r, e);

let r = _kshiftli_mask16::<17>(a);
let e: __mmask16 = 0b0000000000000000;
assert_eq!(r, e);
}

#[simd_test(enable = "avx512dq")]
unsafe fn test_kshiftri_mask16() {
let a: __mmask16 = 0b0110100100111100;
let a: __mmask16 = 0b1010100100111100;
let r = _kshiftri_mask16::<3>(a);
let e: __mmask16 = 0b0000110100100111;
let e: __mmask16 = 0b0001010100100111;
assert_eq!(r, e);

let r = _kshiftri_mask16::<15>(a);
let e: __mmask16 = 0b0000000000000001;
assert_eq!(r, e);

let r = _kshiftri_mask16::<16>(a);
let e: __mmask16 = 0b0000000000000000;
assert_eq!(r, e);

let r = _kshiftri_mask16::<17>(a);
let e: __mmask16 = 0b0000000000000000;
assert_eq!(r, e);
}

Expand Down