Skip to content

Commit 468d56e

Browse files
committed
Auto merge of #99491 - workingjubilee:sync-psimd, r=workingjubilee
Sync in portable-simd subtree r? `@ghost`
2 parents aefe4bd + aac8fa2 commit 468d56e

33 files changed

+1608
-881
lines changed

core/src/slice/mod.rs

Lines changed: 1 addition & 0 deletions
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>();

core/tests/simd.rs

Lines changed: 1 addition & 0 deletions
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() {

portable-simd/beginners-guide.md

Lines changed: 5 additions & 0 deletions
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+

portable-simd/crates/core_simd/Cargo.toml

Lines changed: 2 additions & 1 deletion
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

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

Lines changed: 0 additions & 120 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
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)