\chapter{``Zihintpause'' Pause Hint, Version 2.0}
\label{chap:zihintpause}

The PAUSE instruction is a HINT that indicates the current hart's rate of
instruction retirement should be temporarily reduced or paused.  The duration of its
effect must be bounded and may be zero.  No architectural state is changed.

\begin{commentary}
Software can use the PAUSE instruction to reduce energy consumption while
executing spin-wait code sequences.  Multithreaded cores might temporarily
relinquish execution resources to other harts when PAUSE is executed.
It is recommended that a PAUSE instruction generally be included in the code
sequence for a spin-wait loop.

A future extension might add primitives similar to the x86 MONITOR/MWAIT
instructions, which provide a more efficient mechanism to wait on writes to
a specific memory location.
However, these instructions would not supplant PAUSE.
PAUSE is more appropriate when polling for non-memory events, when polling for
multiple events, or when software does not know precisely what events it is
polling for.

The duration of a PAUSE instruction's effect may vary significantly within and
among implementations.
In typical implementations this duration should be much less than the time to
perform a context switch, probably more on the rough order of an on-chip cache
miss latency or a cacheless access to main memory.

A series of PAUSE instructions can be used to create a cumulative delay loosely
proportional to the number of PAUSE instructions.
In spin-wait loops in portable code, however, only one PAUSE instruction should
be used before re-evaluating loop conditions, else the hart might stall longer
than optimal on some implementations, degrading system performance.
\end{commentary}

PAUSE is encoded as a FENCE instruction with {\em pred}=W, {\em succ}=0,
{\em fm}=0, {\em rd}={\tt x0}, and {\em rs1}={\tt x0}.

\begin{commentary}
PAUSE is encoded as a hint within the FENCE opcode because some
implementations are expected to deliberately stall the PAUSE instruction until outstanding
memory transactions have completed.
Because the successor set is null, however, PAUSE does not {\em mandate} any
particular memory ordering---hence, it truly is a HINT.

Like other FENCE instructions, PAUSE cannot be used within LR/SC sequences
without voiding the forward-progress guarantee.

The choice of a predecessor set of W is arbitrary, since the successor set is
null.
Other HINTs similar to PAUSE might be encoded with other predecessor sets.
\end{commentary}
