diff options
| author | Ralf Jung <post@ralfj.de> | 2023-12-22 12:31:59 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-02-10 10:13:14 +0100 |
| commit | d96f0c382f0e4d22deafdaed11d9aff1fc1d91f0 (patch) | |
| tree | dbdad9d6dd5252a954e3f6fe4737539f29b9f6a3 /library/core | |
| parent | 68125c72d389060fe9aaee8d87ebd834f417c9fc (diff) | |
| download | rust-d96f0c382f0e4d22deafdaed11d9aff1fc1d91f0.tar.gz rust-d96f0c382f0e4d22deafdaed11d9aff1fc1d91f0.zip | |
simd intrinsics: add simd_shuffle_generic
Diffstat (limited to 'library/core')
| -rw-r--r-- | library/core/src/intrinsics/simd.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index 0fd27974dce..1483be2a699 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -190,14 +190,27 @@ extern "platform-intrinsic" { /// /// `T` must be a vector. /// - /// `U` must be a const array of `i32`s. + /// `U` must be a **const** array of `i32`s. This means it must either refer to a named + /// const or be given as an inline const expression (`const { ... }`). /// /// `V` must be a vector with the same element type as `T` and the same length as `U`. /// - /// Concatenates `x` and `y`, then returns a new vector such that each element is selected from - /// the concatenation by the matching index in `idx`. + /// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy` + /// is the concatenation of `x` and `y`. It is a compile-time error if `idx[i]` is out-of-bounds + /// of `xy`. pub fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V; + /// Shuffle two vectors by const indices. + /// + /// `T` must be a vector. + /// + /// `V` must be a vector with the same element type as `T` and the same length as `IDX`. + /// + /// Returns a new vector such that element `i` is selected from `xy[IDX[i]]`, where `xy` + /// is the concatenation of `x` and `y`. It is a compile-time error if `IDX[i]` is out-of-bounds + /// of `xy`. + pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U; + /// Read a vector of pointers. /// /// `T` must be a vector. |
