Merge commit '3270432f4b
' into sync_cg_clif-2024-05-13
This commit is contained in:
commit
75f8bdbca4
31 changed files with 481 additions and 166 deletions
|
@ -210,6 +210,21 @@ struct I64X2(i64, i64);
|
|||
#[allow(improper_ctypes_definitions)]
|
||||
extern "C" fn foo(_a: I64X2) {}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[target_feature(enable = "sse4.2")]
|
||||
#[cfg(not(jit))]
|
||||
unsafe fn test_crc32() {
|
||||
assert!(is_x86_feature_detected!("sse4.2"));
|
||||
|
||||
let a = 42u32;
|
||||
let b = 0xdeadbeefu64;
|
||||
|
||||
assert_eq!(_mm_crc32_u8(a, b as u8), 4135334616);
|
||||
assert_eq!(_mm_crc32_u16(a, b as u16), 1200687288);
|
||||
assert_eq!(_mm_crc32_u32(a, b as u32), 2543798776);
|
||||
assert_eq!(_mm_crc32_u64(a as u64, b as u64), 241952147);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn test_simd() {
|
||||
|
@ -244,10 +259,14 @@ unsafe fn test_simd() {
|
|||
|
||||
test_mm256_shuffle_epi8();
|
||||
test_mm256_permute2x128_si256();
|
||||
test_mm256_permutevar8x32_epi32();
|
||||
|
||||
#[rustfmt::skip]
|
||||
let mask1 = _mm_movemask_epi8(dbg!(_mm_setr_epi8(255u8 as i8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
|
||||
assert_eq!(mask1, 1);
|
||||
|
||||
#[cfg(not(jit))]
|
||||
test_crc32();
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
|
@ -447,6 +466,16 @@ unsafe fn test_mm256_permute2x128_si256() {
|
|||
assert_eq_m256i(r, e);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[target_feature(enable = "avx2")]
|
||||
unsafe fn test_mm256_permutevar8x32_epi32() {
|
||||
let a = _mm256_setr_epi32(100, 200, 300, 400, 500, 600, 700, 800);
|
||||
let idx = _mm256_setr_epi32(7, 6, 5, 4, 3, 2, 1, 0);
|
||||
let r = _mm256_setr_epi32(800, 700, 600, 500, 400, 300, 200, 100);
|
||||
let e = _mm256_permutevar8x32_epi32(a, idx);
|
||||
assert_eq_m256i(r, e);
|
||||
}
|
||||
|
||||
fn test_checked_mul() {
|
||||
let u: Option<u8> = u8::from_str_radix("1000", 10).ok();
|
||||
assert_eq!(u, None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue