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     r0, rINST, lsr #8           @ r0<- A+
12    mov     r1, rINST, lsr #12          @ r1<- B
13    and     r0, r0, #15
14    GET_VREG(r3, r1)                    @ r3<- vB
15    GET_VREG(r2, r0)                    @ r2<- vA
16    FETCH_S(r1, 1)                      @ r1<- branch offset, in code units
17    cmp     r2, r3                      @ compare (vA, vB)
18    mov${revcmp} r1, #2                 @ r1<- BYTE branch dist for not-taken
19    adds    r2, r1, r1                  @ convert to bytes, check sign
20    FETCH_ADVANCE_INST_RB(r2)           @ update rPC, load rINST
21#if defined(WITH_JIT)
22    ldr     r0, [rSELF, #offThread_pJitProfTable]
23    ldrmi   rIBASE, [rSELF, #offThread_curHandlerTable]  @ refresh rIBASE
24    cmp     r0,#0
25    bne     common_updateProfile
26#else
27    ldrmi   rIBASE, [rSELF, #offThread_curHandlerTable]  @ refresh rIBASE
28#endif
29    GET_INST_OPCODE(ip)                 @ extract opcode from rINST
30    GOTO_OPCODE(ip)                     @ jump to next instruction
31