blob: 3d7dec006dacbe4f43a8496edaa161e367ca98a3 [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 */
buzbee1452bee2015-03-06 14:43:04 -08009 mov r0, rINST, lsr #8 @ r0<- AA
10 GET_VREG r2, r0 @ r2<- vAA
Bill Buzbeefd522f92016-02-11 22:37:42 +000011 FETCH_S rINST, 1 @ rINST<- branch offset, in code units
12 ldr lr, [rSELF, #THREAD_FLAGS_OFFSET]
buzbee1452bee2015-03-06 14:43:04 -080013 cmp r2, #0 @ compare (vA, 0)
buzbeef1dcacc2016-02-24 14:24:24 -080014 mov${revcmp} rINST, #2
15#if MTERP_PROFILE_BRANCHES
16 @ TUNING: once measurements are complete, remove #if and hand-schedule.
Bill Buzbeefd522f92016-02-11 22:37:42 +000017 EXPORT_PC
18 mov r0, rSELF
19 add r1, rFP, #OFF_FP_SHADOWFRAME
20 mov r2, rINST
21 bl MterpProfileBranch @ (self, shadow_frame, offset)
22 cmp r0, #0
23 bne MterpOnStackReplacement @ Note: offset must be in rINST
buzbee1452bee2015-03-06 14:43:04 -080024#endif
buzbeef1dcacc2016-02-24 14:24:24 -080025 adds r1, rINST, rINST @ convert to bytes & set flags
26 FETCH_ADVANCE_INST_RB r1 @ update rPC, load rINST
27 bmi MterpCheckSuspendAndContinue
28 GET_INST_OPCODE ip @ extract opcode from rINST
29 GOTO_OPCODE ip @ jump to next instruction