44
55/// Inserts an element into a vector, returning the updated vector.
66///
7- /// `T` must be a vector with element type `U`.
7+ /// `T` must be a vector with element type `U`, and `idx` must be `const` .
88///
99/// # Safety
1010///
@@ -16,20 +16,52 @@ pub unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T {
1616 unreachable ! ( )
1717}
1818
19- /// Extracts an element from a vector.
19+ /// Inserts an element into a vector, returning the updated vector.
2020///
2121/// `T` must be a vector with element type `U`.
2222///
23+ /// If the index is `const`, [`simd_insert`] may emit better assembly.
24+ ///
2325/// # Safety
2426///
2527/// `idx` must be in-bounds of the vector.
2628#[ rustc_intrinsic]
2729#[ rustc_intrinsic_must_be_overridden]
2830#[ rustc_nounwind]
31+ pub unsafe fn simd_insert_dyn < T , U > ( _x : T , _idx : u32 , _val : U ) -> T {
32+ unreachable ! ( )
33+ }
34+
35+ /// Extracts an element from a vector.
36+ ///
37+ /// `T` must be a vector with element type `U`, and `idx` must be `const`.
38+ ///
39+ /// # Safety
40+ ///
41+ /// `idx` must be const and in-bounds of the vector.
42+ #[ rustc_intrinsic]
43+ #[ rustc_intrinsic_must_be_overridden]
44+ #[ rustc_nounwind]
2945pub unsafe fn simd_extract < T , U > ( _x : T , _idx : u32 ) -> U {
3046 unreachable ! ( )
3147}
3248
49+ /// Extracts an element from a vector.
50+ ///
51+ /// `T` must be a vector with element type `U`.
52+ ///
53+ /// If the index is `const`, [`simd_extract`] may emit better assembly.
54+ ///
55+ /// # Safety
56+ ///
57+ /// `idx` must be in-bounds of the vector.
58+ #[ rustc_intrinsic]
59+ #[ rustc_intrinsic_must_be_overridden]
60+ #[ rustc_nounwind]
61+ pub unsafe fn simd_extract_dyn < T , U > ( _x : T , _idx : u32 ) -> U {
62+ unreachable ! ( )
63+ }
64+
3365/// Adds two simd vectors elementwise.
3466///
3567/// `T` must be a vector of integer or floating point primitive types.
@@ -342,6 +374,24 @@ pub unsafe fn simd_shuffle<T, U, V>(_x: T, _y: T, _idx: U) -> V {
342374 unreachable ! ( )
343375}
344376
377+ /// Shuffles two vectors by const indices.
378+ ///
379+ /// `T` must be a vector.
380+ ///
381+ /// `U` must be a vector of `u32`s. Contrary to [`simd_shuffle`], this argument does not need to be
382+ /// const, but [`simd_shuffle`] may emit better assembly for a const vector.
383+ ///
384+ /// `V` must be a vector with the same element type as `T` and the same length as `U`.
385+ ///
386+ /// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy`
387+ /// is the concatenation of `x` and `y`.
388+ #[ rustc_intrinsic]
389+ #[ rustc_intrinsic_must_be_overridden]
390+ #[ rustc_nounwind]
391+ pub unsafe fn simd_shuffle_dyn < T , U , V > ( _x : T , _y : T , _idx : U ) -> V {
392+ unreachable ! ( )
393+ }
394+
345395/// Reads a vector of pointers.
346396///
347397/// `T` must be a vector.
0 commit comments