# const-wide

## Purpose

Move the given literal value (sign-extended to 64 bits) into the specified register-pair.

## Details

Op & Format | Mnemonic / Syntax | Arguments
--- | --- | ---
16 21s | const-wide/16 vAA, #+BBBB | `A:` destination register (8 bits) `B:` signed int (16 bits)
17 31i | const-wide/32 vAA, #+BBBBBBBB | `A:` destination register (8 bits) `B:` signed int (32 bits)
18 51l | const-wide vAA, #+BBBBBBBBBBBBBBBB | `A:` destination register (8 bits) `B:` arbitrary double-width (64-bit) constant
19 21h | const-wide/high16 vAA, #+BBBB000000000000 | `A:` destination register (8 bits) `B:` signed int (16 bits)

## Constraints

- A must be a valid register index in the current stack frame.

## Behavior

- First, an adjusted value B' is determined as follows:
  - If we are executing the /high16 variant, then B is left-shifted by 40 bits, that is, B'=B << 0x28
  - Otherwise, if B is a 16 bit or 32 bit constant, it is sign-extended to 64 bits, that is, B'=sign-extended(B).
  - Otherwise, B'=B.
- The immediate value B is moved into the register pair (vA, v(A+1)), that is,
  - vA' = B << 0x20
  - v(A+1)' = B & 0xffffffff
- If v(A-1) is the lower half of a register pair, v(A-1)' becomes undefined.
- If v(A+2) is the upper half of a register pair, v(A+2)' becomes undefined.

## Exceptions

None.