diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 2cee23a5c752..0aae61368115 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -553,28 +553,148 @@ /// [`AtomicBool::fetch_xor`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_xor). pub fn atomic_xor_relaxed(dst: *mut T, src: T) -> T; + /// Maximum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_max` method by passing + /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html#variant.SeqCst) + /// as the `order`. For example, + /// [`AtomicI32::fetch_max`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_max). pub fn atomic_max(dst: *mut T, src: T) -> T; + /// Maximum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_max` method by passing + /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html#variant.Acquire) + /// as the `order`. For example, + /// [`AtomicI32::fetch_max`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_max). pub fn atomic_max_acq(dst: *mut T, src: T) -> T; + /// Maximum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_max` method by passing + /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html#variant.Release) + /// as the `order`. For example, + /// [`AtomicI32::fetch_max`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_max). pub fn atomic_max_rel(dst: *mut T, src: T) -> T; + /// Maximum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_max` method by passing + /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html#variant.AcqRel) + /// as the `order`. For example, + /// [`AtomicI32::fetch_max`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_max). pub fn atomic_max_acqrel(dst: *mut T, src: T) -> T; + /// Maximum with the current value. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_max` method by passing + /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html#variant.Relaxed) + /// as the `order`. For example, + /// [`AtomicI32::fetch_max`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_max). pub fn atomic_max_relaxed(dst: *mut T, src: T) -> T; + /// Minimum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_min` method by passing + /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html#variant.SeqCst) + /// as the `order`. For example, + /// [`AtomicI32::fetch_min`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_min). pub fn atomic_min(dst: *mut T, src: T) -> T; + /// Minimum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_min` method by passing + /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html#variant.Acquire) + /// as the `order`. For example, + /// [`AtomicI32::fetch_min`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_min). pub fn atomic_min_acq(dst: *mut T, src: T) -> T; + /// Minimum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_min` method by passing + /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html#variant.Release) + /// as the `order`. For example, + /// [`AtomicI32::fetch_min`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_min). pub fn atomic_min_rel(dst: *mut T, src: T) -> T; + /// Minimum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_min` method by passing + /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html#variant.AcqRel) + /// as the `order`. For example, + /// [`AtomicI32::fetch_min`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_min). pub fn atomic_min_acqrel(dst: *mut T, src: T) -> T; + /// Minimum with the current value using a sized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` signed integer types via the `fetch_min` method by passing + /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html#variant.Relaxed) + /// as the `order`. For example, + /// [`AtomicI32::fetch_min`](../../std/sync/atomic/struct.AtomicI32.html#method.fetch_min). pub fn atomic_min_relaxed(dst: *mut T, src: T) -> T; + /// Minimum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_min` method by passing + /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html#variant.SeqCst) + /// as the `order`. For example, + /// [`AtomicU32::fetch_min`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_min). pub fn atomic_umin(dst: *mut T, src: T) -> T; + /// Minimum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_min` method by passing + /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html#variant.Acquire) + /// as the `order`. For example, + /// [`AtomicU32::fetch_min`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_min). pub fn atomic_umin_acq(dst: *mut T, src: T) -> T; + /// Minimum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_min` method by passing + /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html#variant.Release) + /// as the `order`. For example, + /// [`AtomicU32::fetch_min`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_min). pub fn atomic_umin_rel(dst: *mut T, src: T) -> T; + /// Minimum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_min` method by passing + /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html#variant.AcqRel) + /// as the `order`. For example, + /// [`AtomicU32::fetch_min`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_min). pub fn atomic_umin_acqrel(dst: *mut T, src: T) -> T; + /// Minimum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_min` method by passing + /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html#variant.Relaxed) + /// as the `order`. For example, + /// [`AtomicU32::fetch_min`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_min). pub fn atomic_umin_relaxed(dst: *mut T, src: T) -> T; + /// Maximum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_max` method by passing + /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html#variant.SeqCst) + /// as the `order`. For example, + /// [`AtomicU32::fetch_max`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_max). pub fn atomic_umax(dst: *mut T, src: T) -> T; + /// Maximum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_max` method by passing + /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html#variant.Acquire) + /// as the `order`. For example, + /// [`AtomicU32::fetch_max`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_max). pub fn atomic_umax_acq(dst: *mut T, src: T) -> T; + /// Maximum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_max` method by passing + /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html#variant.Release) + /// as the `order`. For example, + /// [`AtomicU32::fetch_max`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_max). pub fn atomic_umax_rel(dst: *mut T, src: T) -> T; + /// Maximum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_max` method by passing + /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html#variant.AcqRel) + /// as the `order`. For example, + /// [`AtomicU32::fetch_max`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_max). pub fn atomic_umax_acqrel(dst: *mut T, src: T) -> T; + /// Maximum with the current value using an unsized comparison. + /// The stabilized version of this intrinsic is available on the + /// `std::sync::atomic` unsigned integer types via the `fetch_max` method by passing + /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html#variant.Relaxed) + /// as the `order`. For example, + /// [`AtomicU32::fetch_max`](../../std/sync/atomic/struct.AtomicU32.html#method.fetch_max). pub fn atomic_umax_relaxed(dst: *mut T, src: T) -> T; /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction @@ -613,9 +733,33 @@ extern "rust-intrinsic" { + /// An atomic fence. + /// The stabilized version of this intrinsic is available in + /// [`std::sync::atomic::fence`](../../std/sync/atomic/fn.fence.html) + /// by passing + /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html#variant.SeqCst) + /// as the `order`. pub fn atomic_fence(); + /// An atomic fence. + /// The stabilized version of this intrinsic is available in + /// [`std::sync::atomic::fence`](../../std/sync/atomic/fn.fence.html) + /// by passing + /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html#variant.Acquire) + /// as the `order`. pub fn atomic_fence_acq(); + /// An atomic fence. + /// The stabilized version of this intrinsic is available in + /// [`std::sync::atomic::fence`](../../std/sync/atomic/fn.fence.html) + /// by passing + /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html#variant.Release) + /// as the `order`. pub fn atomic_fence_rel(); + /// An atomic fence. + /// The stabilized version of this intrinsic is available in + /// [`std::sync::atomic::fence`](../../std/sync/atomic/fn.fence.html) + /// by passing + /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html#variant.AcqRel) + /// as the `order`. pub fn atomic_fence_acqrel(); /// A compiler-only memory barrier. @@ -625,8 +769,26 @@ /// appropriate for operations on the same thread that may be preempted, /// such as when interacting with signal handlers. pub fn atomic_singlethreadfence(); + /// A compiler-only memory barrier. + /// + /// Memory accesses will never be reordered across this barrier by the + /// compiler, but no instructions will be emitted for it. This is + /// appropriate for operations on the same thread that may be preempted, + /// such as when interacting with signal handlers. pub fn atomic_singlethreadfence_acq(); + /// A compiler-only memory barrier. + /// + /// Memory accesses will never be reordered across this barrier by the + /// compiler, but no instructions will be emitted for it. This is + /// appropriate for operations on the same thread that may be preempted, + /// such as when interacting with signal handlers. pub fn atomic_singlethreadfence_rel(); + /// A compiler-only memory barrier. + /// + /// Memory accesses will never be reordered across this barrier by the + /// compiler, but no instructions will be emitted for it. This is + /// appropriate for operations on the same thread that may be preempted, + /// such as when interacting with signal handlers. pub fn atomic_singlethreadfence_acqrel(); /// Magic intrinsic that derives its meaning from attributes @@ -1047,92 +1209,164 @@ pub fn unaligned_volatile_store(dst: *mut T, val: T); /// Returns the square root of an `f32` + /// The stabilized version of this intrinsic is + /// [`std::f32::sqrt`](../../std/primitive.f32.html#method.sqrt) pub fn sqrtf32(x: f32) -> f32; /// Returns the square root of an `f64` + /// The stabilized version of this intrinsic is + /// [`std::f64::sqrt`](../../std/primitive.f64.html#method.sqrt) pub fn sqrtf64(x: f64) -> f64; /// Raises an `f32` to an integer power. + /// The stabilized version of this intrinsic is + /// [`std::f32::powi`](../../std/primitive.f32.html#method.powi) pub fn powif32(a: f32, x: i32) -> f32; /// Raises an `f64` to an integer power. + /// The stabilized version of this intrinsic is + /// [`std::f64::powi`](../../std/primitive.f64.html#method.powi) pub fn powif64(a: f64, x: i32) -> f64; /// Returns the sine of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::sin`](../../std/primitive.f32.html#method.sin) pub fn sinf32(x: f32) -> f32; /// Returns the sine of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::sin`](../../std/primitive.f64.html#method.sin) pub fn sinf64(x: f64) -> f64; /// Returns the cosine of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::cos`](../../std/primitive.f32.html#method.cos) pub fn cosf32(x: f32) -> f32; /// Returns the cosine of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::cos`](../../std/primitive.f64.html#method.cos) pub fn cosf64(x: f64) -> f64; /// Raises an `f32` to an `f32` power. + /// The stabilized version of this intrinsic is + /// [`std::f32::powf`](../../std/primitive.f32.html#method.powf) pub fn powf32(a: f32, x: f32) -> f32; /// Raises an `f64` to an `f64` power. + /// The stabilized version of this intrinsic is + /// [`std::f64::powf`](../../std/primitive.f64.html#method.powf) pub fn powf64(a: f64, x: f64) -> f64; /// Returns the exponential of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::exp`](../../std/primitive.f32.html#method.exp) pub fn expf32(x: f32) -> f32; /// Returns the exponential of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::exp`](../../std/primitive.f64.html#method.exp) pub fn expf64(x: f64) -> f64; /// Returns 2 raised to the power of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::exp2`](../../std/primitive.f32.html#method.exp2) pub fn exp2f32(x: f32) -> f32; /// Returns 2 raised to the power of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::exp2`](../../std/primitive.f64.html#method.exp2) pub fn exp2f64(x: f64) -> f64; /// Returns the natural logarithm of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::ln`](../../std/primitive.f32.html#method.ln) pub fn logf32(x: f32) -> f32; /// Returns the natural logarithm of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::ln`](../../std/primitive.f64.html#method.ln) pub fn logf64(x: f64) -> f64; /// Returns the base 10 logarithm of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::log10`](../../std/primitive.f32.html#method.log10) pub fn log10f32(x: f32) -> f32; /// Returns the base 10 logarithm of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::log10`](../../std/primitive.f64.html#method.log10) pub fn log10f64(x: f64) -> f64; /// Returns the base 2 logarithm of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::log2`](../../std/primitive.f32.html#method.log2) pub fn log2f32(x: f32) -> f32; /// Returns the base 2 logarithm of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::log2`](../../std/primitive.f64.html#method.log2) pub fn log2f64(x: f64) -> f64; /// Returns `a * b + c` for `f32` values. + /// The stabilized version of this intrinsic is + /// [`std::f32::mul_add`](../../std/primitive.f32.html#method.mul_add) pub fn fmaf32(a: f32, b: f32, c: f32) -> f32; /// Returns `a * b + c` for `f64` values. + /// The stabilized version of this intrinsic is + /// [`std::f64::mul_add`](../../std/primitive.f64.html#method.mul_add) pub fn fmaf64(a: f64, b: f64, c: f64) -> f64; /// Returns the absolute value of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::abs`](../../std/primitive.f32.html#method.abs) pub fn fabsf32(x: f32) -> f32; /// Returns the absolute value of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::abs`](../../std/primitive.f64.html#method.abs) pub fn fabsf64(x: f64) -> f64; /// Returns the minimum of two `f32` values. + /// The stabilized version of this intrinsic is + /// [`std::f32::min`](../../std/primitive.f32.html#method.min) pub fn minnumf32(x: f32, y: f32) -> f32; /// Returns the minimum of two `f64` values. + /// The stabilized version of this intrinsic is + /// [`std::f64::min`](../../std/primitive.f64.html#method.min) pub fn minnumf64(x: f64, y: f64) -> f64; /// Returns the maximum of two `f32` values. + /// The stabilized version of this intrinsic is + /// [`std::f32::max`](../../std/primitive.f32.html#method.max) pub fn maxnumf32(x: f32, y: f32) -> f32; /// Returns the maximum of two `f64` values. + /// The stabilized version of this intrinsic is + /// [`std::f64::max`](../../std/primitive.f64.html#method.max) pub fn maxnumf64(x: f64, y: f64) -> f64; /// Copies the sign from `y` to `x` for `f32` values. + /// The stabilized version of this intrinsic is + /// [`std::f32::copysign`](../../std/primitive.f32.html#method.copysign) pub fn copysignf32(x: f32, y: f32) -> f32; /// Copies the sign from `y` to `x` for `f64` values. + /// The stabilized version of this intrinsic is + /// [`std::f64::copysign`](../../std/primitive.f64.html#method.copysign) pub fn copysignf64(x: f64, y: f64) -> f64; /// Returns the largest integer less than or equal to an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::floor`](../../std/primitive.f32.html#method.floor) pub fn floorf32(x: f32) -> f32; /// Returns the largest integer less than or equal to an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::floor`](../../std/primitive.f64.html#method.floor) pub fn floorf64(x: f64) -> f64; /// Returns the smallest integer greater than or equal to an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::ceil`](../../std/primitive.f32.html#method.ceil) pub fn ceilf32(x: f32) -> f32; /// Returns the smallest integer greater than or equal to an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::ceil`](../../std/primitive.f64.html#method.ceil) pub fn ceilf64(x: f64) -> f64; /// Returns the integer part of an `f32`. + /// The stabilized version of this intrinsic is + /// [`std::f32::trunc`](../../std/primitive.f32.html#method.trunc) pub fn truncf32(x: f32) -> f32; /// Returns the integer part of an `f64`. + /// The stabilized version of this intrinsic is + /// [`std::f64::trunc`](../../std/primitive.f64.html#method.trunc) pub fn truncf64(x: f64) -> f64; /// Returns the nearest integer to an `f32`. May raise an inexact floating-point exception @@ -1148,8 +1382,12 @@ pub fn nearbyintf64(x: f64) -> f64; /// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero. + /// The stabilized version of this intrinsic is + /// [`std::f32::round`](../../std/primitive.f32.html#method.round) pub 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 + /// [`std::f64::round`](../../std/primitive.f64.html#method.round) pub fn roundf64(x: f64) -> f64; /// Float addition that allows optimizations based on algebraic rules. diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 9d449bb99150..3ba15968f893 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -2444,7 +2444,7 @@ unsafe fn atomic_min(dst: *mut T, val: T, order: Ordering) -> T { } } -/// returns the max value (signed comparison) +/// returns the max value (unsigned comparison) #[inline] #[cfg(target_has_atomic = "8")] unsafe fn atomic_umax(dst: *mut T, val: T, order: Ordering) -> T { @@ -2457,7 +2457,7 @@ unsafe fn atomic_umax(dst: *mut T, val: T, order: Ordering) -> T { } } -/// returns the min value (signed comparison) +/// returns the min value (unsigned comparison) #[inline] #[cfg(target_has_atomic = "8")] unsafe fn atomic_umin(dst: *mut T, val: T, order: Ordering) -> T {