Skip to content

Commit

Permalink
Add #[cfg_attr(miri, ignore)] to SSE and SSE2 that cannot be suppor…
Browse files Browse the repository at this point in the history
…ted by Miri
  • Loading branch information
eduardosm committed Sep 29, 2023
1 parent d310f40 commit 9fb8a71
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/core_arch/src/x86/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,7 @@ mod tests {
}

#[simd_test(enable = "sse")]
#[cfg_attr(miri, ignore)] // Uses _mm_setcsr, which is not supported by Miri
unsafe fn test_mm_comieq_ss_vs_ucomieq_ss() {
// If one of the arguments is a quiet NaN `comieq_ss` should signal an
// Invalid Operation Exception while `ucomieq_ss` should not.
Expand Down Expand Up @@ -3228,11 +3229,14 @@ mod tests {
}

#[simd_test(enable = "sse")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_sfence() {
_mm_sfence();
}

#[simd_test(enable = "sse")]
#[cfg_attr(miri, ignore)] // Miri does not support accesing the CSR
unsafe fn test_mm_getcsr_setcsr_1() {
let saved_csr = _mm_getcsr();

Expand All @@ -3249,6 +3253,7 @@ mod tests {
}

#[simd_test(enable = "sse")]
#[cfg_attr(miri, ignore)] // Miri does not support accesing the CSR
unsafe fn test_mm_getcsr_setcsr_2() {
// Same as _mm_setcsr_1 test, but with opposite flag value.

Expand All @@ -3267,6 +3272,7 @@ mod tests {
}

#[simd_test(enable = "sse")]
#[cfg_attr(miri, ignore)] // Miri does not support accesing the CSR
unsafe fn test_mm_getcsr_setcsr_underflow() {
_MM_SET_EXCEPTION_STATE(0);

Expand Down Expand Up @@ -3305,6 +3311,9 @@ mod tests {
}

#[simd_test(enable = "sse")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
// (non-temporal store)
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_stream_ps() {
let a = _mm_set1_ps(7.0);
let mut mem = Memory { data: [-1.0; 4] };
Expand Down
16 changes: 16 additions & 0 deletions crates/core_arch/src/x86/sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2956,11 +2956,15 @@ mod tests {
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_lfence() {
_mm_lfence();
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_mfence() {
_mm_mfence();
}
Expand Down Expand Up @@ -3828,6 +3832,9 @@ mod tests {
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
// (non-temporal store)
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_maskmoveu_si128() {
let a = _mm_set1_epi8(9);
#[rustfmt::skip]
Expand Down Expand Up @@ -3866,6 +3873,9 @@ mod tests {
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
// (non-temporal store)
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_stream_si128() {
let a = _mm_setr_epi32(1, 2, 3, 4);
let mut r = _mm_undefined_si128();
Expand All @@ -3874,6 +3884,9 @@ mod tests {
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
// (non-temporal store)
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_stream_si32() {
let a: i32 = 7;
let mut mem = boxed::Box::<i32>::new(-1);
Expand Down Expand Up @@ -4562,6 +4575,9 @@ mod tests {
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
// (non-temporal store)
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_stream_pd() {
#[repr(align(128))]
struct Memory {
Expand Down
3 changes: 3 additions & 0 deletions crates/core_arch/src/x86_64/sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ mod tests {
}

#[simd_test(enable = "sse2")]
// Miri cannot support this until it is clear how it fits in the Rust memory model
// (non-temporal store)
#[cfg_attr(miri, ignore)]
unsafe fn test_mm_stream_si64() {
let a: i64 = 7;
let mut mem = boxed::Box::<i64>::new(-1);
Expand Down

0 comments on commit 9fb8a71

Please sign in to comment.