blob: 2fd59de9361cf90f4f409b84ab52404611744dbd [file] [log] [blame]
Bill Buzbee7c58bd42016-01-20 20:46:01 +00001%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 Katkov05dfaaa2016-01-28 08:21:26 +060014 GET_VREG %eax, %eax # eax <- vB
Bill Buzbee7c58bd42016-01-20 20:46:01 +000015 movswl 2(rPC), %ecx # ecx <- ssssCCCC
16 andb $$0xf, rINSTbl # rINST <- A
17 $instr # for example: addl %ecx, %eax
Serguei Katkov05dfaaa2016-01-28 08:21:26 +060018 SET_VREG $result, rINST
Bill Buzbee7c58bd42016-01-20 20:46:01 +000019 ADVANCE_PC_FETCH_AND_GOTO_NEXT 2