Home | History | Annotate | Download | only in x86
      1 %default {"result":"%eax"}
      2 /*
      3  * Generic 32-bit "lit16" binary operation.  Provide an "instr" line
      4  * that specifies an instruction that performs "result = eax op ecx".
      5  * This could be an x86 instruction or a function call.  (If the result
      6  * comes back in a register other than eax, you can override "result".)
      7  *
      8  * For: add-int/lit16, rsub-int,
      9  *      and-int/lit16, or-int/lit16, xor-int/lit16
     10  */
     11     /* binop/lit16 vA, vB, #+CCCC */
     12     movzbl  rINSTbl, %eax                   # eax <- 000000BA
     13     sarl    $$4, %eax                       # eax <- B
     14     GET_VREG %eax, %eax                     # eax <- vB
     15     movswl  2(rPC), %ecx                    # ecx <- ssssCCCC
     16     andb    $$0xf, rINSTbl                  # rINST <- A
     17     $instr                                  # for example: addl %ecx, %eax
     18     SET_VREG $result, rINST
     19     ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
     20