Serguei Katkov | 99229c7 | 2015-12-31 13:05:31 +0600 | [diff] [blame^] | 1 | %default {"result":"%eax"} |
| 2 | /* |
| 3 | * Generic 32-bit "lit8" 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 r0, you can override "result".) |
| 7 | * |
| 8 | * For: add-int/lit8, rsub-int/lit8 |
| 9 | * and-int/lit8, or-int/lit8, xor-int/lit8, |
| 10 | * shl-int/lit8, shr-int/lit8, ushr-int/lit8 |
| 11 | */ |
| 12 | /* binop/lit8 vAA, vBB, #+CC */ |
| 13 | movzbl 2(rPC), %eax # eax <- BB |
| 14 | movsbl 3(rPC), %ecx # ecx <- ssssssCC |
| 15 | GET_VREG %eax %eax # eax <- rBB |
| 16 | $instr # ex: addl %ecx,%eax |
| 17 | SET_VREG $result rINST |
| 18 | ADVANCE_PC_FETCH_AND_GOTO_NEXT 2 |