1%default {"preinstr":"", "instr":"add x0, x0, x1", "r0":"x0", "r1":"x1", "chkzero":"0"}
2    /*
3     * Generic 64-bit "/2addr" binary operation.  Provide an "instr" line
4     * that specifies an instruction that performs "x0 = x0 op x1".
5     * This must not be a function call, as we keep w2 live across it.
6     *
7     * If "chkzero" is set to 1, we perform a divide-by-zero check on
8     * vCC (w1).  Useful for integer division and modulus.
9     *
10     * For: add-long/2addr, sub-long/2addr, mul-long/2addr, div-long/2addr,
11     *      and-long/2addr, or-long/2addr, xor-long/2addr,
12     *      shl-long/2addr, shr-long/2addr, ushr-long/2addr, add-double/2addr,
13     *      sub-double/2addr, mul-double/2addr, div-double/2addr, rem-double/2addr
14     */
15    /* binop/2addr vA, vB */
16    lsr     w1, wINST, #12              // w1<- B
17    ubfx    w2, wINST, #8, #4           // w2<- A
18    GET_VREG_WIDE $r1, w1               // x1<- vB
19    GET_VREG_WIDE $r0, w2               // x0<- vA
20    .if $chkzero
21    cbz     $r1, common_errDivideByZero
22    .endif
23    FETCH_ADVANCE_INST 1                // advance rPC, load rINST
24    $preinstr
25    $instr                              // result<- op
26    GET_INST_OPCODE ip                  // extract opcode from rINST
27    SET_VREG_WIDE $r0, w2               // vAA<- result
28    GOTO_OPCODE ip                      // jump to next instruction
29    /* 10-13 instructions */
30