# if-test

## Purpose

Branch to the given destination if the given two registers' values compare 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
--- | --- | ---
32..37 22t | if-test vA, vB, +CCCC 32: if-eq 33: if-ne 34: if-lt 35: if-ge 36: if-gt 37: if-le | `A:` first register to test (4 bits) `B:` second register to test (4 bits) `C:` signed branch offset (16 bits)

## Constraints

- A and B must be valid register indices for the current stack frame.
- Registers vA and vB must not contain a reference value.
- Registers vA and vB must not be part of a register pair.
- Registers vA and vB must not contain a floating point value (???).
C must of a signed offset that, when added to the PC of the instruction, points to a valid bytecode instruction inside the same method.

## Behavior

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

## Exceptions

None.