1 %verify "branch taken" 2 %verify "branch not taken" 3 /* 4 * Generic two-operand compare-and-branch operation. Provide a "revcmp" 5 * fragment that specifies the *reverse* comparison to perform, e.g. 6 * for "if-le" you would use "gt". 7 * 8 * For: if-eq, if-ne, if-lt, if-ge, if-gt, if-le 9 */ 10 /* if-cmp vA, vB, +CCCC */ 11 mov r1, rINST, lsr #12 @ r1<- B 12 ubfx r0, rINST, #8, #4 @ r0<- A 13 GET_VREG(r3, r1) @ r3<- vB 14 GET_VREG(r2, r0) @ r2<- vA 15 mov r9, #4 @ r0<- BYTE branch dist for not-taken 16 cmp r2, r3 @ compare (vA, vB) 17 b${revcmp} 1f @ branch to 1 if comparison failed 18 FETCH_S(r9, 1) @ r9<- branch offset, in code units 19 movs r9, r9, asl #1 @ convert to bytes, check sign 20 bmi common_backwardBranch @ yes, do periodic checks 21 1: 22 #if defined(WITH_JIT) 23 GET_JIT_PROF_TABLE(r0) 24 FETCH_ADVANCE_INST_RB(r9) @ update rPC, load rINST 25 b common_testUpdateProfile 26 #else 27 FETCH_ADVANCE_INST_RB(r9) @ update rPC, load rINST 28 GET_INST_OPCODE(ip) @ extract opcode from rINST 29 GOTO_OPCODE(ip) @ jump to next instruction 30 #endif 31