Skip to content

Commit 0304e16

Browse files
committed
CTFE SIMD: also test 1-element array
1 parent 2f1a1f5 commit 0304e16

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: src/test/ui/consts/const-eval/simd/insert_extract.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
#[repr(simd)] struct i8x1(i8);
99
#[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]);
1112
#[repr(simd)] struct f32x4([f32; 4]);
1213

1314
extern "platform-intrinsic" {
@@ -26,6 +27,14 @@ fn main() {
2627
assert_eq!(X0, 42);
2728
assert_eq!(Y0, 42);
2829
}
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+
}
2938
{
3039
const U: u16x2 = u16x2(13, 14);
3140
const V: u16x2 = unsafe { simd_insert(U, 1_u32, 42_u16) };

0 commit comments

Comments
 (0)