1
1
//@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) ]
3
4
use std:: simd:: * ;
4
5
5
6
extern "platform-intrinsic" {
@@ -390,6 +391,8 @@ fn simd_intrinsics() {
390
391
fn simd_reduce_any < T > ( x : T ) -> bool ;
391
392
fn simd_reduce_all < T > ( x : T ) -> bool ;
392
393
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 ;
393
396
}
394
397
unsafe {
395
398
// Make sure simd_eq returns all-1 for `true`
@@ -413,6 +416,22 @@ fn simd_intrinsics() {
413
416
simd_select( i8x4:: from_array( [ 0 , -1 , -1 , 0 ] ) , b, a) ,
414
417
i32x4:: from_array( [ 10 , 2 , 10 , 10 ] )
415
418
) ;
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
+ ) ;
416
435
}
417
436
}
418
437
0 commit comments