Skip to content

Commit d53b104

Browse files
committed
Update Miri Tests
1 parent faa6ded commit d53b104

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/tools/miri/tests/pass/intrinsics/portable-simd.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,15 @@ fn simd_mask() {
349349
// Non-power-of-2 multi-byte mask.
350350
#[repr(simd, packed)]
351351
#[allow(non_camel_case_types)]
352-
#[derive(Copy, Clone, Debug, PartialEq)]
352+
#[derive(Copy, Clone)]
353353
struct i32x10([i32; 10]);
354354
impl i32x10 {
355355
fn splat(x: i32) -> Self {
356356
Self([x; 10])
357357
}
358+
fn into_array(self) -> [i32; 10] {
359+
unsafe { std::mem::transmute(self) }
360+
}
358361
}
359362
unsafe {
360363
let mask = i32x10([!0, !0, 0, !0, 0, 0, !0, 0, !0, 0]);
@@ -377,19 +380,22 @@ fn simd_mask() {
377380
i32x10::splat(!0), // yes
378381
i32x10::splat(0), // no
379382
);
380-
assert_eq!(selected1, mask);
381-
assert_eq!(selected2, mask);
383+
assert_eq!(selected1.into_array(), mask.into_array());
384+
assert_eq!(selected2.into_array(), mask.into_array());
382385
}
383386

384387
// Test for a mask where the next multiple of 8 is not a power of two.
385388
#[repr(simd, packed)]
386389
#[allow(non_camel_case_types)]
387-
#[derive(Copy, Clone, Debug, PartialEq)]
390+
#[derive(Copy, Clone)]
388391
struct i32x20([i32; 20]);
389392
impl i32x20 {
390393
fn splat(x: i32) -> Self {
391394
Self([x; 20])
392395
}
396+
fn into_array(self) -> [i32; 20] {
397+
unsafe { std::mem::transmute(self) }
398+
}
393399
}
394400
unsafe {
395401
let mask = i32x20([!0, !0, 0, !0, 0, 0, !0, 0, !0, 0, 0, 0, 0, !0, !0, !0, !0, !0, !0, !0]);
@@ -419,8 +425,8 @@ fn simd_mask() {
419425
i32x20::splat(!0), // yes
420426
i32x20::splat(0), // no
421427
);
422-
assert_eq!(selected1, mask);
423-
assert_eq!(selected2, mask);
428+
assert_eq!(selected1.into_array(), mask.into_array());
429+
assert_eq!(selected2.into_array(), mask.into_array());
424430
}
425431
}
426432

@@ -708,12 +714,12 @@ fn simd_ops_non_pow2() {
708714
let x = SimdPacked([1u32; 3]);
709715
let y = SimdPacked([2u32; 3]);
710716
let z = unsafe { intrinsics::simd_add(x, y) };
711-
assert_eq!({ z.0 }, [3u32; 3]);
717+
assert_eq!(unsafe { *(&raw const z).cast::<[u32; 3]>() }, [3u32; 3]);
712718

713719
let x = SimdPadded([1u32; 3]);
714720
let y = SimdPadded([2u32; 3]);
715721
let z = unsafe { intrinsics::simd_add(x, y) };
716-
assert_eq!(z.0, [3u32; 3]);
722+
assert_eq!(unsafe { *(&raw const z).cast::<[u32; 3]>() }, [3u32; 3]);
717723
}
718724

719725
fn main() {

0 commit comments

Comments
 (0)