Merge commit '49cd5dd454
' into sync_cg_clif-2024-06-30
This commit is contained in:
commit
9ec6a02ab3
23 changed files with 441 additions and 292 deletions
|
@ -333,12 +333,7 @@ fn main() {
|
|||
#[cfg(all(not(jit), not(all(windows, target_env = "gnu"))))]
|
||||
test_tls();
|
||||
|
||||
#[cfg(all(
|
||||
not(jit),
|
||||
not(no_unstable_features),
|
||||
target_arch = "x86_64",
|
||||
any(target_os = "linux", target_os = "macos")
|
||||
))]
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))]
|
||||
unsafe {
|
||||
global_asm_test();
|
||||
naked_test();
|
||||
|
@ -367,17 +362,12 @@ fn stack_val_align() {
|
|||
assert_eq!(&a as *const Foo as usize % 8192, 0);
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
not(jit),
|
||||
not(no_unstable_features),
|
||||
target_arch = "x86_64",
|
||||
any(target_os = "linux", target_os = "macos")
|
||||
))]
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))]
|
||||
extern "C" {
|
||||
fn global_asm_test();
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), not(no_unstable_features), target_arch = "x86_64", target_os = "linux"))]
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "linux"))]
|
||||
global_asm! {
|
||||
"
|
||||
.global global_asm_test
|
||||
|
@ -387,7 +377,7 @@ global_asm! {
|
|||
"
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), not(no_unstable_features), target_arch = "x86_64", target_os = "macos"))]
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "macos"))]
|
||||
global_asm! {
|
||||
"
|
||||
.global _global_asm_test
|
||||
|
@ -397,7 +387,7 @@ global_asm! {
|
|||
"
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), not(no_unstable_features), target_arch = "x86_64"))]
|
||||
#[cfg(all(not(jit), target_arch = "x86_64"))]
|
||||
#[naked]
|
||||
extern "C" fn naked_test() {
|
||||
unsafe {
|
||||
|
|
|
@ -251,6 +251,9 @@ unsafe fn test_simd() {
|
|||
test_mm_add_epi8();
|
||||
test_mm_add_pd();
|
||||
test_mm_cvtepi8_epi16();
|
||||
#[cfg(not(jit))]
|
||||
test_mm_cvtps_epi32();
|
||||
test_mm_cvttps_epi32();
|
||||
test_mm_cvtsi128_si64();
|
||||
|
||||
test_mm_extract_epi8();
|
||||
|
@ -476,6 +479,41 @@ unsafe fn test_mm256_permutevar8x32_epi32() {
|
|||
assert_eq_m256i(r, e);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[target_feature(enable = "avx2")]
|
||||
#[cfg(not(jit))]
|
||||
unsafe fn test_mm_cvtps_epi32() {
|
||||
let floats: [f32; 4] = [1.5, -2.5, i32::MAX as f32 + 1.0, f32::NAN];
|
||||
|
||||
let float_vec = _mm_loadu_ps(floats.as_ptr());
|
||||
let int_vec = _mm_cvtps_epi32(float_vec);
|
||||
|
||||
let mut ints: [i32; 4] = [0; 4];
|
||||
_mm_storeu_si128(ints.as_mut_ptr() as *mut __m128i, int_vec);
|
||||
|
||||
// this is very different from `floats.map(|f| f as i32)`!
|
||||
let expected_ints: [i32; 4] = [2, -2, i32::MIN, i32::MIN];
|
||||
|
||||
assert_eq!(ints, expected_ints);
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[target_feature(enable = "avx2")]
|
||||
unsafe fn test_mm_cvttps_epi32() {
|
||||
let floats: [f32; 4] = [1.5, -2.5, i32::MAX as f32 + 1.0, f32::NAN];
|
||||
|
||||
let float_vec = _mm_loadu_ps(floats.as_ptr());
|
||||
let int_vec = _mm_cvttps_epi32(float_vec);
|
||||
|
||||
let mut ints: [i32; 4] = [0; 4];
|
||||
_mm_storeu_si128(ints.as_mut_ptr() as *mut __m128i, int_vec);
|
||||
|
||||
// this is very different from `floats.map(|f| f as i32)`!
|
||||
let expected_ints: [i32; 4] = [1, -2, i32::MIN, i32::MIN];
|
||||
|
||||
assert_eq!(ints, expected_ints);
|
||||
}
|
||||
|
||||
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