1 %default {"preinstr":"", "chkzero":"0"}
3 * Generic 32-bit "/2addr" binary operation. Provide an "instr" and
5 * that specifies an instruction that performs "result = a0 op a1".
6 * This could be an MIPS instruction or a function call.
7 * If "chkzero" is set to 1, we perform a divide-by-zero check on
8 * vCC (a1). Useful for integer division and modulus.
10 * For: add-float/2addr, sub-float/2addr, mul-float/2addr,
11 * div-float/2addr, rem-float/2addr
13 /* binop/2addr vA, vB */
14 GET_OPA4(rOBJ) # t1 <- A+
17 GET_VREG(a0, rOBJ) # a0 <- vA
18 GET_VREG(a1, a3) # a1 <- vB
20 # is second operand zero?
21 beqz a1, common_errDivideByZero
27 # is second operand zero?
30 bc1t fcc0, common_errDivideByZero
33 FETCH_ADVANCE_INST(1) # advance rPC, load rINST
34 $preinstr # optional op
36 $instr # result <- op, a0-a3 changed
37 SET_VREG(v0, rOBJ) # vAA <- result
40 SET_VREG_F(fv0, rOBJ) # vAA <- result
42 GET_INST_OPCODE(t0) # extract opcode from rINST
43 GOTO_OPCODE(t0) # jump to next instruction
44 /* 10-13 instructions */