Skip to content

Commit a9030e6

Browse files
committed
Add tests for simd_shuffle{_generic}
1 parent 1a01e57 commit a9030e6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@compile-flags: -Zmiri-strict-provenance
2-
#![feature(portable_simd, platform_intrinsics)]
2+
#![feature(portable_simd, platform_intrinsics, adt_const_params, inline_const)]
3+
#![allow(incomplete_features)]
34
use std::simd::*;
45

56
extern "platform-intrinsic" {
@@ -390,6 +391,8 @@ fn simd_intrinsics() {
390391
fn simd_reduce_any<T>(x: T) -> bool;
391392
fn simd_reduce_all<T>(x: T) -> bool;
392393
fn simd_select<M, T>(m: M, yes: T, no: T) -> T;
394+
fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
395+
fn simd_shuffle<T, IDX, U>(x: T, y: T, idx: IDX) -> U;
393396
}
394397
unsafe {
395398
// Make sure simd_eq returns all-1 for `true`
@@ -413,6 +416,22 @@ fn simd_intrinsics() {
413416
simd_select(i8x4::from_array([0, -1, -1, 0]), b, a),
414417
i32x4::from_array([10, 2, 10, 10])
415418
);
419+
assert_eq!(
420+
simd_shuffle_generic::<_, i32x4, {&[3, 1, 0, 2]}>(a, b),
421+
a,
422+
);
423+
assert_eq!(
424+
simd_shuffle::<_, _, i32x4>(a, b, const {[3, 1, 0, 2]}),
425+
a,
426+
);
427+
assert_eq!(
428+
simd_shuffle_generic::<_, i32x4, {&[7, 5, 4, 6]}>(a, b),
429+
i32x4::from_array([4, 2, 1, 10]),
430+
);
431+
assert_eq!(
432+
simd_shuffle::<_, _, i32x4>(a, b, const {[7, 5, 4, 6]}),
433+
i32x4::from_array([4, 2, 1, 10]),
434+
);
416435
}
417436
}
418437

0 commit comments

Comments
 (0)