Skip to content

Commit 4935bf0

Browse files
eduardosmAmanieu
authored andcommitted
Add #[cfg_attr(miri, ignore)] to tests of functions that cannot be supported by Miri
This includes functions that use inline assemby or that do certains operations such as saving/restoring the processor state.
1 parent 6f9e038 commit 4935bf0

File tree

9 files changed

+27
-0
lines changed

9 files changed

+27
-0
lines changed

crates/core_arch/src/x86/bt.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ mod tests {
9191
use crate::core_arch::x86::*;
9292

9393
#[test]
94+
#[cfg_attr(miri, ignore)] // Uses inline assembly
9495
fn test_bittest() {
9596
unsafe {
9697
let a = 0b0101_0000i32;
@@ -100,6 +101,7 @@ mod tests {
100101
}
101102

102103
#[test]
104+
#[cfg_attr(miri, ignore)] // Uses inline assembly
103105
fn test_bittestandset() {
104106
unsafe {
105107
let mut a = 0b0101_0000i32;
@@ -111,6 +113,7 @@ mod tests {
111113
}
112114

113115
#[test]
116+
#[cfg_attr(miri, ignore)] // Uses inline assembly
114117
fn test_bittestandreset() {
115118
unsafe {
116119
let mut a = 0b0101_0000i32;
@@ -122,6 +125,7 @@ mod tests {
122125
}
123126

124127
#[test]
128+
#[cfg_attr(miri, ignore)] // Uses inline assembly
125129
fn test_bittestandcomplement() {
126130
unsafe {
127131
let mut a = 0b0101_0000i32;

crates/core_arch/src/x86/cpuid.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,15 @@ mod tests {
185185
use crate::core_arch::x86::*;
186186

187187
#[test]
188+
#[cfg_attr(miri, ignore)] // Uses inline assembly
188189
fn test_always_has_cpuid() {
189190
// all currently-tested targets have the instruction
190191
// FIXME: add targets without `cpuid` to CI
191192
assert!(cpuid::has_cpuid());
192193
}
193194

194195
#[test]
196+
#[cfg_attr(miri, ignore)] // Uses inline assembly
195197
fn test_has_cpuid_idempotent() {
196198
assert_eq!(cpuid::has_cpuid(), cpuid::has_cpuid());
197199
}

crates/core_arch/src/x86/eflags.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ mod tests {
7171
use crate::core_arch::x86::*;
7272

7373
#[test]
74+
#[cfg_attr(miri, ignore)] // Uses inline assembly
7475
#[allow(deprecated)]
7576
fn test_eflags() {
7677
unsafe {

crates/core_arch/src/x86/fxsr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ mod tests {
100100
}
101101

102102
#[simd_test(enable = "fxsr")]
103+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
103104
unsafe fn fxsave() {
104105
let mut a = FxsaveArea::new();
105106
let mut b = FxsaveArea::new();

crates/core_arch/src/x86/sse4a.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ mod tests {
122122
}
123123

124124
#[simd_test(enable = "sse4a")]
125+
// Miri cannot support this until it is clear how it fits in the Rust memory model
126+
// (non-temporal store)
127+
#[cfg_attr(miri, ignore)]
125128
unsafe fn test_mm_stream_sd() {
126129
let mut mem = MemoryF64 {
127130
data: [1.0_f64, 2.0],
@@ -144,6 +147,9 @@ mod tests {
144147
}
145148

146149
#[simd_test(enable = "sse4a")]
150+
// Miri cannot support this until it is clear how it fits in the Rust memory model
151+
// (non-temporal store)
152+
#[cfg_attr(miri, ignore)]
147153
unsafe fn test_mm_stream_ss() {
148154
let mut mem = MemoryF32 {
149155
data: [1.0_f32, 2.0, 3.0, 4.0],

crates/core_arch/src/x86/xsave.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ mod tests {
211211
// FIXME: https://github.com/rust-lang/stdarch/issues/209
212212
/*
213213
#[simd_test(enable = "xsave")]
214+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
214215
unsafe fn xsave() {
215216
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
216217
let mut a = XsaveArea::new();
@@ -224,6 +225,7 @@ mod tests {
224225
*/
225226

226227
#[simd_test(enable = "xsave")]
228+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
227229
unsafe fn xgetbv_xsetbv() {
228230
let xcr_n: u32 = _XCR_XFEATURE_ENABLED_MASK;
229231

@@ -239,6 +241,7 @@ mod tests {
239241
// FIXME: https://github.com/rust-lang/stdarch/issues/209
240242
/*
241243
#[simd_test(enable = "xsave,xsaveopt")]
244+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
242245
unsafe fn xsaveopt() {
243246
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
244247
let mut a = XsaveArea::new();
@@ -254,6 +257,7 @@ mod tests {
254257
// FIXME: this looks like a bug in Intel's SDE:
255258
#[cfg(not(stdarch_intel_sde))]
256259
#[simd_test(enable = "xsave,xsavec")]
260+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
257261
unsafe fn xsavec() {
258262
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
259263
let mut a = XsaveArea::new();

crates/core_arch/src/x86_64/bt.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ mod tests {
9191
use crate::core_arch::x86_64::*;
9292

9393
#[test]
94+
#[cfg_attr(miri, ignore)] // Uses inline assembly
9495
fn test_bittest64() {
9596
unsafe {
9697
let a = 0b0101_0000i64;
@@ -100,6 +101,7 @@ mod tests {
100101
}
101102

102103
#[test]
104+
#[cfg_attr(miri, ignore)] // Uses inline assembly
103105
fn test_bittestandset64() {
104106
unsafe {
105107
let mut a = 0b0101_0000i64;
@@ -111,6 +113,7 @@ mod tests {
111113
}
112114

113115
#[test]
116+
#[cfg_attr(miri, ignore)] // Uses inline assembly
114117
fn test_bittestandreset64() {
115118
unsafe {
116119
let mut a = 0b0101_0000i64;
@@ -122,6 +125,7 @@ mod tests {
122125
}
123126

124127
#[test]
128+
#[cfg_attr(miri, ignore)] // Uses inline assembly
125129
fn test_bittestandcomplement64() {
126130
unsafe {
127131
let mut a = 0b0101_0000i64;

crates/core_arch/src/x86_64/fxsr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ mod tests {
100100
}
101101

102102
#[simd_test(enable = "fxsr")]
103+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
103104
unsafe fn fxsave64() {
104105
let mut a = FxsaveArea::new();
105106
let mut b = FxsaveArea::new();

crates/core_arch/src/x86_64/xsave.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ mod tests {
177177
}
178178
179179
#[simd_test(enable = "xsave")]
180+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
180181
unsafe fn xsave64() {
181182
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
182183
let mut a = XsaveArea::new();
@@ -189,6 +190,7 @@ mod tests {
189190
}
190191
191192
#[simd_test(enable = "xsave,xsaveopt")]
193+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
192194
unsafe fn xsaveopt64() {
193195
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
194196
let mut a = XsaveArea::new();
@@ -201,6 +203,7 @@ mod tests {
201203
}
202204
203205
#[simd_test(enable = "xsave,xsavec")]
206+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
204207
unsafe fn xsavec64() {
205208
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
206209
let mut a = XsaveArea::new();
@@ -213,6 +216,7 @@ mod tests {
213216
}
214217
215218
#[simd_test(enable = "xsave,xsaves")]
219+
#[cfg_attr(miri, ignore)] // Register saving/restoring is not supported in Miri
216220
unsafe fn xsaves64() {
217221
let m = 0xFFFFFFFFFFFFFFFF_u64; //< all registers
218222
let mut a = XsaveArea::new();

0 commit comments

Comments
 (0)