Mark float intrinsics with no preconditions as safe

This commit is contained in:
ltdk
2025-09-17 14:07:23 -04:00
parent 987f9603f9
commit 055e05a338
19 changed files with 222 additions and 188 deletions

View File

@@ -81,22 +81,62 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
| sym::bswap
| sym::caller_location
| sym::carrying_mul_add
| sym::ceilf16
| sym::ceilf32
| sym::ceilf64
| sym::ceilf128
| sym::cold_path
| sym::const_eval_select
| sym::contract_check_ensures
| sym::contract_check_requires
| sym::contract_checks
| sym::cosf16
| sym::cosf32
| sym::cosf64
| sym::cosf128
| sym::ctlz
| sym::ctpop
| sym::cttz
| sym::discriminant_value
| sym::exp2f16
| sym::exp2f32
| sym::exp2f64
| sym::exp2f128
| sym::expf16
| sym::expf32
| sym::expf64
| sym::expf128
| sym::fadd_algebraic
| sym::fdiv_algebraic
| sym::floorf16
| sym::floorf32
| sym::floorf64
| sym::floorf128
| sym::fmaf16
| sym::fmaf32
| sym::fmaf64
| sym::fmaf128
| sym::fmul_algebraic
| sym::fmuladdf16
| sym::fmuladdf32
| sym::fmuladdf64
| sym::fmuladdf128
| sym::forget
| sym::frem_algebraic
| sym::fsub_algebraic
| sym::is_val_statically_known
| sym::log2f16
| sym::log2f32
| sym::log2f64
| sym::log2f128
| sym::log10f16
| sym::log10f32
| sym::log10f64
| sym::log10f128
| sym::logf16
| sym::logf32
| sym::logf64
| sym::logf128
| sym::maximumf16
| sym::maximumf32
| sym::maximumf64
@@ -115,6 +155,14 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
| sym::minnumf128
| sym::mul_with_overflow
| sym::needs_drop
| sym::powf16
| sym::powf32
| sym::powf64
| sym::powf128
| sym::powif16
| sym::powif32
| sym::powif64
| sym::powif128
| sym::prefetch_read_data
| sym::prefetch_read_instruction
| sym::prefetch_write_data
@@ -128,13 +176,29 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
| sym::round_ties_even_f32
| sym::round_ties_even_f64
| sym::round_ties_even_f128
| sym::roundf16
| sym::roundf32
| sym::roundf64
| sym::roundf128
| sym::rustc_peek
| sym::saturating_add
| sym::saturating_sub
| sym::select_unpredictable
| sym::sinf16
| sym::sinf32
| sym::sinf64
| sym::sinf128
| sym::size_of
| sym::sqrtf16
| sym::sqrtf32
| sym::sqrtf64
| sym::sqrtf128
| sym::sub_with_overflow
| sym::three_way_compare
| sym::truncf16
| sym::truncf32
| sym::truncf64
| sym::truncf128
| sym::type_id
| sym::type_id_eq
| sym::type_name

View File

@@ -289,7 +289,7 @@ macro_rules! float_impl {
cfg_if! {
// fma is not yet available in `core`
if #[cfg(intrinsics_enabled)] {
unsafe{ core::intrinsics::$fma_intrinsic(self, y, z) }
core::intrinsics::$fma_intrinsic(self, y, z)
} else {
super::super::$fma_fn(self, y, z)
}

View File

@@ -1022,28 +1022,28 @@ pub unsafe fn unaligned_volatile_store<T>(dst: *mut T, val: T);
/// [`f16::sqrt`](../../std/primitive.f16.html#method.sqrt)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sqrtf16(x: f16) -> f16;
pub fn sqrtf16(x: f16) -> f16;
/// Returns the square root of an `f32`
///
/// The stabilized version of this intrinsic is
/// [`f32::sqrt`](../../std/primitive.f32.html#method.sqrt)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sqrtf32(x: f32) -> f32;
pub fn sqrtf32(x: f32) -> f32;
/// Returns the square root of an `f64`
///
/// The stabilized version of this intrinsic is
/// [`f64::sqrt`](../../std/primitive.f64.html#method.sqrt)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sqrtf64(x: f64) -> f64;
pub fn sqrtf64(x: f64) -> f64;
/// Returns the square root of an `f128`
///
/// The stabilized version of this intrinsic is
/// [`f128::sqrt`](../../std/primitive.f128.html#method.sqrt)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sqrtf128(x: f128) -> f128;
pub fn sqrtf128(x: f128) -> f128;
/// Raises an `f16` to an integer power.
///
@@ -1051,28 +1051,28 @@ pub unsafe fn sqrtf128(x: f128) -> f128;
/// [`f16::powi`](../../std/primitive.f16.html#method.powi)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powif16(a: f16, x: i32) -> f16;
pub fn powif16(a: f16, x: i32) -> f16;
/// Raises an `f32` to an integer power.
///
/// The stabilized version of this intrinsic is
/// [`f32::powi`](../../std/primitive.f32.html#method.powi)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powif32(a: f32, x: i32) -> f32;
pub fn powif32(a: f32, x: i32) -> f32;
/// Raises an `f64` to an integer power.
///
/// The stabilized version of this intrinsic is
/// [`f64::powi`](../../std/primitive.f64.html#method.powi)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powif64(a: f64, x: i32) -> f64;
pub fn powif64(a: f64, x: i32) -> f64;
/// Raises an `f128` to an integer power.
///
/// The stabilized version of this intrinsic is
/// [`f128::powi`](../../std/primitive.f128.html#method.powi)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powif128(a: f128, x: i32) -> f128;
pub fn powif128(a: f128, x: i32) -> f128;
/// Returns the sine of an `f16`.
///
@@ -1080,28 +1080,28 @@ pub unsafe fn powif128(a: f128, x: i32) -> f128;
/// [`f16::sin`](../../std/primitive.f16.html#method.sin)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sinf16(x: f16) -> f16;
pub fn sinf16(x: f16) -> f16;
/// Returns the sine of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::sin`](../../std/primitive.f32.html#method.sin)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sinf32(x: f32) -> f32;
pub fn sinf32(x: f32) -> f32;
/// Returns the sine of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::sin`](../../std/primitive.f64.html#method.sin)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sinf64(x: f64) -> f64;
pub fn sinf64(x: f64) -> f64;
/// Returns the sine of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::sin`](../../std/primitive.f128.html#method.sin)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn sinf128(x: f128) -> f128;
pub fn sinf128(x: f128) -> f128;
/// Returns the cosine of an `f16`.
///
@@ -1109,28 +1109,28 @@ pub unsafe fn sinf128(x: f128) -> f128;
/// [`f16::cos`](../../std/primitive.f16.html#method.cos)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn cosf16(x: f16) -> f16;
pub fn cosf16(x: f16) -> f16;
/// Returns the cosine of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::cos`](../../std/primitive.f32.html#method.cos)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn cosf32(x: f32) -> f32;
pub fn cosf32(x: f32) -> f32;
/// Returns the cosine of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::cos`](../../std/primitive.f64.html#method.cos)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn cosf64(x: f64) -> f64;
pub fn cosf64(x: f64) -> f64;
/// Returns the cosine of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::cos`](../../std/primitive.f128.html#method.cos)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn cosf128(x: f128) -> f128;
pub fn cosf128(x: f128) -> f128;
/// Raises an `f16` to an `f16` power.
///
@@ -1138,28 +1138,28 @@ pub unsafe fn cosf128(x: f128) -> f128;
/// [`f16::powf`](../../std/primitive.f16.html#method.powf)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powf16(a: f16, x: f16) -> f16;
pub fn powf16(a: f16, x: f16) -> f16;
/// Raises an `f32` to an `f32` power.
///
/// The stabilized version of this intrinsic is
/// [`f32::powf`](../../std/primitive.f32.html#method.powf)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powf32(a: f32, x: f32) -> f32;
pub fn powf32(a: f32, x: f32) -> f32;
/// Raises an `f64` to an `f64` power.
///
/// The stabilized version of this intrinsic is
/// [`f64::powf`](../../std/primitive.f64.html#method.powf)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powf64(a: f64, x: f64) -> f64;
pub fn powf64(a: f64, x: f64) -> f64;
/// Raises an `f128` to an `f128` power.
///
/// The stabilized version of this intrinsic is
/// [`f128::powf`](../../std/primitive.f128.html#method.powf)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn powf128(a: f128, x: f128) -> f128;
pub fn powf128(a: f128, x: f128) -> f128;
/// Returns the exponential of an `f16`.
///
@@ -1167,28 +1167,28 @@ pub unsafe fn powf128(a: f128, x: f128) -> f128;
/// [`f16::exp`](../../std/primitive.f16.html#method.exp)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn expf16(x: f16) -> f16;
pub fn expf16(x: f16) -> f16;
/// Returns the exponential of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::exp`](../../std/primitive.f32.html#method.exp)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn expf32(x: f32) -> f32;
pub fn expf32(x: f32) -> f32;
/// Returns the exponential of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::exp`](../../std/primitive.f64.html#method.exp)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn expf64(x: f64) -> f64;
pub fn expf64(x: f64) -> f64;
/// Returns the exponential of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::exp`](../../std/primitive.f128.html#method.exp)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn expf128(x: f128) -> f128;
pub fn expf128(x: f128) -> f128;
/// Returns 2 raised to the power of an `f16`.
///
@@ -1196,28 +1196,28 @@ pub unsafe fn expf128(x: f128) -> f128;
/// [`f16::exp2`](../../std/primitive.f16.html#method.exp2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn exp2f16(x: f16) -> f16;
pub fn exp2f16(x: f16) -> f16;
/// Returns 2 raised to the power of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::exp2`](../../std/primitive.f32.html#method.exp2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn exp2f32(x: f32) -> f32;
pub fn exp2f32(x: f32) -> f32;
/// Returns 2 raised to the power of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::exp2`](../../std/primitive.f64.html#method.exp2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn exp2f64(x: f64) -> f64;
pub fn exp2f64(x: f64) -> f64;
/// Returns 2 raised to the power of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::exp2`](../../std/primitive.f128.html#method.exp2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn exp2f128(x: f128) -> f128;
pub fn exp2f128(x: f128) -> f128;
/// Returns the natural logarithm of an `f16`.
///
@@ -1225,28 +1225,28 @@ pub unsafe fn exp2f128(x: f128) -> f128;
/// [`f16::ln`](../../std/primitive.f16.html#method.ln)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn logf16(x: f16) -> f16;
pub fn logf16(x: f16) -> f16;
/// Returns the natural logarithm of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::ln`](../../std/primitive.f32.html#method.ln)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn logf32(x: f32) -> f32;
pub fn logf32(x: f32) -> f32;
/// Returns the natural logarithm of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::ln`](../../std/primitive.f64.html#method.ln)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn logf64(x: f64) -> f64;
pub fn logf64(x: f64) -> f64;
/// Returns the natural logarithm of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::ln`](../../std/primitive.f128.html#method.ln)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn logf128(x: f128) -> f128;
pub fn logf128(x: f128) -> f128;
/// Returns the base 10 logarithm of an `f16`.
///
@@ -1254,28 +1254,28 @@ pub unsafe fn logf128(x: f128) -> f128;
/// [`f16::log10`](../../std/primitive.f16.html#method.log10)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log10f16(x: f16) -> f16;
pub fn log10f16(x: f16) -> f16;
/// Returns the base 10 logarithm of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::log10`](../../std/primitive.f32.html#method.log10)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log10f32(x: f32) -> f32;
pub fn log10f32(x: f32) -> f32;
/// Returns the base 10 logarithm of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::log10`](../../std/primitive.f64.html#method.log10)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log10f64(x: f64) -> f64;
pub fn log10f64(x: f64) -> f64;
/// Returns the base 10 logarithm of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::log10`](../../std/primitive.f128.html#method.log10)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log10f128(x: f128) -> f128;
pub fn log10f128(x: f128) -> f128;
/// Returns the base 2 logarithm of an `f16`.
///
@@ -1283,28 +1283,28 @@ pub unsafe fn log10f128(x: f128) -> f128;
/// [`f16::log2`](../../std/primitive.f16.html#method.log2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log2f16(x: f16) -> f16;
pub fn log2f16(x: f16) -> f16;
/// Returns the base 2 logarithm of an `f32`.
///
/// The stabilized version of this intrinsic is
/// [`f32::log2`](../../std/primitive.f32.html#method.log2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log2f32(x: f32) -> f32;
pub fn log2f32(x: f32) -> f32;
/// Returns the base 2 logarithm of an `f64`.
///
/// The stabilized version of this intrinsic is
/// [`f64::log2`](../../std/primitive.f64.html#method.log2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log2f64(x: f64) -> f64;
pub fn log2f64(x: f64) -> f64;
/// Returns the base 2 logarithm of an `f128`.
///
/// The stabilized version of this intrinsic is
/// [`f128::log2`](../../std/primitive.f128.html#method.log2)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn log2f128(x: f128) -> f128;
pub fn log2f128(x: f128) -> f128;
/// Returns `a * b + c` for `f16` values.
///
@@ -1312,28 +1312,28 @@ pub unsafe fn log2f128(x: f128) -> f128;
/// [`f16::mul_add`](../../std/primitive.f16.html#method.mul_add)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmaf16(a: f16, b: f16, c: f16) -> f16;
pub fn fmaf16(a: f16, b: f16, c: f16) -> f16;
/// Returns `a * b + c` for `f32` values.
///
/// The stabilized version of this intrinsic is
/// [`f32::mul_add`](../../std/primitive.f32.html#method.mul_add)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmaf32(a: f32, b: f32, c: f32) -> f32;
pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
/// Returns `a * b + c` for `f64` values.
///
/// The stabilized version of this intrinsic is
/// [`f64::mul_add`](../../std/primitive.f64.html#method.mul_add)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmaf64(a: f64, b: f64, c: f64) -> f64;
pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
/// Returns `a * b + c` for `f128` values.
///
/// The stabilized version of this intrinsic is
/// [`f128::mul_add`](../../std/primitive.f128.html#method.mul_add)
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmaf128(a: f128, b: f128, c: f128) -> f128;
pub fn fmaf128(a: f128, b: f128, c: f128) -> f128;
/// Returns `a * b + c` for `f16` values, non-deterministically executing
/// either a fused multiply-add or two operations with rounding of the
@@ -1347,7 +1347,7 @@ pub unsafe fn fmaf128(a: f128, b: f128, c: f128) -> f128;
/// example.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmuladdf16(a: f16, b: f16, c: f16) -> f16;
pub fn fmuladdf16(a: f16, b: f16, c: f16) -> f16;
/// Returns `a * b + c` for `f32` values, non-deterministically executing
/// either a fused multiply-add or two operations with rounding of the
/// intermediate result.
@@ -1360,7 +1360,7 @@ pub unsafe fn fmuladdf16(a: f16, b: f16, c: f16) -> f16;
/// example.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmuladdf32(a: f32, b: f32, c: f32) -> f32;
pub fn fmuladdf32(a: f32, b: f32, c: f32) -> f32;
/// Returns `a * b + c` for `f64` values, non-deterministically executing
/// either a fused multiply-add or two operations with rounding of the
/// intermediate result.
@@ -1373,7 +1373,7 @@ pub unsafe fn fmuladdf32(a: f32, b: f32, c: f32) -> f32;
/// example.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmuladdf64(a: f64, b: f64, c: f64) -> f64;
pub fn fmuladdf64(a: f64, b: f64, c: f64) -> f64;
/// Returns `a * b + c` for `f128` values, non-deterministically executing
/// either a fused multiply-add or two operations with rounding of the
/// intermediate result.
@@ -1386,7 +1386,7 @@ pub unsafe fn fmuladdf64(a: f64, b: f64, c: f64) -> f64;
/// example.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn fmuladdf128(a: f128, b: f128, c: f128) -> f128;
pub fn fmuladdf128(a: f128, b: f128, c: f128) -> f128;
/// Returns the largest integer less than or equal to an `f16`.
///
@@ -1395,7 +1395,7 @@ pub unsafe fn fmuladdf128(a: f128, b: f128, c: f128) -> f128;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf16(x: f16) -> f16;
pub const fn floorf16(x: f16) -> f16;
/// Returns the largest integer less than or equal to an `f32`.
///
/// The stabilized version of this intrinsic is
@@ -1403,7 +1403,7 @@ pub const unsafe fn floorf16(x: f16) -> f16;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf32(x: f32) -> f32;
pub const fn floorf32(x: f32) -> f32;
/// Returns the largest integer less than or equal to an `f64`.
///
/// The stabilized version of this intrinsic is
@@ -1411,7 +1411,7 @@ pub const unsafe fn floorf32(x: f32) -> f32;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf64(x: f64) -> f64;
pub const fn floorf64(x: f64) -> f64;
/// Returns the largest integer less than or equal to an `f128`.
///
/// The stabilized version of this intrinsic is
@@ -1419,7 +1419,7 @@ pub const unsafe fn floorf64(x: f64) -> f64;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn floorf128(x: f128) -> f128;
pub const fn floorf128(x: f128) -> f128;
/// Returns the smallest integer greater than or equal to an `f16`.
///
@@ -1428,7 +1428,7 @@ pub const unsafe fn floorf128(x: f128) -> f128;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf16(x: f16) -> f16;
pub const fn ceilf16(x: f16) -> f16;
/// Returns the smallest integer greater than or equal to an `f32`.
///
/// The stabilized version of this intrinsic is
@@ -1436,7 +1436,7 @@ pub const unsafe fn ceilf16(x: f16) -> f16;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf32(x: f32) -> f32;
pub const fn ceilf32(x: f32) -> f32;
/// Returns the smallest integer greater than or equal to an `f64`.
///
/// The stabilized version of this intrinsic is
@@ -1444,7 +1444,7 @@ pub const unsafe fn ceilf32(x: f32) -> f32;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf64(x: f64) -> f64;
pub const fn ceilf64(x: f64) -> f64;
/// Returns the smallest integer greater than or equal to an `f128`.
///
/// The stabilized version of this intrinsic is
@@ -1452,7 +1452,7 @@ pub const unsafe fn ceilf64(x: f64) -> f64;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn ceilf128(x: f128) -> f128;
pub const fn ceilf128(x: f128) -> f128;
/// Returns the integer part of an `f16`.
///
@@ -1461,7 +1461,7 @@ pub const unsafe fn ceilf128(x: f128) -> f128;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf16(x: f16) -> f16;
pub const fn truncf16(x: f16) -> f16;
/// Returns the integer part of an `f32`.
///
/// The stabilized version of this intrinsic is
@@ -1469,7 +1469,7 @@ pub const unsafe fn truncf16(x: f16) -> f16;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf32(x: f32) -> f32;
pub const fn truncf32(x: f32) -> f32;
/// Returns the integer part of an `f64`.
///
/// The stabilized version of this intrinsic is
@@ -1477,7 +1477,7 @@ pub const unsafe fn truncf32(x: f32) -> f32;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf64(x: f64) -> f64;
pub const fn truncf64(x: f64) -> f64;
/// Returns the integer part of an `f128`.
///
/// The stabilized version of this intrinsic is
@@ -1485,7 +1485,7 @@ pub const unsafe fn truncf64(x: f64) -> f64;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn truncf128(x: f128) -> f128;
pub const fn truncf128(x: f128) -> f128;
/// Returns the nearest integer to an `f16`. Rounds half-way cases to the number with an even
/// least significant digit.
@@ -1534,7 +1534,7 @@ pub const fn round_ties_even_f128(x: f128) -> f128;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf16(x: f16) -> f16;
pub const fn roundf16(x: f16) -> f16;
/// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is
@@ -1542,7 +1542,7 @@ pub const unsafe fn roundf16(x: f16) -> f16;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf32(x: f32) -> f32;
pub const fn roundf32(x: f32) -> f32;
/// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is
@@ -1550,7 +1550,7 @@ pub const unsafe fn roundf32(x: f32) -> f32;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf64(x: f64) -> f64;
pub const fn roundf64(x: f64) -> f64;
/// Returns the nearest integer to an `f128`. Rounds half-way cases away from zero.
///
/// The stabilized version of this intrinsic is
@@ -1558,10 +1558,10 @@ pub const unsafe fn roundf64(x: f64) -> f64;
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn roundf128(x: f128) -> f128;
pub const fn roundf128(x: f128) -> f128;
/// Float addition that allows optimizations based on algebraic rules.
/// May assume inputs are finite.
/// Requires that inputs and output of the operation are finite, causing UB otherwise.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
@@ -1569,7 +1569,7 @@ pub const unsafe fn roundf128(x: f128) -> f128;
pub unsafe fn fadd_fast<T: Copy>(a: T, b: T) -> T;
/// Float subtraction that allows optimizations based on algebraic rules.
/// May assume inputs are finite.
/// Requires that inputs and output of the operation are finite, causing UB otherwise.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
@@ -1577,7 +1577,7 @@ pub unsafe fn fadd_fast<T: Copy>(a: T, b: T) -> T;
pub unsafe fn fsub_fast<T: Copy>(a: T, b: T) -> T;
/// Float multiplication that allows optimizations based on algebraic rules.
/// May assume inputs are finite.
/// Requires that inputs and output of the operation are finite, causing UB otherwise.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
@@ -1585,7 +1585,7 @@ pub unsafe fn fsub_fast<T: Copy>(a: T, b: T) -> T;
pub unsafe fn fmul_fast<T: Copy>(a: T, b: T) -> T;
/// Float division that allows optimizations based on algebraic rules.
/// May assume inputs are finite.
/// Requires that inputs and output of the operation are finite, causing UB otherwise.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
@@ -1593,7 +1593,7 @@ pub unsafe fn fmul_fast<T: Copy>(a: T, b: T) -> T;
pub unsafe fn fdiv_fast<T: Copy>(a: T, b: T) -> T;
/// Float remainder that allows optimizations based on algebraic rules.
/// May assume inputs are finite.
/// Requires that inputs and output of the operation are finite, causing UB otherwise.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]

View File

@@ -1459,8 +1459,7 @@ impl f128 {
#[rustc_const_unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(self) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::floorf128(self) }
intrinsics::floorf128(self)
}
/// Returns the smallest integer greater than or equal to `self`.
@@ -1488,8 +1487,7 @@ impl f128 {
#[rustc_const_unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn ceil(self) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::ceilf128(self) }
intrinsics::ceilf128(self)
}
/// Returns the nearest integer to `self`. If a value is half-way between two
@@ -1523,8 +1521,7 @@ impl f128 {
#[rustc_const_unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(self) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::roundf128(self) }
intrinsics::roundf128(self)
}
/// Returns the nearest integer to a number. Rounds half-way cases to the number
@@ -1587,8 +1584,7 @@ impl f128 {
#[rustc_const_unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn trunc(self) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::truncf128(self) }
intrinsics::truncf128(self)
}
/// Returns the fractional part of `self`.
@@ -1664,8 +1660,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn mul_add(self, a: f128, b: f128) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::fmaf128(self, a, b) }
intrinsics::fmaf128(self, a, b)
}
/// Calculates Euclidean division, the matching method for `rem_euclid`.
@@ -1780,8 +1775,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn powi(self, n: i32) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::powif128(self, n) }
intrinsics::powif128(self, n)
}
/// Returns the square root of a number.
@@ -1816,7 +1810,6 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn sqrt(self) -> f128 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::sqrtf128(self) }
intrinsics::sqrtf128(self)
}
}

View File

@@ -1434,8 +1434,7 @@ impl f16 {
#[rustc_const_unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(self) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::floorf16(self) }
intrinsics::floorf16(self)
}
/// Returns the smallest integer greater than or equal to `self`.
@@ -1463,8 +1462,7 @@ impl f16 {
#[rustc_const_unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn ceil(self) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::ceilf16(self) }
intrinsics::ceilf16(self)
}
/// Returns the nearest integer to `self`. If a value is half-way between two
@@ -1498,8 +1496,7 @@ impl f16 {
#[rustc_const_unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(self) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::roundf16(self) }
intrinsics::roundf16(self)
}
/// Returns the nearest integer to a number. Rounds half-way cases to the number
@@ -1562,8 +1559,7 @@ impl f16 {
#[rustc_const_unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn trunc(self) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::truncf16(self) }
intrinsics::truncf16(self)
}
/// Returns the fractional part of `self`.
@@ -1639,8 +1635,7 @@ impl f16 {
#[doc(alias = "fmaf16", alias = "fusedMultiplyAdd")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn mul_add(self, a: f16, b: f16) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::fmaf16(self, a, b) }
intrinsics::fmaf16(self, a, b)
}
/// Calculates Euclidean division, the matching method for `rem_euclid`.
@@ -1755,8 +1750,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn powi(self, n: i32) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::powif16(self, n) }
intrinsics::powif16(self, n)
}
/// Returns the square root of a number.
@@ -1791,8 +1785,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn sqrt(self) -> f16 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::sqrtf16(self) }
intrinsics::sqrtf16(self)
}
/// Returns the cube root of a number.

View File

@@ -1603,8 +1603,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::floorf32(x) }
intrinsics::floorf32(x)
}
/// Experimental version of `ceil` in `core`. See [`f32::ceil`] for details.
@@ -1632,8 +1631,7 @@ pub mod math {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "core_float_math", issue = "137578")]
pub const fn ceil(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::ceilf32(x) }
intrinsics::ceilf32(x)
}
/// Experimental version of `round` in `core`. See [`f32::round`] for details.
@@ -1666,8 +1664,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::roundf32(x) }
intrinsics::roundf32(x)
}
/// Experimental version of `round_ties_even` in `core`. See [`f32::round_ties_even`] for
@@ -1729,8 +1726,7 @@ pub mod math {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "core_float_math", issue = "137578")]
pub const fn trunc(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::truncf32(x) }
intrinsics::truncf32(x)
}
/// Experimental version of `fract` in `core`. See [`f32::fract`] for details.
@@ -1804,8 +1800,7 @@ pub mod math {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "core_float_math", issue = "137578")]
pub fn mul_add(x: f32, y: f32, z: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::fmaf32(x, y, z) }
intrinsics::fmaf32(x, y, z)
}
/// Experimental version of `div_euclid` in `core`. See [`f32::div_euclid`] for details.
@@ -1896,8 +1891,7 @@ pub mod math {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "core_float_math", issue = "137578")]
pub fn powi(x: f32, n: i32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::powif32(x, n) }
intrinsics::powif32(x, n)
}
/// Experimental version of `sqrt` in `core`. See [`f32::sqrt`] for details.
@@ -1927,8 +1921,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn sqrt(x: f32) -> f32 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::sqrtf32(x) }
intrinsics::sqrtf32(x)
}
/// Experimental version of `abs_sub` in `core`. See [`f32::abs_sub`] for details.

View File

@@ -1601,8 +1601,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn floor(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::floorf64(x) }
intrinsics::floorf64(x)
}
/// Experimental version of `ceil` in `core`. See [`f64::ceil`] for details.
@@ -1630,8 +1629,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn ceil(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::ceilf64(x) }
intrinsics::ceilf64(x)
}
/// Experimental version of `round` in `core`. See [`f64::round`] for details.
@@ -1664,8 +1662,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn round(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::roundf64(x) }
intrinsics::roundf64(x)
}
/// Experimental version of `round_ties_even` in `core`. See [`f64::round_ties_even`] for
@@ -1727,8 +1724,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn trunc(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::truncf64(x) }
intrinsics::truncf64(x)
}
/// Experimental version of `fract` in `core`. See [`f64::fract`] for details.
@@ -1802,8 +1798,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn mul_add(x: f64, a: f64, b: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::fmaf64(x, a, b) }
intrinsics::fmaf64(x, a, b)
}
/// Experimental version of `div_euclid` in `core`. See [`f64::div_euclid`] for details.
@@ -1894,8 +1889,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn powi(x: f64, n: i32) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::powif64(x, n) }
intrinsics::powif64(x, n)
}
/// Experimental version of `sqrt` in `core`. See [`f64::sqrt`] for details.
@@ -1925,8 +1919,7 @@ pub mod math {
#[unstable(feature = "core_float_math", issue = "137578")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn sqrt(x: f64) -> f64 {
// SAFETY: intrinsic with no preconditions
unsafe { intrinsics::sqrtf64(x) }
intrinsics::sqrtf64(x)
}
/// Experimental version of `abs_sub` in `core`. See [`f64::abs_sub`] for details.

View File

@@ -44,7 +44,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn powf(self, n: f128) -> f128 {
unsafe { intrinsics::powf128(self, n) }
intrinsics::powf128(self, n)
}
/// Returns `e^(self)`, (the exponential function).
@@ -76,7 +76,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn exp(self) -> f128 {
unsafe { intrinsics::expf128(self) }
intrinsics::expf128(self)
}
/// Returns `2^(self)`.
@@ -106,7 +106,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn exp2(self) -> f128 {
unsafe { intrinsics::exp2f128(self) }
intrinsics::exp2f128(self)
}
/// Returns the natural logarithm of the number.
@@ -151,7 +151,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn ln(self) -> f128 {
unsafe { intrinsics::logf128(self) }
intrinsics::logf128(self)
}
/// Returns the logarithm of the number with respect to an arbitrary base.
@@ -241,7 +241,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn log2(self) -> f128 {
unsafe { intrinsics::log2f128(self) }
intrinsics::log2f128(self)
}
/// Returns the base 10 logarithm of the number.
@@ -284,7 +284,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn log10(self) -> f128 {
unsafe { intrinsics::log10f128(self) }
intrinsics::log10f128(self)
}
/// Returns the cube root of a number.
@@ -385,7 +385,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn sin(self) -> f128 {
unsafe { intrinsics::sinf128(self) }
intrinsics::sinf128(self)
}
/// Computes the cosine of a number (in radians).
@@ -414,7 +414,7 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn cos(self) -> f128 {
unsafe { intrinsics::cosf128(self) }
intrinsics::cosf128(self)
}
/// Computes the tangent of a number (in radians).

View File

@@ -44,7 +44,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn powf(self, n: f16) -> f16 {
unsafe { intrinsics::powf16(self, n) }
intrinsics::powf16(self, n)
}
/// Returns `e^(self)`, (the exponential function).
@@ -76,7 +76,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn exp(self) -> f16 {
unsafe { intrinsics::expf16(self) }
intrinsics::expf16(self)
}
/// Returns `2^(self)`.
@@ -106,7 +106,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn exp2(self) -> f16 {
unsafe { intrinsics::exp2f16(self) }
intrinsics::exp2f16(self)
}
/// Returns the natural logarithm of the number.
@@ -151,7 +151,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn ln(self) -> f16 {
unsafe { intrinsics::logf16(self) }
intrinsics::logf16(self)
}
/// Returns the logarithm of the number with respect to an arbitrary base.
@@ -241,7 +241,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn log2(self) -> f16 {
unsafe { intrinsics::log2f16(self) }
intrinsics::log2f16(self)
}
/// Returns the base 10 logarithm of the number.
@@ -284,7 +284,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn log10(self) -> f16 {
unsafe { intrinsics::log10f16(self) }
intrinsics::log10f16(self)
}
/// Compute the distance between the origin and a point (`x`, `y`) on the
@@ -350,7 +350,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn sin(self) -> f16 {
unsafe { intrinsics::sinf16(self) }
intrinsics::sinf16(self)
}
/// Computes the cosine of a number (in radians).
@@ -379,7 +379,7 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub fn cos(self) -> f16 {
unsafe { intrinsics::cosf16(self) }
intrinsics::cosf16(self)
}
/// Computes the tangent of a number (in radians).

View File

@@ -338,7 +338,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn powf(self, n: f32) -> f32 {
unsafe { intrinsics::powf32(self, n) }
intrinsics::powf32(self, n)
}
/// Returns the square root of a number.
@@ -395,7 +395,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn exp(self) -> f32 {
unsafe { intrinsics::expf32(self) }
intrinsics::expf32(self)
}
/// Returns `2^(self)`.
@@ -420,7 +420,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn exp2(self) -> f32 {
unsafe { intrinsics::exp2f32(self) }
intrinsics::exp2f32(self)
}
/// Returns the natural logarithm of the number.
@@ -455,7 +455,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn ln(self) -> f32 {
unsafe { intrinsics::logf32(self) }
intrinsics::logf32(self)
}
/// Returns the logarithm of the number with respect to an arbitrary base.
@@ -525,7 +525,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn log2(self) -> f32 {
unsafe { intrinsics::log2f32(self) }
intrinsics::log2f32(self)
}
/// Returns the base 10 logarithm of the number.
@@ -558,7 +558,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn log10(self) -> f32 {
unsafe { intrinsics::log10f32(self) }
intrinsics::log10f32(self)
}
/// The positive difference of two numbers.
@@ -683,7 +683,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn sin(self) -> f32 {
unsafe { intrinsics::sinf32(self) }
intrinsics::sinf32(self)
}
/// Computes the cosine of a number (in radians).
@@ -707,7 +707,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn cos(self) -> f32 {
unsafe { intrinsics::cosf32(self) }
intrinsics::cosf32(self)
}
/// Computes the tangent of a number (in radians).

View File

@@ -338,7 +338,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn powf(self, n: f64) -> f64 {
unsafe { intrinsics::powf64(self, n) }
intrinsics::powf64(self, n)
}
/// Returns the square root of a number.
@@ -395,7 +395,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn exp(self) -> f64 {
unsafe { intrinsics::expf64(self) }
intrinsics::expf64(self)
}
/// Returns `2^(self)`.
@@ -420,7 +420,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn exp2(self) -> f64 {
unsafe { intrinsics::exp2f64(self) }
intrinsics::exp2f64(self)
}
/// Returns the natural logarithm of the number.
@@ -455,7 +455,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn ln(self) -> f64 {
unsafe { intrinsics::logf64(self) }
intrinsics::logf64(self)
}
/// Returns the logarithm of the number with respect to an arbitrary base.
@@ -525,7 +525,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn log2(self) -> f64 {
unsafe { intrinsics::log2f64(self) }
intrinsics::log2f64(self)
}
/// Returns the base 10 logarithm of the number.
@@ -558,7 +558,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn log10(self) -> f64 {
unsafe { intrinsics::log10f64(self) }
intrinsics::log10f64(self)
}
/// The positive difference of two numbers.
@@ -683,7 +683,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn sin(self) -> f64 {
unsafe { intrinsics::sinf64(self) }
intrinsics::sinf64(self)
}
/// Computes the cosine of a number (in radians).
@@ -707,7 +707,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn cos(self) -> f64 {
unsafe { intrinsics::cosf64(self) }
intrinsics::cosf64(self)
}
/// Computes the tangent of a number (in radians).

View File

@@ -10183,7 +10183,7 @@ pub fn vfmad_lane_f64<const LANE: i32>(a: f64, b: f64, c: float64x1_t) -> f64 {
#[target_feature(enable = "neon,fp16")]
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
pub fn vfmah_f16(a: f16, b: f16, c: f16) -> f16 {
unsafe { fmaf16(b, c, a) }
fmaf16(b, c, a)
}
#[doc = "Floating-point fused multiply-add to accumulator"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vfmah_lane_f16)"]
@@ -23045,7 +23045,7 @@ pub fn vrndaq_f64(a: float64x2_t) -> float64x2_t {
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
#[cfg_attr(test, assert_instr(frinta))]
pub fn vrndah_f16(a: f16) -> f16 {
unsafe { roundf16(a) }
roundf16(a)
}
#[doc = "Floating-point round to integral, to nearest with ties to away"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndh_f16)"]
@@ -23054,7 +23054,7 @@ pub fn vrndah_f16(a: f16) -> f16 {
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
#[cfg_attr(test, assert_instr(frintz))]
pub fn vrndh_f16(a: f16) -> f16 {
unsafe { truncf16(a) }
truncf16(a)
}
#[doc = "Floating-point round to integral, using current rounding mode"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndi_f16)"]
@@ -23229,7 +23229,7 @@ pub fn vrndmq_f64(a: float64x2_t) -> float64x2_t {
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
#[cfg_attr(test, assert_instr(frintm))]
pub fn vrndmh_f16(a: f16) -> f16 {
unsafe { floorf16(a) }
floorf16(a)
}
#[doc = "Floating-point round to integral, to nearest with ties to even"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndn_f64)"]
@@ -23356,7 +23356,7 @@ pub fn vrndpq_f64(a: float64x2_t) -> float64x2_t {
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
#[cfg_attr(test, assert_instr(frintp))]
pub fn vrndph_f16(a: f16) -> f16 {
unsafe { ceilf16(a) }
ceilf16(a)
}
#[doc = "Floating-point round to integral exact, using current rounding mode"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndx_f16)"]
@@ -24846,7 +24846,7 @@ pub fn vsqrtq_f64(a: float64x2_t) -> float64x2_t {
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
#[cfg_attr(test, assert_instr(fsqrt))]
pub fn vsqrth_f16(a: f16) -> f16 {
unsafe { sqrtf16(a) }
sqrtf16(a)
}
#[doc = "Shift Right and Insert (immediate)"]
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsri_n_s8)"]

View File

@@ -43,7 +43,7 @@ pub fn unreachable() -> ! {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f32_ceil(a: f32) -> f32 {
unsafe { crate::intrinsics::ceilf32(a) }
crate::intrinsics::ceilf32(a)
}
/// Generates the [`f32.floor`] instruction, returning the largest integer less than or equal to `a`.
@@ -57,7 +57,7 @@ pub fn f32_ceil(a: f32) -> f32 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f32_floor(a: f32) -> f32 {
unsafe { crate::intrinsics::floorf32(a) }
crate::intrinsics::floorf32(a)
}
/// Generates the [`f32.trunc`] instruction, roundinging to the nearest integer towards zero.
@@ -71,7 +71,7 @@ pub fn f32_floor(a: f32) -> f32 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f32_trunc(a: f32) -> f32 {
unsafe { crate::intrinsics::truncf32(a) }
crate::intrinsics::truncf32(a)
}
/// Generates the [`f32.nearest`] instruction, roundinging to the nearest integer. Rounds half-way
@@ -100,7 +100,7 @@ pub fn f32_nearest(a: f32) -> f32 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f32_sqrt(a: f32) -> f32 {
unsafe { crate::intrinsics::sqrtf32(a) }
crate::intrinsics::sqrtf32(a)
}
/// Generates the [`f64.ceil`] instruction, returning the smallest integer greater than or equal to `a`.
@@ -114,7 +114,7 @@ pub fn f32_sqrt(a: f32) -> f32 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f64_ceil(a: f64) -> f64 {
unsafe { crate::intrinsics::ceilf64(a) }
crate::intrinsics::ceilf64(a)
}
/// Generates the [`f64.floor`] instruction, returning the largest integer less than or equal to `a`.
@@ -128,7 +128,7 @@ pub fn f64_ceil(a: f64) -> f64 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f64_floor(a: f64) -> f64 {
unsafe { crate::intrinsics::floorf64(a) }
crate::intrinsics::floorf64(a)
}
/// Generates the [`f64.trunc`] instruction, roundinging to the nearest integer towards zero.
@@ -142,7 +142,7 @@ pub fn f64_floor(a: f64) -> f64 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f64_trunc(a: f64) -> f64 {
unsafe { crate::intrinsics::truncf64(a) }
crate::intrinsics::truncf64(a)
}
/// Generates the [`f64.nearest`] instruction, roundinging to the nearest integer. Rounds half-way
@@ -171,7 +171,7 @@ pub fn f64_nearest(a: f64) -> f64 {
#[must_use = "method returns a new number and does not mutate the original value"]
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
pub fn f64_sqrt(a: f64) -> f64 {
unsafe { crate::intrinsics::sqrtf64(a) }
crate::intrinsics::sqrtf64(a)
}
unsafe extern "C-unwind" {

View File

@@ -3054,7 +3054,7 @@ intrinsics:
types:
- [f16, 'h_']
compose:
- FnCall: [roundf16, [a], [], true]
- FnCall: [roundf16, [a], []]
- name: "vrndn{neon_type.no}"
doc: "Floating-point round to integral, to nearest with ties to even"
@@ -3151,7 +3151,7 @@ intrinsics:
types:
- [f16, 'h_']
compose:
- FnCall: [floorf16, [a], [], true]
- FnCall: [floorf16, [a], []]
@@ -3198,7 +3198,7 @@ intrinsics:
types:
- [f16, 'h_']
compose:
- FnCall: [ceilf16, [a], [], true]
- FnCall: [ceilf16, [a], []]
- name: "vrnd{neon_type.no}"
doc: "Floating-point round to integral, toward zero"
@@ -3243,7 +3243,7 @@ intrinsics:
types:
- [f16, 'h_']
compose:
- FnCall: [truncf16, [a], [], true]
- FnCall: [truncf16, [a], []]
- name: "vrndi{neon_type.no}"
@@ -8398,7 +8398,7 @@ intrinsics:
types:
- [f16, 'h_']
compose:
- FnCall: [sqrtf16, [a], [], true]
- FnCall: [sqrtf16, [a], []]
- name: "vrsqrts{type[0]}"
doc: "Floating-point reciprocal square root step"
@@ -10346,7 +10346,7 @@ intrinsics:
types:
- ["f16", "h_f16"]
compose:
- FnCall: [fmaf16, [b, c, a], [], true]
- FnCall: [fmaf16, [b, c, a], []]
- name: "vfmah_lane{type[2]}"

View File

@@ -1401,12 +1401,12 @@ fn test_fmuladd() {
#[inline(never)]
pub fn test_operations_f32(a: f32, b: f32, c: f32) {
assert_approx_eq!(unsafe { fmuladdf32(a, b, c) }, a * b + c);
assert_approx_eq!(fmuladdf32(a, b, c), a * b + c);
}
#[inline(never)]
pub fn test_operations_f64(a: f64, b: f64, c: f64) {
assert_approx_eq!(unsafe { fmuladdf64(a, b, c) }, a * b + c);
assert_approx_eq!(fmuladdf64(a, b, c), a * b + c);
}
test_operations_f32(0.1, 0.2, 0.3);

View File

@@ -28,7 +28,7 @@ fn main() {
let c = std::hint::black_box(-a * b);
// It is unspecified whether the following operation is fused or not. The
// following evaluates to 0.0 if unfused, and nonzero (-1.66e-18) if fused.
let x = unsafe { fmuladdf64(a, b, c) };
let x = fmuladdf64(a, b, c);
x == 0.0
}),
"`fmuladdf64` failed to be evaluated as both fused and unfused"
@@ -41,7 +41,7 @@ fn main() {
let c = std::hint::black_box(-a * b);
// It is unspecified whether the following operation is fused or not. The
// following evaluates to 0.0 if unfused, and nonzero (-8.1956386e-10) if fused.
let x = unsafe { fmuladdf32(a, b, c) };
let x = fmuladdf32(a, b, c);
x == 0.0
}),
"`fmuladdf32` failed to be evaluated as both fused and unfused"

View File

@@ -7,7 +7,5 @@ use std::intrinsics::sqrtf32;
// CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}}
fn main() {
unsafe {
sqrtf32(0.0f32);
}
}

View File

@@ -11,7 +11,7 @@ macro_rules! assert_approx_eq {
}
fn main() {
unsafe {
{
let nan: f32 = f32::NAN;
let inf: f32 = f32::INFINITY;
let neg_inf: f32 = f32::NEG_INFINITY;
@@ -25,7 +25,7 @@ fn main() {
assert_eq!(fmuladdf32(8.9, inf, 3.2), inf);
assert_eq!(fmuladdf32(-3.2, 2.4, neg_inf), neg_inf);
}
unsafe {
{
let nan: f64 = f64::NAN;
let inf: f64 = f64::INFINITY;
let neg_inf: f64 = f64::NEG_INFINITY;

View File

@@ -22,7 +22,7 @@ LL | std::intrinsics::floorf32,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
|
= note: expected fn pointer `unsafe fn(_) -> _`
found fn item `unsafe fn(_) -> _ {floorf32}`
found fn item `fn(_) -> _ {floorf32}`
error: aborting due to 3 previous errors