Rollup merge of #129696 - RalfJung:stdarch, r=Amanieu

update stdarch

The goal is mostly to pull in https://github.com/rust-lang/stdarch/pull/1633.

r? ```@Amanieu```
This commit is contained in:
Jubilee 2024-09-11 15:53:21 -07:00 committed by GitHub
commit abf0ac5ba0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 10 deletions

@ -1 +1 @@
Subproject commit d9466edb4c53cece8686ee6e17b028436ddf4151
Subproject commit ace72223a0e321c1b0a37b5862aa756fe8ab5111

View File

@ -666,22 +666,19 @@ enum Op {
let (right, right_len) = this.operand_to_simd(right)?;
let (dest, dest_len) = this.mplace_to_simd(dest)?;
// `index` is an array, not a SIMD type
let ty::Array(_, index_len) = index.layout.ty.kind() else {
span_bug!(
this.cur_span(),
"simd_shuffle index argument has non-array type {}",
index.layout.ty
)
// `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.assert_mem_place(), index.len(this)?),
_ => this.operand_to_simd(index)?,
};
let index_len = index_len.eval_target_usize(*this.tcx, this.param_env());
assert_eq!(left_len, right_len);
assert_eq!(index_len, dest_len);
for i in 0..dest_len {
let src_index: u64 = this
.read_immediate(&this.project_index(index, i)?)?
.read_immediate(&this.project_index(&index, i)?)?
.to_scalar()
.to_u32()?
.into();

View File

@ -620,6 +620,10 @@ fn simd_intrinsics() {
);
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,
);
assert_eq!(
simd_shuffle_generic::<_, i32x4, { &[7, 5, 4, 6] }>(a, b),
i32x4::from_array([4, 2, 1, 10]),
@ -628,6 +632,10 @@ fn simd_intrinsics() {
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]),
);
}
}