// NB: These intrinsics take raw pointers because they mutate aliased
// memory, which is not valid for either `&` or `&mut`.
+ #[cfg(all(stage0, not(cargobuild)))]
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
+ #[cfg(all(stage0, not(cargobuild)))]
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
+ #[cfg(all(stage0, not(cargobuild)))]
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
+ #[cfg(all(stage0, not(cargobuild)))]
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
+ #[cfg(all(stage0, not(cargobuild)))]
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
- #[cfg(not(stage0))]
- pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
- #[cfg(not(stage0))]
- pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> T;
- #[cfg(not(stage0))]
- pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
- #[cfg(not(stage0))]
- pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
- #[cfg(not(stage0))]
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+ #[cfg(any(not(stage0), cargobuild))]
+ pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
+
pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
- #[cfg(not(stage0))]
pub fn atomic_cxchgweak_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
pub fn atomic_load<T>(src: *const T) -> T;
/// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
pub fn roundf64(x: f64) -> f64;
+ /// Float addition that allows optimizations based on algebraic rules.
+ /// May assume inputs are finite.
+ #[cfg(not(stage0))]
+ pub fn fadd_fast<T>(a: T, b: T) -> T;
+
+ /// Float subtraction that allows optimizations based on algebraic rules.
+ /// May assume inputs are finite.
+ #[cfg(not(stage0))]
+ pub fn fsub_fast<T>(a: T, b: T) -> T;
+
+ /// Float multiplication that allows optimizations based on algebraic rules.
+ /// May assume inputs are finite.
+ #[cfg(not(stage0))]
+ pub fn fmul_fast<T>(a: T, b: T) -> T;
+
+ /// Float division that allows optimizations based on algebraic rules.
+ /// May assume inputs are finite.
+ #[cfg(not(stage0))]
+ pub fn fdiv_fast<T>(a: T, b: T) -> T;
+
+ /// Float remainder that allows optimizations based on algebraic rules.
+ /// May assume inputs are finite.
+ #[cfg(not(stage0))]
+ pub fn frem_fast<T>(a: T, b: T) -> T;
+
+
/// Returns the number of bits set in an integer type `T`
pub fn ctpop<T>(x: T) -> T;