Speculation Check Instructionchk
Instruction Types I,M
Format
(qp) chk.s r2, target25 pseudo-op
(qp) chk.s.i r2, target25 control_form, i-unit_form, gr_form
(qp) chk.s.m r2, target25 control_form, m-unit_form, gr_form
(qp) chk.s f2, target25 control_form, fr_form
(qp) chk.a.aclr r1, target25 data_form, gr_form
(qp) chk.a.aclr f1, target25 data_form, fr_form
Description
The result of a control- or data-speculative calculation is checked for success or failure. If the check fails, a branch to target25 is taken.
In the control_form, success is determined by a NaT indication for the source register. If the NaT bit corresponding to GR r2 is 1 (in the gr_form), or FR f2 contains a NaTVal (in the fr_form), the check fails.
In the data_form, success is determined by the ALAT. The ALAT is queried using the general register specifier r1 (in the gr_form), or the floating-point register specifier f1 (in the fr_form). If no ALAT entry matches, the check fails. An implementation may optionally cause the check to fail independent of whether an ALAT entry matches. A chk.a with general register specifier r0 or floating-point register specifiers f0 or f1 always fails.
The target25 operand, in assembly, specifies a label to branch to. This is encoded in the instruction as a signed immediate displacement (imm21) between the target bundle and the bundle containing this instruction (imm21 = target25 – IP >> 4).
The branching behavior of this instruction can be optionally unimplemented. If the instruction would have branched, and the branching behavior is not implemented, then a Speculative Operation fault is taken and the value specified by imm21 is zero-extended and placed in the Interruption Immediate control register (IIM). The fault handler emulates the branch by sign-extending the IIM value, adding it to IIP and returning.
The control_form of this instruction for checking general registers can be encoded on either an I-unit or an M-unit. The pseudo-op can be used if the unit type to execute on is unimportant.
For the data_form, if an ALAT entry matches, the matching ALAT entry can be optionally invalidated, based on the value of the aclr completer.