# Function core::arch::aarch64::_prefetch

source ·

    pub unsafe fn _prefetch(p: *const i8, const RW: i32, const LOCALITY: i32)

🔬This is a nightly-only experimental API. (`stdarch_aarch64_prefetch` #117217)
Available on AArch64 only.
Expand description

Fetch the cache line that contains address `p` using the given `RW` and `LOCALITY`.

The `RW` must be one of:

- `_PREFETCH_READ`: the prefetch is preparing for a read.

- `_PREFETCH_WRITE`: the prefetch is preparing for a write.

The `LOCALITY` must be one of:

- `_PREFETCH_LOCALITY0`: Streaming or non-temporal prefetch, for data that is used only once.

- `_PREFETCH_LOCALITY1`: Fetch into level 3 cache.

- `_PREFETCH_LOCALITY2`: Fetch into level 2 cache.

- `_PREFETCH_LOCALITY3`: Fetch into level 1 cache.

The prefetch memory instructions signal to the memory system that memory accesses from a specified address are likely to occur in the near future. The memory system can respond by taking actions that are expected to speed up the memory access when they do occur, such as preloading the specified address into one or more caches. Because these signals are only hints, it is valid for a particular CPU to treat any or all prefetch instructions as a NOP.

Arm’s documentation