This module contains useful routines for 64-bit x86 computer architecture machines.
prefetch :: (pointer: *void, $hint: Prefetch_Hint);
Prefetching is a method for speeding up fetch operations by beginning a fetch operation before the memory is needed.
prefetch hint specifies where to
prefetch the data to. The
prefetch hints include
T0prefetches data into all levels of the cache hierarchy
T1prefetches data into level 2 cache and higher
T2prefetches data into level 3 cache and higher, or an implementation-specific choice.
NTAprefetches data into non-temporal cache structure and into a location close to the processor, minimizing cache pollution.
Here is an example use case for prefetching:
mfence :: ();
This instruction does memory fencing. Memory fence performs a serializing operation on all load-from-memory and store-to-memory instructions that were issued prior the
mfence instruction. This serializing operation guarantees that every load and store instruction that precedes in program order the
mfence instruction is globally visible before any load or store instruction that follows the
mfence instruction is globally visible.
pause :: ();
The PAUSE instruction will de-pipeline memory reads, so that the pipeline is not filled with speculative CMP instructions.