• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%default {"preinstr":""}
2    /*
3     * Generic 32-bit unary operation.  Provide an "instr" line that
4     * specifies an instruction that performs "a0 = op a0".
5     *
6     * for: int-to-byte, int-to-char, int-to-short,
7     *      not-int, neg-int
8     */
9    /* unop vA, vB */
10    ext     a3, rINST, 12, 4            # a3 <- B
11    GET_VREG a0, a3                     # a0 <- vB
12    ext     a2, rINST, 8, 4             # a2 <- A
13    $preinstr                           # optional op
14    FETCH_ADVANCE_INST 1                # advance rPC, load rINST
15    $instr                              # a0 <- op, a0-a3 changed
16    GET_INST_OPCODE v0                  # extract opcode from rINST
17    SET_VREG a0, a2                     # vA <- a0
18    GOTO_OPCODE v0                      # jump to next instruction
19