1    /*
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    GET_OPA(a0)                            #  a0 <- AA
10    GET_VREG(a2, a0)                       #  a2 <- vAA
11    FETCH_S(rINST, 1)                      #  rINST <- branch offset, in code units
12    b${revcmp} a2, zero, 1f                #  branch to 1 if comparison failed
13    b 2f
141:
15    li        rINST, 2                     #  rINST- BYTE branch dist for not-taken
162:
17#if MTERP_PROFILE_BRANCHES
18    EXPORT_PC()
19    move      a0, rSELF
20    addu      a1, rFP, OFF_FP_SHADOWFRAME
21    move      a2, rINST
22    JAL(MterpProfileBranch)                #  (self, shadow_frame, offset)
23    bnez      v0, MterpOnStackReplacement  #  Note: offset must be in rINST
24#endif
25    addu      a1, rINST, rINST             #  convert to bytes
26    FETCH_ADVANCE_INST_RB(a1)              #  update rPC, load rINST
27    bgez      a1, 3f
28    lw        ra, THREAD_FLAGS_OFFSET(rSELF)
29    b         MterpCheckSuspendAndContinue
303:
31    GET_INST_OPCODE(t0)                    #  extract opcode from rINST
32    GOTO_OPCODE(t0)                        #  jump to next instruction
33