Skip to content

Commit 417c51c

Browse files
committed
intrinsics::simd: document that masks must be signed integer vectors
this is because they may be widened, and that only works when sign extension is used: zero extension would produce invalid results
1 parent 4549266 commit 417c51c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: library/core/src/intrinsics/simd.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub unsafe fn simd_shuffle<T, U, V>(_x: T, _y: T, _idx: U) -> V;
271271
///
272272
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
273273
///
274-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
274+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
275275
///
276276
/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, read the pointer.
277277
/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
@@ -292,7 +292,7 @@ pub unsafe fn simd_gather<T, U, V>(_val: T, _ptr: U, _mask: V) -> T;
292292
///
293293
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
294294
///
295-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
295+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
296296
///
297297
/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, write the
298298
/// corresponding value in `val` to the pointer.
@@ -316,7 +316,7 @@ pub unsafe fn simd_scatter<T, U, V>(_val: T, _ptr: U, _mask: V);
316316
///
317317
/// `U` must be a pointer to the element type of `T`
318318
///
319-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
319+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
320320
///
321321
/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
322322
/// pointer offset from `ptr`.
@@ -339,7 +339,7 @@ pub unsafe fn simd_masked_load<V, U, T>(_mask: V, _ptr: U, _val: T) -> T;
339339
///
340340
/// `U` must be a pointer to the element type of `T`
341341
///
342-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
342+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
343343
///
344344
/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
345345
/// value in `val` to the pointer offset from `ptr`.
@@ -521,9 +521,9 @@ pub unsafe fn simd_bitmask<T, U>(_x: T) -> U;
521521

522522
/// Selects elements from a mask.
523523
///
524-
/// `M` must be an integer vector.
524+
/// `T` must be a vector.
525525
///
526-
/// `T` must be a vector with the same number of elements as `M`.
526+
/// `M` must be a signed integer vector with the same length as `T` (but any element size).
527527
///
528528
/// For each element, if the corresponding value in `mask` is `!0`, select the element from
529529
/// `if_true`. If the corresponding value in `mask` is `0`, select the element from

0 commit comments

Comments
 (0)