# binop/2addr

## Purpose

Perform the identified binary operation on the two source registers, storing the result in the first source register.

## Details

Op & Format | Mnemonic / Syntax | Arguments
--- | --- | ---
b0..cf 12x | binop/2addr vA, vB b0: add-int/2addr b1: sub-int/2addr b2: mul-int/2addr b3: div-int/2addr b4: rem-int/2addr b5: and-int/2addr b6: or-int/2addr b7: xor-int/2addr b8: shl-int/2addr b9: shr-int/2addr ba: ushr-int/2addr bb: add-long/2addr bc: sub-long/2addr bd: mul-long/2addr be: div-long/2addr bf: rem-long/2addr c0: and-long/2addr c1: or-long/2addr c2: xor-long/2addr c3: shl-long/2addr c4: shr-long/2addr c5: ushr-long/2addr c6: add-float/2addr c7: sub-float/2addr c8: mul-float/2addr c9: div-float/2addr ca: rem-float/2addr cb: add-double/2addr cc: sub-double/2addr cd: mul-double/2addr ce: div-double/2addr cf: rem-double/2addr | `A:` destination and first source register or pair (4 bits) `B:` second source register or pair (4 bits)

## Constraints

- Both A and B must be valid register indices in the current stackframe.
- For the -long and -double variants, also A+1 and B+1 must be valid register indices.
- Registers vA and vB must be defined. They must both contain values that match the variant of the instruction (it's probably better to split this up into multiple pages again).

## Behavior

- The given operation <binop> is performed according to the semantics specified in table XXX.
- The result is stored in register vA, that is, vA'=vA <binop> vB.
- For the -double and -long variants, (vA+1) is also affected.
- As usual, neighboring registers might get undefined, if vA (and vA+1) were part of a register pair originally.

## Exceptions

- ArithmeticException if an error occurs during the instruction.