Compiler Intrinsics
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 230
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
We need to support the extern "rust-intrinsics" GCC seems to have something at least pretty similar to a lot of these not 100% about all of them, things like transmute look more custom to rust.
https://github.com/rust-lang/rust/blob/master/library/core/src/intrinsics.rs
https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/intrinsic.rs
-
atomic_cxchg_relaxed_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_relaxed_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_relaxed_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_acquire_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_acquire_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_acquire_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_release_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_release_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_release_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_acqrel_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_acqrel_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_acqrel_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_seqcst_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_seqcst_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchg_seqcst_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_relaxed_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_relaxed_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_relaxed_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_acquire_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_acquire_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_acquire_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_release_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_release_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_release_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_acqrel_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_acqrel_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_acqrel_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_seqcst_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_seqcst_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_cxchgweak_seqcst_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool); -
atomic_load_seqcst<T: Copy>(src: *const T) -> T; -
atomic_load_acquire<T: Copy>(src: *const T) -> T; -
atomic_load_relaxed<T: Copy>(src: *const T) -> T; -
atomic_load_unordered<T: Copy>(src: *const T) -> T; -
atomic_store_seqcst<T: Copy>(dst: *mut T, val: T); -
atomic_store_release<T: Copy>(dst: *mut T, val: T); -
atomic_store_relaxed<T: Copy>(dst: *mut T, val: T); -
atomic_store_unordered<T: Copy>(dst: *mut T, val: T); -
atomic_xchg_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xchg_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xchg_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xchg_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xchg_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xadd_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xadd_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xadd_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xadd_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xadd_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xsub_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xsub_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xsub_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xsub_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xsub_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_and_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_and_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_and_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_and_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_and_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_nand_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_nand_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_nand_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_nand_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_nand_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_or_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_or_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_or_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_or_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_or_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xor_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xor_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xor_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xor_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_xor_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_max_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_max_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_max_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_max_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_max_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_min_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_min_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_min_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_min_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_min_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umin_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umin_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umin_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umin_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umin_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umax_seqcst<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umax_acquire<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umax_release<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umax_acqrel<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_umax_relaxed<T: Copy>(dst: *mut T, src: T) -> T; -
atomic_fence_seqcst(); -
atomic_fence_acquire(); -
atomic_fence_release(); -
atomic_fence_acqrel(); -
atomic_singlethreadfence_seqcst(); -
atomic_singlethreadfence_acquire(); -
atomic_singlethreadfence_release(); -
atomic_singlethreadfence_acqrel(); -
prefetch_read_data<T>(data: *const T, locality: i32); -
prefetch_write_data<T>(data: *const T, locality: i32); -
prefetch_read_instruction<T>(data: *const T, locality: i32); -
prefetch_write_instruction<T>(data: *const T, locality: i32); -
rustc_peek<T>(_: T) -> T; -
abort() -> !; -
unreachable() -> !; -
assume(b: bool);#1561 -
likely(b: bool) -> bool; -
unlikely(b: bool) -> bool; -
breakpoint(); -
size_of<T>() -> usize; -
min_align_of<T>() -> usize; -
pref_align_of<T>() -> usize; -
size_of_val<T: ?Sized>(_: *const T) -> usize; -
min_align_of_val<T: ?Sized>(_: *const T) -> usize; -
type_name<T: ?Sized>() -> &'static str; -
type_id<T: ?Sized + 'static>() -> u64; -
assert_inhabited<T>(); -
assert_zero_valid<T>(); -
assert_uninit_valid<T>(); -
caller_location() -> &'static crate::panic::Location<'static>; -
forget<T: ?Sized>(_: T); -
transmute<T, U>(e: T) -> U; -
needs_drop<T: ?Sized>() -> bool; -
offset<T>(dst: *const T, offset: isize) -> *const T; -
arith_offset<T>(dst: *const T, offset: isize) -> *const T; -
volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: usize); -
volatile_copy_memory<T>(dst: *mut T, src: *const T, count: usize); -
volatile_set_memory<T>(dst: *mut T, val: u8, count: usize); -
volatile_load<T>(src: *const T) -> T; -
volatile_store<T>(dst: *mut T, val: T); -
unaligned_volatile_load<T>(src: *const T) -> T; -
unaligned_volatile_store<T>(dst: *mut T, val: T); -
sqrtf32(x: f32) -> f32; -
sqrtf64(x: f64) -> f64; -
powif32(a: f32, x: i32) -> f32; -
powif64(a: f64, x: i32) -> f64; -
sinf32(x: f32) -> f32; -
sinf64(x: f64) -> f64; -
cosf32(x: f32) -> f32; -
cosf64(x: f64) -> f64; -
powf32(a: f32, x: f32) -> f32; -
powf64(a: f64, x: f64) -> f64; -
expf32(x: f32) -> f32; -
expf64(x: f64) -> f64; -
exp2f32(x: f32) -> f32; -
exp2f64(x: f64) -> f64; -
logf32(x: f32) -> f32; -
logf64(x: f64) -> f64; -
log10f32(x: f32) -> f32; -
log10f64(x: f64) -> f64; -
log2f32(x: f32) -> f32; -
log2f64(x: f64) -> f64; -
fmaf32(a: f32, b: f32, c: f32) -> f32; -
fmaf64(a: f64, b: f64, c: f64) -> f64; -
fabsf32(x: f32) -> f32; -
fabsf64(x: f64) -> f64; -
minnumf32(x: f32, y: f32) -> f32; -
minnumf64(x: f64, y: f64) -> f64; -
maxnumf32(x: f32, y: f32) -> f32; -
maxnumf64(x: f64, y: f64) -> f64; -
copysignf32(x: f32, y: f32) -> f32; -
copysignf64(x: f64, y: f64) -> f64; -
floorf32(x: f32) -> f32; -
floorf64(x: f64) -> f64; -
ceilf32(x: f32) -> f32; -
ceilf64(x: f64) -> f64; -
truncf32(x: f32) -> f32; -
truncf64(x: f64) -> f64; -
rintf32(x: f32) -> f32; -
rintf64(x: f64) -> f64; -
nearbyintf32(x: f32) -> f32; -
nearbyintf64(x: f64) -> f64; -
roundf32(x: f32) -> f32; -
roundf64(x: f64) -> f64; -
fadd_fast<T: Copy>(a: T, b: T) -> T; -
fsub_fast<T: Copy>(a: T, b: T) -> T; -
fmul_fast<T: Copy>(a: T, b: T) -> T; -
fdiv_fast<T: Copy>(a: T, b: T) -> T; -
frem_fast<T: Copy>(a: T, b: T) -> T; -
float_to_int_unchecked<Float: Copy, Int: Copy>(value: Float) -> Int; -
ctpop<T: Copy>(x: T) -> T; -
ctlz<T: Copy>(x: T) -> T; -
ctlz_nonzero<T: Copy>(x: T) -> T; -
cttz<T: Copy>(x: T) -> T; -
cttz_nonzero<T: Copy>(x: T) -> T; -
bswap<T: Copy>(x: T) -> T; -
bitreverse<T: Copy>(x: T) -> T; -
add_with_overflow<T: Copy>(x: T, y: T) -> (T, bool); -
sub_with_overflow<T: Copy>(x: T, y: T) -> (T, bool); -
mul_with_overflow<T: Copy>(x: T, y: T) -> (T, bool); -
exact_div<T: Copy>(x: T, y: T) -> T; -
unchecked_div<T: Copy>(x: T, y: T) -> T; -
unchecked_rem<T: Copy>(x: T, y: T) -> T; -
unchecked_shl<T: Copy>(x: T, y: T) -> T; -
unchecked_shr<T: Copy>(x: T, y: T) -> T; -
unchecked_add<T: Copy>(x: T, y: T) -> T; -
unchecked_sub<T: Copy>(x: T, y: T) -> T; -
unchecked_mul<T: Copy>(x: T, y: T) -> T; -
rotate_left<T: Copy>(x: T, y: T) -> T; -
rotate_right<T: Copy>(x: T, y: T) -> T; -
wrapping_add<T: Copy>(a: T, b: T) -> T; -
wrapping_sub<T: Copy>(a: T, b: T) -> T; -
wrapping_mul<T: Copy>(a: T, b: T) -> T; -
saturating_add<T: Copy>(a: T, b: T) -> T; -
saturating_sub<T: Copy>(a: T, b: T) -> T; -
discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant; -
variant_count<T>() -> usize; -
r#try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32; -
nontemporal_store<T>(ptr: *mut T, val: T); -
ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize; -
ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize; -
ptr_guaranteed_eq<T>(ptr: *const T, other: *const T) -> bool; -
ptr_guaranteed_ne<T>(ptr: *const T, other: *const T) -> bool; -
const_allocate(size: usize, align: usize) -> *mut u8; -
const_deallocate(ptr: *mut u8, size: usize, align: usize); -
raw_eq<T>(a: &T, b: &T) -> bool; -
black_box<T>(dummy: T) -> T;#3372 -
vtable_size(ptr: *const ()) -> usize; -
vtable_align(ptr: *const ()) -> usize; -
copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the requested checklist with library/core/src/intrinsics.rs and compiler/rustc_codegen_llvm/src/intrinsic.rs, the two reference entry points named in the issue. Determine the implementation and testing approach for the remaining extern "rust-intrinsics" entries; done means the requested intrinsics are supported and the checklist can be updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100