Skip to content

Commit 131fd71

Browse files
committed
Auto merge of #126240 - matthiaskrgr:rollup-ks4o2n9, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #126063 (Remove some unused crate dependencies.) - #126115 (Fix ICE due to `unwrap` in `probe_for_name_many`) - #126159 (ScalarInt: size mismatches are a bug, do not delay the panic) - #126184 (interpret: do not ICE on padded non-pow2 SIMD vectors) - #126191 (Fix `NonZero` doctest inconsistencies) - #126211 (migrate tests/run-make/llvm-outputs to use rmake.rs) - #126212 (fix: build on haiku) - #126215 (Add explanatory note to async block type mismatch error) - #126223 (run-make: add `run_in_tmpdir` self-test) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9e58024 + 6fdba21 commit 131fd71

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

src/intrinsics/simd.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
645645
for i in 0..dest_len {
646646
let src_index: u64 = index[usize::try_from(i).unwrap()]
647647
.unwrap_leaf()
648-
.try_to_u32()
649-
.unwrap()
648+
.to_u32()
650649
.into();
651650
let dest = this.project_index(&dest, i)?;
652651

src/shims/unix/socket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5151

5252
let fds = &mut this.machine.fds;
5353
let sv0 = fds.insert_fd(FileDescriptor::new(SocketPair));
54-
let sv0 = Scalar::try_from_int(sv0, sv.layout.size).unwrap();
54+
let sv0 = Scalar::from_int(sv0, sv.layout.size);
5555
let sv1 = fds.insert_fd(FileDescriptor::new(SocketPair));
56-
let sv1 = Scalar::try_from_int(sv1, sv.layout.size).unwrap();
56+
let sv1 = Scalar::from_int(sv1, sv.layout.size);
5757

5858
this.write_scalar(sv0, &sv)?;
5959
this.write_scalar(sv1, &sv.offset(sv.layout.size, sv.layout, this)?)?;

tests/pass/intrinsics/portable-simd.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,32 @@ fn simd_masked_loadstore() {
658658
assert_eq!(buf, [2, 3, 4]);
659659
}
660660

661+
fn simd_ops_non_pow2() {
662+
// Just a little smoke test for operations on non-power-of-two vectors.
663+
#[repr(simd, packed)]
664+
#[derive(Copy, Clone)]
665+
pub struct SimdPacked<T, const N: usize>([T; N]);
666+
#[repr(simd)]
667+
#[derive(Copy, Clone)]
668+
pub struct SimdPadded<T, const N: usize>([T; N]);
669+
670+
let x = SimdPacked([1u32; 3]);
671+
let y = SimdPacked([2u32; 3]);
672+
let z = unsafe { intrinsics::simd_add(x, y) };
673+
assert_eq!({ z.0 }, [3u32; 3]);
674+
675+
let x = SimdPadded([1u32; 3]);
676+
let y = SimdPadded([2u32; 3]);
677+
let z = unsafe { intrinsics::simd_add(x, y) };
678+
assert_eq!(z.0, [3u32; 3]);
679+
}
680+
661681
fn main() {
662682
simd_mask();
663683
simd_ops_f32();
664684
simd_ops_f64();
665685
simd_ops_i32();
686+
simd_ops_non_pow2();
666687
simd_cast();
667688
simd_swizzle();
668689
simd_gather_scatter();

0 commit comments

Comments
 (0)