Skip to content

Commit 4549266

Browse files
committed
correct the docs on simd_ comparison operators
these all also accept integer vectors as arguments
1 parent 96cfc75 commit 4549266

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

library/core/src/intrinsics/simd.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ pub unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U;
2626

2727
/// Adds two simd vectors elementwise.
2828
///
29-
/// `T` must be a vector of integer or floating point primitive types.
29+
/// `T` must be a vector of integers or floats.
3030
#[rustc_intrinsic]
3131
#[rustc_nounwind]
3232
pub unsafe fn simd_add<T>(_x: T, _y: T) -> T;
3333

3434
/// Subtracts `rhs` from `lhs` elementwise.
3535
///
36-
/// `T` must be a vector of integer or floating point primitive types.
36+
/// `T` must be a vector of integers or floats.
3737
#[rustc_intrinsic]
3838
#[rustc_nounwind]
3939
pub unsafe fn simd_sub<T>(_lhs: T, _rhs: T) -> T;
4040

4141
/// Multiplies two simd vectors elementwise.
4242
///
43-
/// `T` must be a vector of integer or floating point primitive types.
43+
/// `T` must be a vector of integers or floats.
4444
#[rustc_intrinsic]
4545
#[rustc_nounwind]
4646
pub unsafe fn simd_mul<T>(_x: T, _y: T) -> T;
4747

4848
/// Divides `lhs` by `rhs` elementwise.
4949
///
50-
/// `T` must be a vector of integer or floating point primitive types.
50+
/// `T` must be a vector of integers or floats.
5151
///
5252
/// # Safety
5353
/// For integers, `rhs` must not contain any zero elements.
@@ -58,7 +58,7 @@ pub unsafe fn simd_div<T>(_lhs: T, _rhs: T) -> T;
5858

5959
/// Returns remainder of two vectors elementwise.
6060
///
61-
/// `T` must be a vector of integer or floating point primitive types.
61+
/// `T` must be a vector of integers or floats.
6262
///
6363
/// # Safety
6464
/// For integers, `rhs` must not contain any zero elements.
@@ -116,8 +116,7 @@ pub unsafe fn simd_xor<T>(_x: T, _y: T) -> T;
116116

117117
/// Numerically casts a vector, elementwise.
118118
///
119-
/// `T` and `U` must be vectors of integer or floating point primitive types, and must have the
120-
/// same length.
119+
/// `T` and `U` must be vectors of integers or floats, and must have the same length.
121120
///
122121
/// When casting floats to integers, the result is truncated. Out-of-bounds result lead to UB.
123122
/// When casting integers to floats, the result is rounded.
@@ -138,8 +137,7 @@ pub unsafe fn simd_cast<T, U>(_x: T) -> U;
138137

139138
/// Numerically casts a vector, elementwise.
140139
///
141-
/// `T` and `U` be a vectors of integer or floating point primitive types, and must have the
142-
/// same length.
140+
/// `T` and `U` be a vectors of integers or floats, and must have the same length.
143141
///
144142
/// Like `simd_cast`, but saturates float-to-integer conversions (NaN becomes 0).
145143
/// This matches regular `as` and is always safe.
@@ -187,7 +185,7 @@ pub unsafe fn simd_fmax<T>(_x: T, _y: T) -> T;
187185

188186
/// Tests elementwise equality of two vectors.
189187
///
190-
/// `T` must be a vector of floating-point primitive types.
188+
/// `T` must be a vector of integer or floating-point primitive types.
191189
///
192190
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
193191
///
@@ -198,7 +196,7 @@ pub unsafe fn simd_eq<T, U>(_x: T, _y: T) -> U;
198196

199197
/// Tests elementwise inequality equality of two vectors.
200198
///
201-
/// `T` must be a vector of floating-point primitive types.
199+
/// `T` must be a vector of integer or floating-point primitive types.
202200
///
203201
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
204202
///
@@ -209,7 +207,7 @@ pub unsafe fn simd_ne<T, U>(_x: T, _y: T) -> U;
209207

210208
/// Tests if `x` is less than `y`, elementwise.
211209
///
212-
/// `T` must be a vector of floating-point primitive types.
210+
/// `T` must be a vector of integer or floating-point primitive types.
213211
///
214212
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
215213
///
@@ -220,7 +218,7 @@ pub unsafe fn simd_lt<T, U>(_x: T, _y: T) -> U;
220218

221219
/// Tests if `x` is less than or equal to `y`, elementwise.
222220
///
223-
/// `T` must be a vector of floating-point primitive types.
221+
/// `T` must be a vector of integer or floating-point primitive types.
224222
///
225223
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
226224
///
@@ -231,7 +229,7 @@ pub unsafe fn simd_le<T, U>(_x: T, _y: T) -> U;
231229

232230
/// Tests if `x` is greater than `y`, elementwise.
233231
///
234-
/// `T` must be a vector of floating-point primitive types.
232+
/// `T` must be a vector of integer or floating-point primitive types.
235233
///
236234
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
237235
///
@@ -242,7 +240,7 @@ pub unsafe fn simd_gt<T, U>(_x: T, _y: T) -> U;
242240

243241
/// Tests if `x` is greater than or equal to `y`, elementwise.
244242
///
245-
/// `T` must be a vector of floating-point primitive types.
243+
/// `T` must be a vector of integer or floating-point primitive types.
246244
///
247245
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
248246
///

0 commit comments

Comments
 (0)