File tree 1 file changed +10
-1
lines changed
src/test/ui/consts/const-eval/simd
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
#[ repr( simd) ] struct i8x1 ( i8 ) ;
9
9
#[ repr( simd) ] struct u16x2 ( u16 , u16 ) ;
10
- // Make one of them an array type to ensure those also work.
10
+ // Make some of them array types to ensure those also work.
11
+ #[ repr( simd) ] struct i8x1_arr ( [ i8 ; 1 ] ) ;
11
12
#[ repr( simd) ] struct f32x4 ( [ f32 ; 4 ] ) ;
12
13
13
14
extern "platform-intrinsic" {
@@ -26,6 +27,14 @@ fn main() {
26
27
assert_eq ! ( X0 , 42 ) ;
27
28
assert_eq ! ( Y0 , 42 ) ;
28
29
}
30
+ {
31
+ const U : i8x1_arr = i8x1_arr ( [ 13 ] ) ;
32
+ const V : i8x1_arr = unsafe { simd_insert ( U , 0_u32 , 42_i8 ) } ;
33
+ const X0 : i8 = V . 0 [ 0 ] ;
34
+ const Y0 : i8 = unsafe { simd_extract ( V , 0 ) } ;
35
+ assert_eq ! ( X0 , 42 ) ;
36
+ assert_eq ! ( Y0 , 42 ) ;
37
+ }
29
38
{
30
39
const U : u16x2 = u16x2 ( 13 , 14 ) ;
31
40
const V : u16x2 = unsafe { simd_insert ( U , 1_u32 , 42_u16 ) } ;
You can’t perform that action at this time.
0 commit comments