1
Fork 0

Rollup merge of #136005 - BLANKatGITHUB:library, r=RalfJung

ports last few library files to new intrinsic style

This pr ports the last 2 library files to new intrinsic style this pr is part of issue #132735
This commit is contained in:
Matthias Krüger 2025-01-25 23:15:24 +01:00 committed by GitHub
commit f14993b454
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 959 additions and 679 deletions

View file

@ -302,18 +302,28 @@ impl<'f> Drop for VaListImpl<'f> {
}
}
extern "rust-intrinsic" {
/// Destroy the arglist `ap` after initialization with `va_start` or
/// `va_copy`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
fn va_end(ap: &mut VaListImpl<'_>);
unsafe fn va_end(_ap: &mut VaListImpl<'_>) {
unreachable!()
}
/// Copies the current location of arglist `src` to the arglist `dst`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
fn va_copy<'f>(dest: *mut VaListImpl<'f>, src: &VaListImpl<'f>);
unsafe fn va_copy<'f>(_dest: *mut VaListImpl<'f>, _src: &VaListImpl<'f>) {
unreachable!()
}
/// Loads an argument of type `T` from the `va_list` `ap` and increment the
/// argument `ap` points to.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
fn va_arg<T: sealed_trait::VaArgSafe>(ap: &mut VaListImpl<'_>) -> T;
unsafe fn va_arg<T: sealed_trait::VaArgSafe>(_ap: &mut VaListImpl<'_>) -> T {
unreachable!()
}

View file

@ -2,7 +2,6 @@
//!
//! In this module, a "vector" is any `repr(simd)` type.
extern "rust-intrinsic" {
/// Inserts an element into a vector, returning the updated vector.
///
/// `T` must be a vector with element type `U`.
@ -10,8 +9,12 @@ extern "rust-intrinsic" {
/// # Safety
///
/// `idx` must be in-bounds of the vector.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T;
pub unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T {
unreachable!()
}
/// Extracts an element from a vector.
///
@ -20,26 +23,42 @@ extern "rust-intrinsic" {
/// # Safety
///
/// `idx` must be in-bounds of the vector.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_extract<T, U>(x: T, idx: u32) -> U;
pub unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U {
unreachable!()
}
/// Adds two simd vectors elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_add<T>(x: T, y: T) -> T;
pub unsafe fn simd_add<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// Subtracts `rhs` from `lhs` elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_sub<T>(lhs: T, rhs: T) -> T;
pub unsafe fn simd_sub<T>(_lhs: T, _rhs: T) -> T {
unreachable!()
}
/// Multiplies two simd vectors elementwise.
///
/// `T` must be a vector of integer or floating point primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_mul<T>(x: T, y: T) -> T;
pub unsafe fn simd_mul<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// Divides `lhs` by `rhs` elementwise.
///
@ -48,8 +67,12 @@ extern "rust-intrinsic" {
/// # Safety
/// For integers, `rhs` must not contain any zero elements.
/// Additionally for signed integers, `<int>::MIN / -1` is undefined behavior.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_div<T>(lhs: T, rhs: T) -> T;
pub unsafe fn simd_div<T>(_lhs: T, _rhs: T) -> T {
unreachable!()
}
/// Returns remainder of two vectors elementwise.
///
@ -58,8 +81,12 @@ extern "rust-intrinsic" {
/// # Safety
/// For integers, `rhs` must not contain any zero elements.
/// Additionally for signed integers, `<int>::MIN / -1` is undefined behavior.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_rem<T>(lhs: T, rhs: T) -> T;
pub unsafe fn simd_rem<T>(_lhs: T, _rhs: T) -> T {
unreachable!()
}
/// Shifts vector left elementwise, with UB on overflow.
///
@ -70,8 +97,12 @@ extern "rust-intrinsic" {
/// # Safety
///
/// Each element of `rhs` must be less than `<int>::BITS`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_shl<T>(lhs: T, rhs: T) -> T;
pub unsafe fn simd_shl<T>(_lhs: T, _rhs: T) -> T {
unreachable!()
}
/// Shifts vector right elementwise, with UB on overflow.
///
@ -82,26 +113,42 @@ extern "rust-intrinsic" {
/// # Safety
///
/// Each element of `rhs` must be less than `<int>::BITS`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_shr<T>(lhs: T, rhs: T) -> T;
pub unsafe fn simd_shr<T>(_lhs: T, _rhs: T) -> T {
unreachable!()
}
/// "Ands" vectors elementwise.
///
/// `T` must be a vector of integer primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_and<T>(x: T, y: T) -> T;
pub unsafe fn simd_and<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// "Ors" vectors elementwise.
///
/// `T` must be a vector of integer primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_or<T>(x: T, y: T) -> T;
pub unsafe fn simd_or<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// "Exclusive ors" vectors elementwise.
///
/// `T` must be a vector of integer primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_xor<T>(x: T, y: T) -> T;
pub unsafe fn simd_xor<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// Numerically casts a vector, elementwise.
///
@ -121,8 +168,12 @@ extern "rust-intrinsic" {
/// * Not be `NaN`
/// * Not be infinite
/// * Be representable in the return type, after truncating off its fractional part
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_cast<T, U>(x: T) -> U;
pub unsafe fn simd_cast<T, U>(_x: T) -> U {
unreachable!()
}
/// Numerically casts a vector, elementwise.
///
@ -135,38 +186,58 @@ extern "rust-intrinsic" {
/// When casting floats to integers, the result is truncated.
/// When casting integers to floats, the result is rounded.
/// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_as<T, U>(x: T) -> U;
pub unsafe fn simd_as<T, U>(_x: T) -> U {
unreachable!()
}
/// Negates a vector elementwise.
///
/// `T` must be a vector of integer or floating-point primitive types.
///
/// Rust panics for `-<int>::Min` due to overflow, but it is not UB with this intrinsic.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_neg<T>(x: T) -> T;
pub unsafe fn simd_neg<T>(_x: T) -> T {
unreachable!()
}
/// Returns absolute value of a vector, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fabs<T>(x: T) -> T;
pub unsafe fn simd_fabs<T>(_x: T) -> T {
unreachable!()
}
/// Returns the minimum of two vectors, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
///
/// Follows IEEE-754 `minNum` semantics.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fmin<T>(x: T, y: T) -> T;
pub unsafe fn simd_fmin<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// Returns the maximum of two vectors, elementwise.
///
/// `T` must be a vector of floating-point primitive types.
///
/// Follows IEEE-754 `maxNum` semantics.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fmax<T>(x: T, y: T) -> T;
pub unsafe fn simd_fmax<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// Tests elementwise equality of two vectors.
///
@ -175,8 +246,12 @@ extern "rust-intrinsic" {
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
/// Returns `0` for false and `!0` for true.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_eq<T, U>(x: T, y: T) -> U;
pub unsafe fn simd_eq<T, U>(_x: T, _y: T) -> U {
unreachable!()
}
/// Tests elementwise inequality equality of two vectors.
///
@ -185,8 +260,12 @@ extern "rust-intrinsic" {
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
/// Returns `0` for false and `!0` for true.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_ne<T, U>(x: T, y: T) -> U;
pub unsafe fn simd_ne<T, U>(_x: T, _y: T) -> U {
unreachable!()
}
/// Tests if `x` is less than `y`, elementwise.
///
@ -195,8 +274,12 @@ extern "rust-intrinsic" {
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
/// Returns `0` for false and `!0` for true.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_lt<T, U>(x: T, y: T) -> U;
pub unsafe fn simd_lt<T, U>(_x: T, _y: T) -> U {
unreachable!()
}
/// Tests if `x` is less than or equal to `y`, elementwise.
///
@ -205,8 +288,12 @@ extern "rust-intrinsic" {
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
/// Returns `0` for false and `!0` for true.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_le<T, U>(x: T, y: T) -> U;
pub unsafe fn simd_le<T, U>(_x: T, _y: T) -> U {
unreachable!()
}
/// Tests if `x` is greater than `y`, elementwise.
///
@ -215,8 +302,12 @@ extern "rust-intrinsic" {
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
/// Returns `0` for false and `!0` for true.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_gt<T, U>(x: T, y: T) -> U;
pub unsafe fn simd_gt<T, U>(_x: T, _y: T) -> U {
unreachable!()
}
/// Tests if `x` is greater than or equal to `y`, elementwise.
///
@ -225,8 +316,12 @@ extern "rust-intrinsic" {
/// `U` must be a vector of integers with the same number of elements and element size as `T`.
///
/// Returns `0` for false and `!0` for true.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_ge<T, U>(x: T, y: T) -> U;
pub unsafe fn simd_ge<T, U>(_x: T, _y: T) -> U {
unreachable!()
}
/// Shuffles two vectors by const indices.
///
@ -240,8 +335,12 @@ extern "rust-intrinsic" {
/// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy`
/// is the concatenation of `x` and `y`. It is a compile-time error if `idx[i]` is out-of-bounds
/// of `xy`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
pub unsafe fn simd_shuffle<T, U, V>(_x: T, _y: T, _idx: U) -> V {
unreachable!()
}
/// Reads a vector of pointers.
///
@ -260,8 +359,12 @@ extern "rust-intrinsic" {
/// type).
///
/// `mask` must only contain `0` or `!0` values.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_gather<T, U, V>(val: T, ptr: U, mask: V) -> T;
pub unsafe fn simd_gather<T, U, V>(_val: T, _ptr: U, _mask: V) -> T {
unreachable!()
}
/// Writes to a vector of pointers.
///
@ -283,8 +386,12 @@ extern "rust-intrinsic" {
/// type).
///
/// `mask` must only contain `0` or `!0` values.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_scatter<T, U, V>(val: T, ptr: U, mask: V);
pub unsafe fn simd_scatter<T, U, V>(_val: T, _ptr: U, _mask: V) {
unreachable!()
}
/// Reads a vector of pointers.
///
@ -305,8 +412,12 @@ extern "rust-intrinsic" {
/// type).
///
/// `mask` must only contain `0` or `!0` values.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_masked_load<V, U, T>(mask: V, ptr: U, val: T) -> T;
pub unsafe fn simd_masked_load<V, U, T>(_mask: V, _ptr: U, _val: T) -> T {
unreachable!()
}
/// Writes to a vector of pointers.
///
@ -326,22 +437,34 @@ extern "rust-intrinsic" {
/// type).
///
/// `mask` must only contain `0` or `!0` values.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_masked_store<V, U, T>(mask: V, ptr: U, val: T);
pub unsafe fn simd_masked_store<V, U, T>(_mask: V, _ptr: U, _val: T) {
unreachable!()
}
/// Adds two simd vectors elementwise, with saturation.
///
/// `T` must be a vector of integer primitive types.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_saturating_add<T>(x: T, y: T) -> T;
pub unsafe fn simd_saturating_add<T>(_x: T, _y: T) -> T {
unreachable!()
}
/// Subtracts two simd vectors elementwise, with saturation.
///
/// `T` must be a vector of integer primitive types.
///
/// Subtract `rhs` from `lhs`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_saturating_sub<T>(lhs: T, rhs: T) -> T;
pub unsafe fn simd_saturating_sub<T>(_lhs: T, _rhs: T) -> T {
unreachable!()
}
/// Adds elements within a vector from left to right.
///
@ -350,8 +473,12 @@ extern "rust-intrinsic" {
/// `U` must be the element type of `T`.
///
/// Starting with the value `y`, add the elements of `x` and accumulate.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_add_ordered<T, U>(x: T, y: U) -> U;
pub unsafe fn simd_reduce_add_ordered<T, U>(_x: T, _y: U) -> U {
unreachable!()
}
/// Adds elements within a vector in arbitrary order. May also be re-associated with
/// unordered additions on the inputs/outputs.
@ -359,8 +486,12 @@ extern "rust-intrinsic" {
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be the element type of `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_add_unordered<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_add_unordered<T, U>(_x: T) -> U {
unreachable!()
}
/// Multiplies elements within a vector from left to right.
///
@ -369,8 +500,12 @@ extern "rust-intrinsic" {
/// `U` must be the element type of `T`.
///
/// Starting with the value `y`, multiply the elements of `x` and accumulate.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_mul_ordered<T, U>(x: T, y: U) -> U;
pub unsafe fn simd_reduce_mul_ordered<T, U>(_x: T, _y: U) -> U {
unreachable!()
}
/// Multiplies elements within a vector in arbitrary order. May also be re-associated with
/// unordered additions on the inputs/outputs.
@ -378,8 +513,12 @@ extern "rust-intrinsic" {
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be the element type of `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_mul_unordered<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_mul_unordered<T, U>(_x: T) -> U {
unreachable!()
}
/// Checks if all mask values are true.
///
@ -387,8 +526,12 @@ extern "rust-intrinsic" {
///
/// # Safety
/// `x` must contain only `0` or `!0`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_all<T>(x: T) -> bool;
pub unsafe fn simd_reduce_all<T>(_x: T) -> bool {
unreachable!()
}
/// Checks if any mask value is true.
///
@ -396,8 +539,12 @@ extern "rust-intrinsic" {
///
/// # Safety
/// `x` must contain only `0` or `!0`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_any<T>(x: T) -> bool;
pub unsafe fn simd_reduce_any<T>(_x: T) -> bool {
unreachable!()
}
/// Returns the maximum element of a vector.
///
@ -406,8 +553,12 @@ extern "rust-intrinsic" {
/// `U` must be the element type of `T`.
///
/// For floating-point values, uses IEEE-754 `maxNum`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_max<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_max<T, U>(_x: T) -> U {
unreachable!()
}
/// Returns the minimum element of a vector.
///
@ -416,32 +567,48 @@ extern "rust-intrinsic" {
/// `U` must be the element type of `T`.
///
/// For floating-point values, uses IEEE-754 `minNum`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_min<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_min<T, U>(_x: T) -> U {
unreachable!()
}
/// Logical "ands" all elements together.
///
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be the element type of `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_and<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_and<T, U>(_x: T) -> U {
unreachable!()
}
/// Logical "ors" all elements together.
///
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be the element type of `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_or<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_or<T, U>(_x: T) -> U {
unreachable!()
}
/// Logical "exclusive ors" all elements together.
///
/// `T` must be a vector of integer or floating-point primitive types.
///
/// `U` must be the element type of `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_reduce_xor<T, U>(x: T) -> U;
pub unsafe fn simd_reduce_xor<T, U>(_x: T) -> U {
unreachable!()
}
/// Truncates an integer vector to a bitmask.
///
@ -476,8 +643,12 @@ extern "rust-intrinsic" {
///
/// # Safety
/// `x` must contain only `0` and `!0`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_bitmask<T, U>(x: T) -> U;
pub unsafe fn simd_bitmask<T, U>(_x: T) -> U {
unreachable!()
}
/// Selects elements from a mask.
///
@ -491,8 +662,12 @@ extern "rust-intrinsic" {
///
/// # Safety
/// `mask` must only contain `0` and `!0`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_select<M, T>(mask: M, if_true: T, if_false: T) -> T;
pub unsafe fn simd_select<M, T>(_mask: M, _if_true: T, _if_false: T) -> T {
unreachable!()
}
/// Selects elements from a bitmask.
///
@ -508,8 +683,12 @@ extern "rust-intrinsic" {
///
/// # Safety
/// Padding bits must be all zero.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_select_bitmask<M, T>(m: M, yes: T, no: T) -> T;
pub unsafe fn simd_select_bitmask<M, T>(_m: M, _yes: T, _no: T) -> T {
unreachable!()
}
/// Calculates the offset from a pointer vector elementwise, potentially
/// wrapping.
@ -519,98 +698,158 @@ extern "rust-intrinsic" {
/// `U` must be a vector of `isize` or `usize` with the same number of elements as `T`.
///
/// Operates as if by `<ptr>::wrapping_offset`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_arith_offset<T, U>(ptr: T, offset: U) -> T;
pub unsafe fn simd_arith_offset<T, U>(_ptr: T, _offset: U) -> T {
unreachable!()
}
/// Casts a vector of pointers.
///
/// `T` and `U` must be vectors of pointers with the same number of elements.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_cast_ptr<T, U>(ptr: T) -> U;
pub unsafe fn simd_cast_ptr<T, U>(_ptr: T) -> U {
unreachable!()
}
/// Exposes a vector of pointers as a vector of addresses.
///
/// `T` must be a vector of pointers.
///
/// `U` must be a vector of `usize` with the same length as `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_expose_provenance<T, U>(ptr: T) -> U;
pub unsafe fn simd_expose_provenance<T, U>(_ptr: T) -> U {
unreachable!()
}
/// Creates a vector of pointers from a vector of addresses.
///
/// `T` must be a vector of `usize`.
///
/// `U` must be a vector of pointers, with the same length as `T`.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_with_exposed_provenance<T, U>(addr: T) -> U;
pub unsafe fn simd_with_exposed_provenance<T, U>(_addr: T) -> U {
unreachable!()
}
/// Swaps bytes of each element.
///
/// `T` must be a vector of integers.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_bswap<T>(x: T) -> T;
pub unsafe fn simd_bswap<T>(_x: T) -> T {
unreachable!()
}
/// Reverses bits of each element.
///
/// `T` must be a vector of integers.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_bitreverse<T>(x: T) -> T;
pub unsafe fn simd_bitreverse<T>(_x: T) -> T {
unreachable!()
}
/// Counts the leading zeros of each element.
///
/// `T` must be a vector of integers.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_ctlz<T>(x: T) -> T;
pub unsafe fn simd_ctlz<T>(_x: T) -> T {
unreachable!()
}
/// Counts the number of ones in each element.
///
/// `T` must be a vector of integers.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_ctpop<T>(x: T) -> T;
pub unsafe fn simd_ctpop<T>(_x: T) -> T {
unreachable!()
}
/// Counts the trailing zeros of each element.
///
/// `T` must be a vector of integers.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_cttz<T>(x: T) -> T;
pub unsafe fn simd_cttz<T>(_x: T) -> T {
unreachable!()
}
/// Rounds up each element to the next highest integer-valued float.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_ceil<T>(x: T) -> T;
pub unsafe fn simd_ceil<T>(_x: T) -> T {
unreachable!()
}
/// Rounds down each element to the next lowest integer-valued float.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_floor<T>(x: T) -> T;
pub unsafe fn simd_floor<T>(_x: T) -> T {
unreachable!()
}
/// Rounds each element to the closest integer-valued float.
/// Ties are resolved by rounding away from 0.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_round<T>(x: T) -> T;
pub unsafe fn simd_round<T>(_x: T) -> T {
unreachable!()
}
/// Returns the integer part of each element as an integer-valued float.
/// In other words, non-integer values are truncated towards zero.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_trunc<T>(x: T) -> T;
pub unsafe fn simd_trunc<T>(_x: T) -> T {
unreachable!()
}
/// Takes the square root of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fsqrt<T>(x: T) -> T;
pub unsafe fn simd_fsqrt<T>(_x: T) -> T {
unreachable!()
}
/// Computes `(x*y) + z` for each element, but without any intermediate rounding.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fma<T>(x: T, y: T, z: T) -> T;
pub unsafe fn simd_fma<T>(_x: T, _y: T, _z: T) -> T {
unreachable!()
}
/// Computes `(x*y) + z` for each element, non-deterministically executing either
/// a fused multiply-add or two operations with rounding of the intermediate result.
@ -623,48 +862,79 @@ extern "rust-intrinsic" {
/// and others do not.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_relaxed_fma<T>(x: T, y: T, z: T) -> T;
pub unsafe fn simd_relaxed_fma<T>(_x: T, _y: T, _z: T) -> T {
unreachable!()
}
// Computes the sine of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fsin<T>(a: T) -> T;
pub unsafe fn simd_fsin<T>(_a: T) -> T {
unreachable!()
}
// Computes the cosine of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fcos<T>(a: T) -> T;
pub unsafe fn simd_fcos<T>(_a: T) -> T {
unreachable!()
}
// Computes the exponential function of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fexp<T>(a: T) -> T;
pub unsafe fn simd_fexp<T>(_a: T) -> T {
unreachable!()
}
// Computes 2 raised to the power of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_fexp2<T>(a: T) -> T;
pub unsafe fn simd_fexp2<T>(_a: T) -> T {
unreachable!()
}
// Computes the base 10 logarithm of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_flog10<T>(a: T) -> T;
pub unsafe fn simd_flog10<T>(_a: T) -> T {
unreachable!()
}
// Computes the base 2 logarithm of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_flog2<T>(a: T) -> T;
pub unsafe fn simd_flog2<T>(_a: T) -> T {
unreachable!()
}
// Computes the natural logarithm of each element.
///
/// `T` must be a vector of floats.
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[rustc_nounwind]
pub fn simd_flog<T>(a: T) -> T;
pub unsafe fn simd_flog<T>(_a: T) -> T {
unreachable!()
}