Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 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 |
Serguei Katkov | 05dfaaa | 2016-01-28 08:21:26 +0600 | [diff] [blame] | 14 | GET_VREG %eax, %eax # eax <- vB |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 15 | movswl 2(rPC), %ecx # ecx <- ssssCCCC |
| 16 | andb $$0xf, rINSTbl # rINST <- A |
| 17 | $instr # for example: addl %ecx, %eax |
Serguei Katkov | 05dfaaa | 2016-01-28 08:21:26 +0600 | [diff] [blame] | 18 | SET_VREG $result, rINST |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 19 | ADVANCE_PC_FETCH_AND_GOTO_NEXT 2 |