Skip to content

Commit a1b5879

Browse files
committed
simd intrinsics: add simd_shuffle_generic
1 parent ef1b78e commit a1b5879

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

library/core/src/intrinsics/simd.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,27 @@ extern "platform-intrinsic" {
190190
///
191191
/// `T` must be a vector.
192192
///
193-
/// `U` must be a const array of `i32`s.
193+
/// `U` must be a **const** array of `i32`s. This means it must either refer to a named
194+
/// const or be given as an inline const expression (`const { ... }`).
194195
///
195196
/// `V` must be a vector with the same element type as `T` and the same length as `U`.
196197
///
197-
/// Concatenates `x` and `y`, then returns a new vector such that each element is selected from
198-
/// the concatenation by the matching index in `idx`.
198+
/// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy`
199+
/// is the concatenation of `x` and `y`. It is a compile-time error if `idx[i]` is out-of-bounds
200+
/// of `xy`.
199201
pub fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
200202

203+
/// Shuffle two vectors by const indices.
204+
///
205+
/// `T` must be a vector.
206+
///
207+
/// `V` must be a vector with the same element type as `T` and the same length as `IDX`.
208+
///
209+
/// Returns a new vector such that element `i` is selected from `xy[IDX[i]]`, where `xy`
210+
/// is the concatenation of `x` and `y`. It is a compile-time error if `IDX[i]` is out-of-bounds
211+
/// of `xy`.
212+
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
213+
201214
/// Read a vector of pointers.
202215
///
203216
/// `T` must be a vector.

0 commit comments

Comments
 (0)