From 6cd6ae3ca38b003a5509be169cffeca3542d891e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 12 Sep 2024 11:33:13 +0200 Subject: [PATCH] simd_shuffle: require index argument to be a vector --- src/intrinsics/simd.rs | 8 +------- tests/pass/intrinsics/portable-simd.rs | 5 ----- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index aa91b89d0e..e22306ca82 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -664,15 +664,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let [left, right, index] = check_arg_count(args)?; let (left, left_len) = this.project_to_simd(left)?; let (right, right_len) = this.project_to_simd(right)?; + let (index, index_len) = this.project_to_simd(index)?; let (dest, dest_len) = this.project_to_simd(dest)?; - // `index` is an array or a SIMD type - let (index, index_len) = match index.layout.ty.kind() { - // FIXME: remove this once `index` must always be a SIMD vector. - ty::Array(..) => (index.clone(), index.len(this)?), - _ => this.project_to_simd(index)?, - }; - assert_eq!(left_len, right_len); assert_eq!(index_len, dest_len); diff --git a/tests/pass/intrinsics/portable-simd.rs b/tests/pass/intrinsics/portable-simd.rs index daf75fee8f..4c0d6f5242 100644 --- a/tests/pass/intrinsics/portable-simd.rs +++ b/tests/pass/intrinsics/portable-simd.rs @@ -619,7 +619,6 @@ fn simd_intrinsics() { i32x4::from_array([10, 2, 10, 10]) ); assert_eq!(simd_shuffle_generic::<_, i32x4, { &[3, 1, 0, 2] }>(a, b), a,); - assert_eq!(simd_shuffle::<_, _, i32x4>(a, b, const { [3u32, 1, 0, 2] }), a,); assert_eq!( simd_shuffle::<_, _, i32x4>(a, b, const { u32x4::from_array([3u32, 1, 0, 2]) }), a, @@ -628,10 +627,6 @@ fn simd_intrinsics() { simd_shuffle_generic::<_, i32x4, { &[7, 5, 4, 6] }>(a, b), i32x4::from_array([4, 2, 1, 10]), ); - assert_eq!( - simd_shuffle::<_, _, i32x4>(a, b, const { [7u32, 5, 4, 6] }), - i32x4::from_array([4, 2, 1, 10]), - ); assert_eq!( simd_shuffle::<_, _, i32x4>(a, b, const { u32x4::from_array([7u32, 5, 4, 6]) }), i32x4::from_array([4, 2, 1, 10]),