This commit is contained in:
Ralf Jung 2023-09-30 23:30:51 +02:00
parent 9a86bba831
commit 45d5733ccb
2 changed files with 11 additions and 14 deletions

View File

@ -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 {

View File

@ -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]),
);
}