# if-<test>z

## Purpose

Branch to the given destination if the given register's value compares with 0 as specified.

Note: The branch offset may not be 0. (A spin loop may be legally constructed either by branching around a backward goto or by including a nop as a target before the branch.)

## Details

Op & Format | Mnemonic / Syntax | Arguments
--- | --- | ---
38..3d 21t | if-testz vAA, +BBBB 38: if-eqz 39: if-nez 3a: if-ltz 3b: if-gez 3c: if-gtz 3d: if-lez | `A:` register to test (8 bits) `B:` signed branch offset (16 bits)

## Constraints

- A must be a valid register index for the current stackframe.
- Register vA must not contain a reference value.
- Register vA must not be part of a register pair.
- Register vA must not contain a floating point value (???).
- B must not be 0.

## Behavior

- The value of register vA is compared to zero according to the <test> condition. Two results are possible:
  - The condition holds. The value of B is used as a signed offset to the address of the if-<test>z instruction. Execution continues at the resulting address.
  - The condition does not hold. Execution continues at the instruction following the if-<test>z instruction.

## Exceptions

None.