diff --git a/src/shims/intrinsics/simd.rs b/src/shims/intrinsics/simd.rs index 5e488679b8..0dc669849f 100644 --- a/src/shims/intrinsics/simd.rs +++ b/src/shims/intrinsics/simd.rs @@ -495,16 +495,19 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let (right, right_len) = this.operand_to_simd(right)?; let (dest, dest_len) = this.place_to_simd(dest)?; - let index = generic_args[2].expect_const().eval(*this.tcx, this.param_env(), Some(this.tcx.span)).unwrap().unwrap_branch(); + let index = generic_args[2] + .expect_const() + .eval(*this.tcx, this.param_env(), Some(this.tcx.span)) + .unwrap() + .unwrap_branch(); let index_len = index.len(); assert_eq!(left_len, right_len); assert_eq!(index_len as u64, dest_len); for i in 0..dest_len { - let src_index: u64 = index[i as usize].unwrap_leaf() - .try_to_u32().unwrap() - .into(); + let src_index: u64 = + index[i as usize].unwrap_leaf().try_to_u32().unwrap().into(); let dest = this.project_index(&dest, i)?; let val = if src_index < left_len { diff --git a/tests/pass/portable-simd.rs b/tests/pass/portable-simd.rs index c1f5618c16..969162e2c1 100644 --- a/tests/pass/portable-simd.rs +++ b/tests/pass/portable-simd.rs @@ -416,20 +416,14 @@ fn simd_intrinsics() { simd_select(i8x4::from_array([0, -1, -1, 0]), b, a), 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 { [3, 1, 0, 2] }), a,); assert_eq!( - simd_shuffle_generic::<_, i32x4, {&[3, 1, 0, 2]}>(a, b), - a, - ); - assert_eq!( - simd_shuffle::<_, _, i32x4>(a, b, const {[3, 1, 0, 2]}), - a, - ); - assert_eq!( - simd_shuffle_generic::<_, i32x4, {&[7, 5, 4, 6]}>(a, b), + 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 {[7, 5, 4, 6]}), + simd_shuffle::<_, _, i32x4>(a, b, const { [7, 5, 4, 6] }), i32x4::from_array([4, 2, 1, 10]), ); }