Skip to main content

_mm_clflushopt

Function _mm_clflushopt 

Source
pub unsafe fn _mm_clflushopt(p: *const u8)
🔬This is a nightly-only experimental API. (simd_x86_clflushopt #157096)
Available on x86-64 and target feature clflushopt and (x86 or x86-64) only.
Expand description

Invalidates from every level of the cache hierarchy the cache line that contains p.

Unlike _mm_clflush, CLFLUSHOPT is only ordered with respect to older writes to the flushed cache line and with respect to fence/locked operations; it is not serialized against other CLFLUSHOPT/CLFLUSH instructions or unrelated stores. This makes flushing a range of lines substantially faster, but a fence (e.g. _mm_sfence or _mm_mfence) is required afterward to order the flushes against subsequent operations.

Intel’s documentation

§Safety

Unlike the prefetch intrinsics, CLFLUSHOPT is subject to all the permission checking and faults associated with a byte load, so p must point to a byte that is valid for reads.