Skip to content

Commit 41419e7

Browse files
committed
Auto merge of rust-lang#99491 - workingjubilee:sync-psimd, r=workingjubilee
Sync in portable-simd subtree r? `@ghost`
2 parents e7a9c11 + f8aa494 commit 41419e7

37 files changed

+1617
-889
lines changed

library/core/src/slice/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3569,6 +3569,7 @@ impl<T> [T] {
35693569
///
35703570
/// ```
35713571
/// #![feature(portable_simd)]
3572+
/// use core::simd::SimdFloat;
35723573
///
35733574
/// let short = &[1, 2, 3];
35743575
/// let (prefix, middle, suffix) = short.as_simd::<4>();

library/core/tests/simd.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use core::simd::f32x4;
2+
use core::simd::SimdFloat;
23

34
#[test]
45
fn testing() {

library/portable-simd/beginners-guide.md

+5
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,10 @@ Fortunately, most SIMD types have a fairly predictable size. `i32x4` is bit-equi
8282

8383
However, this is not the same as alignment. Computer architectures generally prefer aligned accesses, especially when moving data between memory and vector registers, and while some support specialized operations that can bend the rules to help with this, unaligned access is still typically slow, or even undefined behavior. In addition, different architectures can require different alignments when interacting with their native SIMD types. For this reason, any `#[repr(simd)]` type has a non-portable alignment. If it is necessary to directly interact with the alignment of these types, it should be via [`mem::align_of`].
8484

85+
When working with slices, data correctly aligned for SIMD can be acquired using the [`as_simd`] and [`as_simd_mut`] methods of the slice primitive.
86+
8587
[`mem::transmute`]: https://doc.rust-lang.org/core/mem/fn.transmute.html
8688
[`mem::align_of`]: https://doc.rust-lang.org/core/mem/fn.align_of.html
89+
[`as_simd`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_simd
90+
[`as_simd_mut`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_simd_mut
91+

library/portable-simd/crates/core_simd/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ categories = ["hardware-support", "no-std"]
99
license = "MIT OR Apache-2.0"
1010

1111
[features]
12-
default = []
12+
default = ["as_crate"]
13+
as_crate = []
1314
std = []
1415
generic_const_exprs = []
1516

library/portable-simd/crates/core_simd/src/comparisons.rs

-120
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
mod float;
2+
mod int;
3+
mod uint;
4+
5+
mod sealed {
6+
pub trait Sealed {}
7+
}
8+
9+
pub use float::*;
10+
pub use int::*;
11+
pub use uint::*;

0 commit comments

Comments
 (0)