LLVM intrinsics are functions provided by LLVM, which handles all dirty low-level details of different OSs and architectures. For example, there may be different memcpy implementations according to different SIMD extensions, while LLVM provides a llvm.memcpy intrinsic to generating best implementations for different architectures.
In Rust, core::intrinsics module roughly provides those LLVM intrinsics. This module is designed to be used by compiler internally, and some common functions are further exported to users via specific functions such as core::ptr::copy.
However, as you can search the Rust internal forum or main repo issues, there are many requests for Rust to provide various LLVM instrinsics. However, I cannot find a policy describing the following two questions:
Whether an LLVM intrinsic should be added to core::intrinsics module.
Whether an LLVM intrinsic should be exported to users via specific std functions.
Personally, I was going to find a Rust version of GCC/Clang's __builtin___clear_cache, while the corresponding LLVM intrinsic llvm.clear_cache is not in core::intrinsics or anywhere else. I don't think it is a good practice to always ask whether Rust can provide a specific LLVM intrinsic as long as it is missing. Instead, I think there should be a policy towards LLVM intrinsics.
Well there are are various reasons to add intrinsics
essential building blocks to implement the core libs that are exposed through stable APIs directly or indirectly
portable SIMD
vendor-specific SIMD
not essential, but helpful for perf optimizations / to replace handcrafted code with something that's more legible to the compiler
experiments
internal features (for debugging, best-effort functionality and similar)
Some of those do not require much evidence to add since they're necessary to achieve some other already-approved goal.
If yours isn't covered then you'll need to make your case, describe the intended use, if there's a path to stabilization etc.
We will never expose LLVM's intrinsics directly, as LLVM doesn't match our stability policy and we want to support other backends.
However, you can use that feature on nightly to experiment with a specific intrinsic, as part of making a case that Rust should expose an API/attribute/etc for the functionality.
__builtin___clear_cache is a architecture and OS dependent interface.
On x86, this is nop
On some architectures (loongarch, sparc, powerpc), it's an instruction that can be called from user mode
On other architectures (aarch64), it's a privileged instruction that can only be called from kernel mode, so many operating systems provide a syscall/function to allow user mode to use this function