diff options
| author | Ralf Jung <post@ralfj.de> | 2021-11-17 22:29:21 -0500 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2021-11-18 09:10:35 -0500 |
| commit | 2f1a1f530b253b98e41a138b159c19481eb42269 (patch) | |
| tree | d94a2216178b11d332e462ebc97f50c8b12de3de /src | |
| parent | 41301c3b2371365b753c2ad6a74528a38f3815ce (diff) | |
| download | rust-2f1a1f530b253b98e41a138b159c19481eb42269.tar.gz rust-2f1a1f530b253b98e41a138b159c19481eb42269.zip | |
fix CTFE/Miri simd_insert/extract on array-style repr(simd) types
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/const-eval/simd/insert_extract.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/test/ui/consts/const-eval/simd/insert_extract.rs b/src/test/ui/consts/const-eval/simd/insert_extract.rs index cae8fcf1068..a1cd24077c6 100644 --- a/src/test/ui/consts/const-eval/simd/insert_extract.rs +++ b/src/test/ui/consts/const-eval/simd/insert_extract.rs @@ -7,7 +7,8 @@ #[repr(simd)] struct i8x1(i8); #[repr(simd)] struct u16x2(u16, u16); -#[repr(simd)] struct f32x4(f32, f32, f32, f32); +// Make one of them an array type to ensure those also work. +#[repr(simd)] struct f32x4([f32; 4]); extern "platform-intrinsic" { #[rustc_const_stable(feature = "foo", since = "1.3.37")] @@ -38,12 +39,12 @@ fn main() { assert_eq!(Y1, 42); } { - const U: f32x4 = f32x4(13., 14., 15., 16.); + const U: f32x4 = f32x4([13., 14., 15., 16.]); const V: f32x4 = unsafe { simd_insert(U, 1_u32, 42_f32) }; - const X0: f32 = V.0; - const X1: f32 = V.1; - const X2: f32 = V.2; - const X3: f32 = V.3; + const X0: f32 = V.0[0]; + const X1: f32 = V.0[1]; + const X2: f32 = V.0[2]; + const X3: f32 = V.0[3]; const Y0: f32 = unsafe { simd_extract(V, 0) }; const Y1: f32 = unsafe { simd_extract(V, 1) }; const Y2: f32 = unsafe { simd_extract(V, 2) }; |
