blob: 6e9ef551041911db61b9773a9a9bedc3cfa20d3e [file] [log] [blame]
buzbee1452bee2015-03-06 14:43:04 -08001 /*
2 * Generic one-operand compare-and-branch operation. Provide a "revcmp"
3 * fragment that specifies the *reverse* comparison to perform, e.g.
4 * for "if-le" you would use "gt".
5 *
6 * for: if-eqz, if-nez, if-ltz, if-gez, if-gtz, if-lez
7 */
8 /* if-cmp vAA, +BBBB */
9#if MTERP_SUSPEND
10 mov r0, rINST, lsr #8 @ r0<- AA
11 GET_VREG r2, r0 @ r2<- vAA
12 FETCH_S r1, 1 @ r1<- branch offset, in code units
13 cmp r2, #0 @ compare (vA, 0)
14 mov${revcmp} r1, #2 @ r1<- inst branch dist for not-taken
15 adds r1, r1, r1 @ convert to bytes & set flags
16 FETCH_ADVANCE_INST_RB r1 @ update rPC, load rINST
17 ldrmi rIBASE, [rSELF, #THREAD_CURRENT_IBASE_OFFSET] @ refresh table base
18 GET_INST_OPCODE ip @ extract opcode from rINST
19 GOTO_OPCODE ip @ jump to next instruction
20#else
21 mov r0, rINST, lsr #8 @ r0<- AA
22 GET_VREG r2, r0 @ r2<- vAA
23 FETCH_S r1, 1 @ r1<- branch offset, in code units
24 ldr lr, [rSELF, #THREAD_FLAGS_OFFSET]
25 cmp r2, #0 @ compare (vA, 0)
26 mov${revcmp} r1, #2 @ r1<- inst branch dist for not-taken
27 adds r1, r1, r1 @ convert to bytes & set flags
28 FETCH_ADVANCE_INST_RB r1 @ update rPC, load rINST
29 bmi MterpCheckSuspendAndContinue
30 GET_INST_OPCODE ip @ extract opcode from rINST
31 GOTO_OPCODE ip @ jump to next instruction
32#endif