# unop

## Purpose

Perform the identified unary operation on the source register, storing the result in the destination register.

## Details

Op & Format | Mnemonic / Syntax | Arguments
--- | --- | ---
7b..8f 12x | unop vA, vB 7b: neg-int 7c: not-int 7d: neg-long 7e: not-long 7f: neg-float 80: neg-double 81: int-to-long 82: int-to-float 83: int-to-double 84: long-to-int 85: long-to-float 86: long-to-double 87: float-to-int 88: float-to-long 89: float-to-double 8a: double-to-int 8b: double-to-long 8c: double-to-float 8d: int-to-byte 8e: int-to-char 8f: int-to-short | `A:` destination register or pair (4 bits) `B:` source register or pair (4 bits)

## Constraints

- Both A and B must be valid register indices for the current stackframe.
- If the input type of <unop> is double or long, also B+1 must be a valid register index in the current stackframe.
- If the output type of <unop> is double or long, also A+1 must be a valid register index in the current stackframe.
- The type of register vB must match the source type of the instruction (this probably needs more detail).

## Behavior

- The given operation <unop> is performed according to the semantics specified in table XXX.
- The result is stored in register vA, that is, vA'=<unop> vB.
- It gets a bit messy if we want to describe all the combinations of input and output with and without pairs here. Probably it's better to split it up.

## Exceptions

- ArithmeticException if an arithmetic error occurs during the instruction.