Skip to content

Commit 78636b7

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 6e7b1d5 commit 78636b7

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
@@ -273,7 +273,7 @@ pub unsafe fn simd_shuffle<T, U, V>(_x: T, _y: T, _idx: U) -> V;
273273
///
274274
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
275275
///
276-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
276+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
277277
///
278278
/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, read the pointer.
279279
/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
@@ -294,7 +294,7 @@ pub unsafe fn simd_gather<T, U, V>(_val: T, _ptr: U, _mask: V) -> T;
294294
///
295295
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
296296
///
297-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
297+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
298298
///
299299
/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, write the
300300
/// corresponding value in `val` to the pointer.
@@ -318,7 +318,7 @@ pub unsafe fn simd_scatter<T, U, V>(_val: T, _ptr: U, _mask: V);
318318
///
319319
/// `U` must be a pointer to the element type of `T`
320320
///
321-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
321+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
322322
///
323323
/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
324324
/// pointer offset from `ptr`.
@@ -341,7 +341,7 @@ pub unsafe fn simd_masked_load<V, U, T>(_mask: V, _ptr: U, _val: T) -> T;
341341
///
342342
/// `U` must be a pointer to the element type of `T`
343343
///
344-
/// `V` must be a vector of integers with the same length as `T` (but any element size).
344+
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
345345
///
346346
/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
347347
/// value in `val` to the pointer offset from `ptr`.
@@ -523,9 +523,9 @@ pub unsafe fn simd_bitmask<T, U>(_x: T) -> U;
523523

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

0 commit comments

Comments
 (0)