about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2021-11-17 22:29:21 -0500
committerRalf Jung <post@ralfj.de>2021-11-18 09:10:35 -0500
commit2f1a1f530b253b98e41a138b159c19481eb42269 (patch)
treed94a2216178b11d332e462ebc97f50c8b12de3de /src
parent41301c3b2371365b753c2ad6a74528a38f3815ce (diff)
downloadrust-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.rs13
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) };