blob: b2cc18ba20d68269f85e429c252cbc53a6340f0d [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
buzbeea0a16102016-02-03 15:23:56 -080023 FETCH_S rINST, 1 @ rINST<- branch offset, in code units
buzbee1452bee2015-03-06 14:43:04 -080024 ldr lr, [rSELF, #THREAD_FLAGS_OFFSET]
25 cmp r2, #0 @ compare (vA, 0)
buzbeea0a16102016-02-03 15:23:56 -080026 mov${revcmp} rINST, #2 @ rINST<- inst branch dist for not-taken
27#if MTERP_PROFILE_BRANCHES
28 mov r0, rSELF
29 add r1, rFP, #OFF_FP_SHADOWFRAME
30 mov r2, rINST
31 bl MterpProfileBranch @ (self, shadow_frame, offset)
32 cmp r0, #0
33 bne MterpOnStackReplacement @ Note: offset must be in rINST
34#endif
35 adds r1, rINST, rINST @ convert to bytes & set flags
buzbee1452bee2015-03-06 14:43:04 -080036 FETCH_ADVANCE_INST_RB r1 @ update rPC, load rINST
37 bmi MterpCheckSuspendAndContinue
38 GET_INST_OPCODE ip @ extract opcode from rINST
39 GOTO_OPCODE ip @ jump to next instruction
40#endif