Skip to content

Commit 4d96078

Browse files
committed
Update std::simd usage and test outputs
1 parent f0f795d commit 4d96078

File tree

53 files changed

+175
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+175
-177
lines changed

library/core/src/str/pattern.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
17651765
};
17661766

17671767
// do a naive search if the haystack is too small to fit
1768-
if haystack.len() < Block::LANES + last_byte_offset {
1768+
if haystack.len() < Block::LEN + last_byte_offset {
17691769
return Some(haystack.windows(needle.len()).any(|c| c == needle));
17701770
}
17711771

@@ -1812,7 +1812,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
18121812
let eq_first: Mask = a.simd_eq(first_probe);
18131813
let eq_last: Mask = b.simd_eq(second_probe);
18141814
let both = eq_first.bitand(eq_last);
1815-
let mask = both.to_bitmask();
1815+
let mask = both.to_bitmask() as u16;
18161816

18171817
return mask;
18181818
};
@@ -1822,32 +1822,32 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
18221822
// The loop condition must ensure that there's enough headroom to read LANE bytes,
18231823
// and not only at the current index but also at the index shifted by block_offset
18241824
const UNROLL: usize = 4;
1825-
while i + last_byte_offset + UNROLL * Block::LANES < haystack.len() && !result {
1825+
while i + last_byte_offset + UNROLL * Block::LEN < haystack.len() && !result {
18261826
let mut masks = [0u16; UNROLL];
18271827
for j in 0..UNROLL {
1828-
masks[j] = test_chunk(i + j * Block::LANES);
1828+
masks[j] = test_chunk(i + j * Block::LEN);
18291829
}
18301830
for j in 0..UNROLL {
18311831
let mask = masks[j];
18321832
if mask != 0 {
1833-
result |= check_mask(i + j * Block::LANES, mask, result);
1833+
result |= check_mask(i + j * Block::LEN, mask, result);
18341834
}
18351835
}
1836-
i += UNROLL * Block::LANES;
1836+
i += UNROLL * Block::LEN;
18371837
}
1838-
while i + last_byte_offset + Block::LANES < haystack.len() && !result {
1838+
while i + last_byte_offset + Block::LEN < haystack.len() && !result {
18391839
let mask = test_chunk(i);
18401840
if mask != 0 {
18411841
result |= check_mask(i, mask, result);
18421842
}
1843-
i += Block::LANES;
1843+
i += Block::LEN;
18441844
}
18451845

18461846
// Process the tail that didn't fit into LANES-sized steps.
18471847
// This simply repeats the same procedure but as right-aligned chunk instead
18481848
// of a left-aligned one. The last byte must be exactly flush with the string end so
18491849
// we don't miss a single byte or read out of bounds.
1850-
let i = haystack.len() - last_byte_offset - Block::LANES;
1850+
let i = haystack.len() - last_byte_offset - Block::LEN;
18511851
let mask = test_chunk(i);
18521852
if mask != 0 {
18531853
result |= check_mask(i, mask, result);

src/tools/miri/tests/fail/intrinsics/simd-float-to-int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(portable_simd)]
2-
use std::simd::*;
2+
use std::simd::prelude::*;
33

44
fn main() {
55
unsafe {

src/tools/miri/tests/pass/portable-simd-ptrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@compile-flags: -Zmiri-permissive-provenance
33
#![feature(portable_simd, platform_intrinsics)]
44
use std::ptr;
5-
use std::simd::*;
5+
use std::simd::prelude::*;
66

77
fn main() {
88
// Pointer casts

src/tools/miri/tests/pass/portable-simd.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@compile-flags: -Zmiri-strict-provenance
22
#![feature(portable_simd, platform_intrinsics, adt_const_params, inline_const)]
3-
#![allow(incomplete_features)]
4-
use std::simd::*;
3+
#![allow(incomplete_features, internal_features)]
4+
use std::simd::{prelude::*, StdFloat};
55

66
extern "platform-intrinsic" {
77
pub(crate) fn simd_bitmask<T, U>(x: T) -> U;
@@ -328,14 +328,12 @@ fn simd_cast() {
328328
}
329329

330330
fn simd_swizzle() {
331-
use Which::*;
332-
333331
let a = f32x4::splat(10.0);
334332
let b = f32x4::from_array([1.0, 2.0, 3.0, -4.0]);
335333

336334
assert_eq!(simd_swizzle!(b, [3, 0, 0, 2]), f32x4::from_array([-4.0, 1.0, 1.0, 3.0]));
337335
assert_eq!(simd_swizzle!(b, [1, 2]), f32x2::from_array([2.0, 3.0]));
338-
assert_eq!(simd_swizzle!(b, a, [First(3), Second(0)]), f32x2::from_array([-4.0, 10.0]));
336+
assert_eq!(simd_swizzle!(b, a, [3, 4]), f32x2::from_array([-4.0, 10.0]));
339337
}
340338

341339
fn simd_gather_scatter() {
@@ -417,13 +415,13 @@ fn simd_intrinsics() {
417415
i32x4::from_array([10, 2, 10, 10])
418416
);
419417
assert_eq!(simd_shuffle_generic::<_, i32x4, { &[3, 1, 0, 2] }>(a, b), a,);
420-
assert_eq!(simd_shuffle::<_, _, i32x4>(a, b, const { [3, 1, 0, 2] }), a,);
418+
assert_eq!(simd_shuffle::<_, _, i32x4>(a, b, const { [3u32, 1, 0, 2] }), a,);
421419
assert_eq!(
422420
simd_shuffle_generic::<_, i32x4, { &[7, 5, 4, 6] }>(a, b),
423421
i32x4::from_array([4, 2, 1, 10]),
424422
);
425423
assert_eq!(
426-
simd_shuffle::<_, _, i32x4>(a, b, const { [7, 5, 4, 6] }),
424+
simd_shuffle::<_, _, i32x4>(a, b, const { [7u32, 5, 4, 6] }),
427425
i32x4::from_array([4, 2, 1, 10]),
428426
);
429427
}

tests/codegen/simd/simd-wide-sum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#![crate_type = "lib"]
1111
#![feature(portable_simd)]
1212

13-
use std::simd::{Simd, SimdUint};
13+
use std::simd::prelude::*;
1414
const N: usize = 16;
1515

1616
#[no_mangle]

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
scope 12 {
2929
scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
3030
debug ptr => _6;
31-
scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
31+
scope 14 (inlined std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
3232
debug self => _6;
3333
let mut _9: *mut u8;
3434
scope 15 {
35-
scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
35+
scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
3636
debug ptr => _9;
37-
scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
37+
scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
3838
debug self => _9;
3939
scope 18 {
40-
scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
40+
scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
4141
debug self => _9;
4242
}
4343
}

tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
StorageLive(_4);
3131
StorageLive(_5);
3232
_5 = _3;
33-
_4 = ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind unreachable];
33+
_4 = std::ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind unreachable];
3434
}
3535

3636
bb1: {

tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
StorageLive(_4);
3131
StorageLive(_5);
3232
_5 = _3;
33-
_4 = ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind continue];
33+
_4 = std::ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind continue];
3434
}
3535

3636
bb1: {

0 commit comments

Comments
 (0)