Compiler intrinsics.
The corresponding definitions are in librustc_codegen_llvm/intrinsic.rs
.
The volatile intrinsics provide operations intended to act on I/O memory, which are guaranteed to not be reordered by the compiler across other volatile intrinsics. See the LLVM documentation on [volatile].
The atomic intrinsics provide common atomic operations on machine words, with multiple possible memory orderings. They obey the same semantics as C++11. See the LLVM documentation on [atomics].
A quick refresher on memory ordering:
volatile
.copy^{âš } |
Copies |
copy_nonoverlapping^{âš } |
Copies |
drop_in_place^{âš } |
Executes the destructor (if any) of the pointed-to value. |
transmute^{âš } |
Reinterprets the bits of a value of one type as another type. |
write_bytes^{âš } |
Sets |
abort^{âš } |
Experimental Aborts the execution of the process. |
add_with_overflow |
Experimental Performs checked integer addition. The stabilized versions of this intrinsic are available on the integer primitives via the |
arith_offset^{âš } |
Experimental Calculates the offset from a pointer, potentially wrapping. |
assume^{âš } |
Experimental Informs the optimizer that a condition is always true. If the condition is false, the behavior is undefined. |
atomic_and^{âš } |
Experimental Bitwise and with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_and_acq^{âš } |
Experimental Bitwise and with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_and_acqrel^{âš } |
Experimental Bitwise and with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_and_rel^{âš } |
Experimental Bitwise and with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_and_relaxed^{âš } |
Experimental Bitwise and with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_cxchg^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_acq^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_acq_failrelaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_acqrel^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_acqrel_failrelaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_failacq^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_failrelaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_rel^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchg_relaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_acq^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_acq_failrelaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_acqrel^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_acqrel_failrelaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_failacq^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_failrelaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_rel^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_cxchgweak_relaxed^{âš } |
Experimental Stores a value if the current value is the same as the |
atomic_fence^{âš } | Experimental |
atomic_fence_acq^{âš } | Experimental |
atomic_fence_acqrel^{âš } | Experimental |
atomic_fence_rel^{âš } | Experimental |
atomic_load^{âš } |
Experimental Loads the current value of the pointer. The stabilized version of this intrinsic is available on the |
atomic_load_acq^{âš } |
Experimental Loads the current value of the pointer. The stabilized version of this intrinsic is available on the |
atomic_load_relaxed^{âš } |
Experimental Loads the current value of the pointer. The stabilized version of this intrinsic is available on the |
atomic_load_unordered^{âš } | Experimental |
atomic_max^{âš } | Experimental |
atomic_max_acq^{âš } | Experimental |
atomic_max_acqrel^{âš } | Experimental |
atomic_max_rel^{âš } | Experimental |
atomic_max_relaxed^{âš } | Experimental |
atomic_min^{âš } | Experimental |
atomic_min_acq^{âš } | Experimental |
atomic_min_acqrel^{âš } | Experimental |
atomic_min_rel^{âš } | Experimental |
atomic_min_relaxed^{âš } | Experimental |
atomic_nand^{âš } |
Experimental Bitwise nand with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_nand_acq^{âš } |
Experimental Bitwise nand with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_nand_acqrel^{âš } |
Experimental Bitwise nand with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_nand_rel^{âš } |
Experimental Bitwise nand with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_nand_relaxed^{âš } |
Experimental Bitwise nand with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_or^{âš } |
Experimental Bitwise or with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_or_acq^{âš } |
Experimental Bitwise or with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_or_acqrel^{âš } |
Experimental Bitwise or with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_or_rel^{âš } |
Experimental Bitwise or with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_or_relaxed^{âš } |
Experimental Bitwise or with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_singlethreadfence^{âš } |
Experimental A compiler-only memory barrier. |
atomic_singlethreadfence_acq^{âš } | Experimental |
atomic_singlethreadfence_acqrel^{âš } | Experimental |
atomic_singlethreadfence_rel^{âš } | Experimental |
atomic_store^{âš } |
Experimental Stores the value at the specified memory location. The stabilized version of this intrinsic is available on the |
atomic_store_rel^{âš } |
Experimental Stores the value at the specified memory location. The stabilized version of this intrinsic is available on the |
atomic_store_relaxed^{âš } |
Experimental Stores the value at the specified memory location. The stabilized version of this intrinsic is available on the |
atomic_store_unordered^{âš } | Experimental |
atomic_umax^{âš } | Experimental |
atomic_umax_acq^{âš } | Experimental |
atomic_umax_acqrel^{âš } | Experimental |
atomic_umax_rel^{âš } | Experimental |
atomic_umax_relaxed^{âš } | Experimental |
atomic_umin^{âš } | Experimental |
atomic_umin_acq^{âš } | Experimental |
atomic_umin_acqrel^{âš } | Experimental |
atomic_umin_rel^{âš } | Experimental |
atomic_umin_relaxed^{âš } | Experimental |
atomic_xadd^{âš } |
Experimental Adds to the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xadd_acq^{âš } |
Experimental Adds to the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xadd_acqrel^{âš } |
Experimental Adds to the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xadd_rel^{âš } |
Experimental Adds to the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xadd_relaxed^{âš } |
Experimental Adds to the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xchg^{âš } |
Experimental Stores the value at the specified memory location, returning the old value. The stabilized version of this intrinsic is available on the |
atomic_xchg_acq^{âš } |
Experimental Stores the value at the specified memory location, returning the old value. The stabilized version of this intrinsic is available on the |
atomic_xchg_acqrel^{âš } |
Experimental Stores the value at the specified memory location, returning the old value. The stabilized version of this intrinsic is available on the |
atomic_xchg_rel^{âš } |
Experimental Stores the value at the specified memory location, returning the old value. The stabilized version of this intrinsic is available on the |
atomic_xchg_relaxed^{âš } |
Experimental Stores the value at the specified memory location, returning the old value. The stabilized version of this intrinsic is available on the |
atomic_xor^{âš } |
Experimental Bitwise xor with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xor_acq^{âš } |
Experimental Bitwise xor with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xor_acqrel^{âš } |
Experimental Bitwise xor with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xor_rel^{âš } |
Experimental Bitwise xor with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xor_relaxed^{âš } |
Experimental Bitwise xor with the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xsub^{âš } |
Experimental Subtract from the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xsub_acq^{âš } |
Experimental Subtract from the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xsub_acqrel^{âš } |
Experimental Subtract from the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xsub_rel^{âš } |
Experimental Subtract from the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
atomic_xsub_relaxed^{âš } |
Experimental Subtract from the current value, returning the previous value. The stabilized version of this intrinsic is available on the |
bitreverse |
Experimental Reverses the bits in an integer type |
breakpoint^{âš } |
Experimental Executes a breakpoint trap, for inspection by a debugger. |
bswap |
Experimental Reverses the bytes in an integer type |
ceilf32^{âš } |
Experimental Returns the smallest integer greater than or equal to an |
ceilf64^{âš } |
Experimental Returns the smallest integer greater than or equal to an |
copysignf32^{âš } |
Experimental Copies the sign from |
copysignf64^{âš } |
Experimental Copies the sign from |
cosf32^{âš } |
Experimental Returns the cosine of an |
cosf64^{âš } |
Experimental Returns the cosine of an |
ctlz |
Experimental Returns the number of leading unset bits (zeroes) in an integer type |
ctlz_nonzero^{âš } |
Experimental Like |
ctpop |
Experimental Returns the number of bits set in an integer type |
cttz |
Experimental Returns the number of trailing unset bits (zeroes) in an integer type |
cttz_nonzero^{âš } |
Experimental Like |
discriminant_value^{âš } |
Experimental Returns the value of the discriminant for the variant in 'v', cast to a |
exact_div^{âš } |
Experimental Performs an exact division, resulting in undefined behavior where |
exp2f32^{âš } |
Experimental Returns 2 raised to the power of an |
exp2f64^{âš } |
Experimental Returns 2 raised to the power of an |
expf32^{âš } |
Experimental Returns the exponential of an |
expf64^{âš } |
Experimental Returns the exponential of an |
fabsf32^{âš } |
Experimental Returns the absolute value of an |
fabsf64^{âš } |
Experimental Returns the absolute value of an |
fadd_fast^{âš } |
Experimental Float addition that allows optimizations based on algebraic rules. May assume inputs are finite. |
fdiv_fast^{âš } |
Experimental Float division that allows optimizations based on algebraic rules. May assume inputs are finite. |
floorf32^{âš } |
Experimental Returns the largest integer less than or equal to an |
floorf64^{âš } |
Experimental Returns the largest integer less than or equal to an |
fmaf32^{âš } |
Experimental Returns |
fmaf64^{âš } |
Experimental Returns |
fmul_fast^{âš } |
Experimental Float multiplication that allows optimizations based on algebraic rules. May assume inputs are finite. |
forget^{âš } |
Experimental Moves a value out of scope without running drop glue. |
frem_fast^{âš } |
Experimental Float remainder that allows optimizations based on algebraic rules. May assume inputs are finite. |
fsub_fast^{âš } |
Experimental Float subtraction that allows optimizations based on algebraic rules. May assume inputs are finite. |
init^{âš } |
Experimental Creates a value initialized to zero. |
likely^{âš } |
Experimental Hints to the compiler that branch condition is likely to be true. Returns the value passed to it. |
log10f32^{âš } |
Experimental Returns the base 10 logarithm of an |
log10f64^{âš } |
Experimental Returns the base 10 logarithm of an |
log2f32^{âš } |
Experimental Returns the base 2 logarithm of an |
log2f64^{âš } |
Experimental Returns the base 2 logarithm of an |
logf32^{âš } |
Experimental Returns the natural logarithm of an |
logf64^{âš } |
Experimental Returns the natural logarithm of an |
maxnumf32 |
Experimental Returns the maximum of two |
maxnumf64 |
Experimental Returns the maximum of two |
min_align_of | Experimental |
min_align_of_val^{âš } | Experimental |
minnumf32 |
Experimental Returns the minimum of two |
minnumf64 |
Experimental Returns the minimum of two |
move_val_init^{âš } |
Experimental Moves a value to an uninitialized memory location. |
mul_with_overflow |
Experimental Performs checked integer multiplication The stabilized versions of this intrinsic are available on the integer primitives via the |
nearbyintf32^{âš } |
Experimental Returns the nearest integer to an |
nearbyintf64^{âš } |
Experimental Returns the nearest integer to an |
needs_drop |
Experimental Returns |
nontemporal_store^{âš } |
Experimental Emits a |
offset^{âš } |
Experimental Calculates the offset from a pointer. |
overflowing_add |
Experimental Returns (a + b) mod 2^{N}, where N is the width of T in bits. The stabilized versions of this intrinsic are available on the integer primitives via the |
overflowing_mul |
Experimental Returns (a * b) mod 2^{N}, where N is the width of T in bits. The stabilized versions of this intrinsic are available on the integer primitives via the |
overflowing_sub |
Experimental Returns (a - b) mod 2^{N}, where N is the width of T in bits. The stabilized versions of this intrinsic are available on the integer primitives via the |
panic_if_uninhabited^{âš } |
Experimental A guard for unsafe functions that cannot ever be executed if |
powf32^{âš } |
Experimental Raises an |
powf64^{âš } |
Experimental Raises an |
powif32^{âš } |
Experimental Raises an |
powif64^{âš } |
Experimental Raises an |
pref_align_of^{âš } | Experimental |
prefetch_read_data^{âš } |
Experimental The |
prefetch_read_instruction^{âš } |
Experimental The |
prefetch_write_data^{âš } |
Experimental The |
prefetch_write_instruction^{âš } |
Experimental The |
rintf32^{âš } |
Experimental Returns the nearest integer to an |
rintf64^{âš } |
Experimental Returns the nearest integer to an |
rotate_left |
Experimental Performs rotate left. The stabilized versions of this intrinsic are available on the integer primitives via the |
rotate_right |
Experimental Performs rotate right. The stabilized versions of this intrinsic are available on the integer primitives via the |
roundf32^{âš } |
Experimental Returns the nearest integer to an |
roundf64^{âš } |
Experimental Returns the nearest integer to an |
rustc_peek^{âš } |
Experimental Magic intrinsic that derives its meaning from attributes attached to the function. |
saturating_add |
Experimental Computes |
saturating_sub |
Experimental Computes |
sinf32^{âš } |
Experimental Returns the sine of an |
sinf64^{âš } |
Experimental Returns the sine of an |
size_of |
Experimental The size of a type in bytes. |
size_of_val^{âš } |
Experimental The size of the referenced value in bytes. |
sqrtf32^{âš } |
Experimental Returns the square root of an |
sqrtf64^{âš } |
Experimental Returns the square root of an |
sub_with_overflow |
Experimental Performs checked integer subtraction The stabilized versions of this intrinsic are available on the integer primitives via the |
truncf32^{âš } |
Experimental Returns the integer part of an |
truncf64^{âš } |
Experimental Returns the integer part of an |
try^{âš } |
Experimental Rust's "try catch" construct which invokes the function pointer |
type_id^{âš } |
Experimental Gets an identifier which is globally unique to the specified type. This function will return the same value for a type regardless of whichever crate it is invoked in. |
type_name^{âš } |
Experimental Gets a static string slice containing the name of a type. |
unaligned_volatile_load^{âš } |
Experimental Performs a volatile load from the |
unaligned_volatile_store^{âš } |
Experimental Performs a volatile store to the |
unchecked_add^{âš } |
Experimental Returns the result of an unchecked addition, resulting in undefined behavior when |
unchecked_div^{âš } |
Experimental Performs an unchecked division, resulting in undefined behavior where y = 0 or x = |
unchecked_mul^{âš } |
Experimental Returns the result of an unchecked multiplication, resulting in undefined behavior when |
unchecked_rem^{âš } |
Experimental Returns the remainder of an unchecked division, resulting in undefined behavior where y = 0 or x = |
unchecked_shl^{âš } |
Experimental Performs an unchecked left shift, resulting in undefined behavior when y < 0 or y >= N, where N is the width of T in bits. |
unchecked_shr^{âš } |
Experimental Performs an unchecked right shift, resulting in undefined behavior when y < 0 or y >= N, where N is the width of T in bits. |
unchecked_sub^{âš } |
Experimental Returns the result of an unchecked substraction, resulting in undefined behavior when |
uninit^{âš } |
Experimental Creates an uninitialized value. |
unlikely^{âš } |
Experimental Hints to the compiler that branch condition is likely to be false. Returns the value passed to it. |
unreachable^{âš } |
Experimental Tells LLVM that this point in the code is not reachable, enabling further optimizations. |
volatile_copy_memory^{âš } |
Experimental Equivalent to the appropriate |
volatile_copy_nonoverlapping_memory^{âš } |
Experimental Equivalent to the appropriate |
volatile_load^{âš } |
Experimental Performs a volatile load from the |
volatile_set_memory^{âš } |
Experimental Equivalent to the appropriate |
volatile_store^{âš } |
Experimental Performs a volatile store to the |
Â© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/intrinsics/index.html