correct the docs on simd_ comparison operators

these all also accept integer vectors as arguments
This commit is contained in:
Folkert de Vries 2025-02-24 21:56:26 +01:00
parent 96cfc75584
commit 45492662c7
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C

View File

@ -26,28 +26,28 @@ pub unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U;
/// Adds two simd vectors elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
/// `T` must be a vector of integers or floats.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn simd_add<T>(_x: T, _y: T) -> T;
/// Subtracts `rhs` from `lhs` elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
/// `T` must be a vector of integers or floats.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn simd_sub<T>(_lhs: T, _rhs: T) -> T;
/// Multiplies two simd vectors elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
/// `T` must be a vector of integers or floats.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn simd_mul<T>(_x: T, _y: T) -> T;
/// Divides `lhs` by `rhs` elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
/// `T` must be a vector of integers or floats.
///
/// # Safety
/// For integers, `rhs` must not contain any zero elements.
@ -58,7 +58,7 @@ pub unsafe fn simd_div<T>(_lhs: T, _rhs: T) -> T;
/// Returns remainder of two vectors elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
/// `T` must be a vector of integers or floats.
///
/// # Safety
/// For integers, `rhs` must not contain any zero elements.
@ -116,8 +116,7 @@ pub unsafe fn simd_xor<T>(_x: T, _y: T) -> T;
/// Numerically casts a vector, elementwise.
///
/// `T` and `U` must be vectors of integer or floating point primitive types, and must have the
/// same length.
/// `T` and `U` must be vectors of integers or floats, and must have the same length.
///
/// When casting floats to integers, the result is truncated. Out-of-bounds result lead to UB.
/// When casting integers to floats, the result is rounded.
@ -138,8 +137,7 @@ pub unsafe fn simd_cast<T, U>(_x: T) -> U;
/// Numerically casts a vector, elementwise.
///
/// `T` and `U` be a vectors of integer or floating point primitive types, and must have the
/// same length.
/// `T` and `U` be a vectors of integers or floats, and must have the same length.
///
/// Like `simd_cast`, but saturates float-to-integer conversions (NaN becomes 0).
/// This matches regular `as` and is always safe.
@ -187,7 +185,7 @@ pub unsafe fn simd_fmax<T>(_x: T, _y: T) -> T;
/// Tests elementwise equality of two vectors.
///
/// `T` must be a vector of floating-point primitive types.
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
@ -198,7 +196,7 @@ pub unsafe fn simd_eq<T, U>(_x: T, _y: T) -> U;
/// Tests elementwise inequality equality of two vectors.
///
/// `T` must be a vector of floating-point primitive types.
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
@ -209,7 +207,7 @@ pub unsafe fn simd_ne<T, U>(_x: T, _y: T) -> U;
/// Tests if `x` is less than `y`, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
@ -220,7 +218,7 @@ pub unsafe fn simd_lt<T, U>(_x: T, _y: T) -> U;
/// Tests if `x` is less than or equal to `y`, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
@ -231,7 +229,7 @@ pub unsafe fn simd_le<T, U>(_x: T, _y: T) -> U;
/// Tests if `x` is greater than `y`, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
@ -242,7 +240,7 @@ pub unsafe fn simd_gt<T, U>(_x: T, _y: T) -> U;
/// Tests if `x` is greater than or equal to `y`, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///